예제 #1
0
        public MainScreen(ScreenComponent manager)
            : base(manager)
        {
            Padding = new Border(0,0,0,0);

            //Image background = new Image(manager);
            //background.Texture = manager.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/background.png", manager.GraphicsDevice);
            //background.VerticalAlignment = VerticalAlignment.Stretch;
            //background.HorizontalAlignment = HorizontalAlignment.Stretch;
            //Controls.Add(background);

            Background = new TextureBrush(manager.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/background.png", manager.GraphicsDevice), TextureBrushMode.Stretch);

            StackPanel stack = new StackPanel(manager);
            Controls.Add(stack);

            Button startButton = Button.TextButton(manager, Languages.OctoClient.Start);
            startButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            startButton.Margin = new Border(0, 0, 0, 10);
            startButton.LeftMouseClick += (s, e) =>
            {
                manager.NavigateToScreen(new LoadScreen(manager));
            };
            stack.Controls.Add(startButton);

            Button optionButton = Button.TextButton(manager, Languages.OctoClient.Options);
            optionButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            optionButton.Margin = new Border(0, 0, 0, 10);
            optionButton.MinWidth = 300;
            optionButton.LeftMouseClick += (s, e) =>
            {
                manager.NavigateToScreen(new OptionsScreen(manager));
            };
            stack.Controls.Add(optionButton);

            Button creditsButton = Button.TextButton(manager, Languages.OctoClient.CreditsCrew);
            creditsButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            creditsButton.Margin = new Border(0, 0, 0, 10);
            creditsButton.LeftMouseClick += (s, e) =>
            {
                manager.NavigateToScreen(new CreditsScreen(manager));
            };
            stack.Controls.Add(creditsButton);

            Button webButton = Button.TextButton(manager, "Octoawesome.net");
            webButton.VerticalAlignment = VerticalAlignment.Bottom;
            webButton.HorizontalAlignment = HorizontalAlignment.Right;
            webButton.Margin = new Border(10, 10, 10, 10);
            webButton.LeftMouseClick += (s, e) =>
            {
                Process.Start("http://octoawesome.net/");
            };
            Controls.Add(webButton);

            Button exitButton = Button.TextButton(manager, Languages.OctoClient.Exit);
            exitButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            exitButton.Margin = new Border(0, 0, 0, 10);
            exitButton.LeftMouseClick += (s, e) => { manager.Exit(); };
            stack.Controls.Add(exitButton);
        }
예제 #2
0
		public void SetOpacity (TextureBrush widget, float opacity)
		{
			var brush = ((sd.TextureBrush)widget.ControlObject);
			widget.ControlObject = Create (widget.Image, opacity);;
			var newbrush = ((sd.TextureBrush)widget.ControlObject);
			newbrush.Transform = brush.Transform;
		}
예제 #3
0
        /// <summary>
        /// Конструктор по умолчанию
        /// </summary>
        /// <param name="form">форма, к которому пренадлежит данный курсор</param>
        /// <param name="brush">кисть рисования курсора</param>
        public Cursor(Form form, TextureBrush brush)
        {
            Window = form;
            TextureBrush = brush;

            Window.Paint += Window_Paint;
            Window.MouseMove += Window_MouseMove;
        }
	// Constructor.
	public DrawingTextureBrush(IToolkit toolkit, TextureBrush properties,
		IToolkitImage image, RectangleF dstRect,
		ImageAttributes imageAttr) : base(toolkit, Color.Black)
	{
		this.properties = properties;
		this.image = image as DrawingImage;
		this.dstRect = dstRect;
		this.imageAttr = imageAttr;
	}
예제 #5
0
        public MainScreen(ScreenComponent manager)
            : base(manager)
        {
            assets = manager.Game.Assets;

            Padding = new Border(0,0,0,0);

            Background = new TextureBrush(assets.LoadTexture(typeof(ScreenComponent), "background"), TextureBrushMode.Stretch);

            StackPanel stack = new StackPanel(manager);
            Controls.Add(stack);

            Button startButton = Button.TextButton(manager, Languages.OctoClient.Start);
            startButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            startButton.Margin = new Border(0, 0, 0, 10);
            startButton.LeftMouseClick += (s, e) =>
            {
                manager.NavigateToScreen(new LoadScreen(manager));
            };
            stack.Controls.Add(startButton);

            Button optionButton = Button.TextButton(manager, Languages.OctoClient.Options);
            optionButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            optionButton.Margin = new Border(0, 0, 0, 10);
            optionButton.MinWidth = 300;
            optionButton.LeftMouseClick += (s, e) =>
            {
                manager.NavigateToScreen(new OptionsScreen(manager));
            };
            stack.Controls.Add(optionButton);

            Button creditsButton = Button.TextButton(manager, Languages.OctoClient.CreditsCrew);
            creditsButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            creditsButton.Margin = new Border(0, 0, 0, 10);
            creditsButton.LeftMouseClick += (s, e) =>
            {
                manager.NavigateToScreen(new CreditsScreen(manager));
            };
            stack.Controls.Add(creditsButton);

            Button webButton = Button.TextButton(manager, "Octoawesome.net");
            webButton.VerticalAlignment = VerticalAlignment.Bottom;
            webButton.HorizontalAlignment = HorizontalAlignment.Right;
            webButton.Margin = new Border(10, 10, 10, 10);
            webButton.LeftMouseClick += (s, e) =>
            {
                Process.Start("http://octoawesome.net/");
            };
            Controls.Add(webButton);

            Button exitButton = Button.TextButton(manager, Languages.OctoClient.Exit);
            exitButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            exitButton.Margin = new Border(0, 0, 0, 10);
            exitButton.LeftMouseClick += (s, e) => { manager.Exit(); };
            stack.Controls.Add(exitButton);
        }
예제 #6
0
    protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
    {
        Graphics G = e.Graphics;
        base.OnPaint(e);
        G.Clear(this.BackColor);

        //| Drawing the main rectangle base.
        Rectangle MainRect = new Rectangle(0, 0, Width - 1, Height - 1);
        Rectangle MainHighlightRect = new Rectangle(1, 1, Width - 3, Height - 3);
        TextureBrush BGTextureBrush = new TextureBrush(D.CodeToImage(D.BGTexture), WrapMode.TileFlipXY);
        G.FillRectangle(BGTextureBrush, MainRect);

        if (OverlayCol != null)
        {
            G.FillRectangle(new SolidBrush(OverlayCol), MainRect);
        }

        //| Detail to the main rect's top & bottom gradients
        int GradientHeight = Height / 2;
        Rectangle ShineRect = new Rectangle(0, 0, Width, GradientHeight);
        Rectangle ShineRect2 = new Rectangle(0, GradientHeight, Width, GradientHeight);
        G.FillRectangle(new SolidBrush(Color.FromArgb(40, Pal.ColMed)), ShineRect);
        D.FillGradientBeam(G, Color.Transparent, Color.FromArgb(60, Pal.ColHighest), ShineRect, GradientAlignment.Vertical);
        D.FillGradientBeam(G, Color.Transparent, Color.FromArgb(30, Pal.ColHighest), ShineRect2, GradientAlignment.Vertical);
        if (DrawSeparator)
        {
            G.DrawLine(new Pen(Color.FromArgb(50, Color.Black)), new Point(1, ShineRect.Height), new Point(Width - 2, ShineRect.Height));
            G.DrawLine(new Pen(Color.FromArgb(35, Pal.ColHighest)), new Point(1, ShineRect.Height + 1), new Point(Width - 2, ShineRect.Height + 1));
            G.DrawLine(new Pen(Color.FromArgb(50, Color.Black)), new Point(1, ShineRect.Height + 2), new Point(Width - 2, ShineRect.Height + 2));
        }

        //| Goind back through and making the rect below the detail darker
        LinearGradientBrush DarkLGB = new LinearGradientBrush(MainRect, Color.FromArgb(20, Color.Black), Color.FromArgb(100, Color.Black), 90);
        G.FillRectangle(DarkLGB, MainRect);

        switch (State)
        {
            case MouseState.Over:
                G.FillRectangle(new SolidBrush(Color.FromArgb(30, Pal.ColHighest)), MainRect);
                break;
            case MouseState.Down:
                G.FillRectangle(new SolidBrush(Color.FromArgb(56, Color.Black)), MainRect);
                break;
        }

        G.DrawRectangle(new Pen(Color.FromArgb(40, Pal.ColHighest)), MainHighlightRect);
        G.DrawRectangle(Pens.Black, MainRect);
        if (!Enabled)
        {
            ForeColor = Color.FromArgb(146, 149, 152);
        }
        D.DrawTextWithShadow(G, new Rectangle(0, 0, Width, Height), Text, Font, HorizontalAlignment.Center, ForeColor, Color.Black);
    }
예제 #7
0
        public PauseScreen(ScreenComponent manager)
            : base(manager)
        {
            assets = manager.Game.Assets;

            // IsOverlay = true;
            // Background = new BorderBrush(new Color(Color.Black, 0.5f));

            Background = new TextureBrush(assets.LoadTexture(typeof(ScreenComponent), "background"), TextureBrushMode.Stretch);

            StackPanel stack = new StackPanel(manager);
            Controls.Add(stack);

            Button resumeButton = Button.TextButton(manager, Languages.OctoClient.Resume);
            resumeButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            resumeButton.Margin = new Border(0, 0, 0, 10);
            resumeButton.LeftMouseClick += (s, e) =>
            {
                manager.NavigateBack();
            };
            stack.Controls.Add(resumeButton);

            Button optionButton = Button.TextButton(manager, Languages.OctoClient.Options);
            optionButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            optionButton.Margin = new Border(0, 0, 0, 10);
            optionButton.MinWidth = 300;
            optionButton.LeftMouseClick += (s, e) =>
            {
                manager.NavigateToScreen(new OptionsScreen(manager));
            };
            stack.Controls.Add(optionButton);

            Button creditsButton = Button.TextButton(manager, Languages.OctoClient.CreditsCrew);
            creditsButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            creditsButton.Margin = new Border(0, 0, 0, 10);
            creditsButton.LeftMouseClick += (s, e) =>
            {
                manager.NavigateToScreen(new CreditsScreen(manager));
            };
            stack.Controls.Add(creditsButton);

            Button mainMenuButton = Button.TextButton(manager, Languages.OctoClient.ToMainMenu);
            mainMenuButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            mainMenuButton.Margin = new Border(0, 0, 0, 10);
            mainMenuButton.LeftMouseClick += (s, e) =>
            {
                manager.Player.RemovePlayer();
                manager.Game.Simulation.ExitGame();
                manager.NavigateHome();
            };
            stack.Controls.Add(mainMenuButton);
        }
예제 #8
0
		public IMatrix GetTransform (TextureBrush widget)
		{
			return ((sd.TextureBrush)widget.ControlObject).Transform.ToEto ();
		}
예제 #9
0
        internal static void DrawBackgroundImage(this Graphics g, Image backgroundImage, Color backColor,
                                                 ImageLayout backgroundImageLayout, Rectangle bounds, Rectangle clipRect, Point scrollOffset,
                                                 RightToLeft rightToLeft)
        {
            if (g == null)
            {
                throw new ArgumentNullException("g");
            }
            if (backgroundImageLayout == ImageLayout.Tile)
            {
                using (var brush = new TextureBrush(backgroundImage, WrapMode.Tile)) {
                    if (scrollOffset != Point.Empty)
                    {
                        var transform = brush.Transform;
                        transform.Translate(scrollOffset.X, scrollOffset.Y);
                        brush.Transform = transform;
                    }
                    g.FillRectangle(brush, clipRect);
                    return;
                }
            }
            var rect = CalculateBackgroundImageRectangle(bounds, backgroundImage, backgroundImageLayout);

            if (rightToLeft == RightToLeft.Yes && backgroundImageLayout == ImageLayout.None)
            {
                rect.X += clipRect.Width - rect.Width;
            }
            using (var brush2 = new SolidBrush(backColor)) {
                g.FillRectangle(brush2, clipRect);
            }
            if (!clipRect.Contains(rect))
            {
                if (backgroundImageLayout == ImageLayout.Stretch || backgroundImageLayout == ImageLayout.Zoom)
                {
                    rect.Intersect(clipRect);
                    g.DrawImage(backgroundImage, rect);
                }
                else if (backgroundImageLayout == ImageLayout.None)
                {
                    rect.Offset(clipRect.Location);
                    var destRect = rect;
                    destRect.Intersect(clipRect);
                    var rectangle3 = new Rectangle(Point.Empty, destRect.Size);
                    g.DrawImage(backgroundImage, destRect, rectangle3.X, rectangle3.Y, rectangle3.Width,
                                rectangle3.Height, GraphicsUnit.Pixel);
                }
                else
                {
                    var rectangle4 = rect;
                    rectangle4.Intersect(clipRect);
                    var rectangle5 = new Rectangle(new Point(rectangle4.X - rect.X, rectangle4.Y - rect.Y),
                                                   rectangle4.Size);
                    g.DrawImage(backgroundImage, rectangle4, rectangle5.X, rectangle5.Y, rectangle5.Width,
                                rectangle5.Height, GraphicsUnit.Pixel);
                }
            }
            else
            {
                using (var imageAttr = new ImageAttributes()) {
                    imageAttr.SetWrapMode(WrapMode.TileFlipXY);
                    g.DrawImage(backgroundImage, rect, 0, 0, backgroundImage.Width, backgroundImage.Height,
                                GraphicsUnit.Pixel, imageAttr);
                }
            }
        }
예제 #10
0
 private void loadBrush()
 {
     brushTexture = s_BrushTextures[currentSelectedBrush];
     if (currentTextureBrush != null)
         currentTextureBrush.Dispose();
     currentTextureBrush = new TextureBrush();
     currentTextureBrush.Load(brushTexture,64);
 }
예제 #11
0
        private ResponseMessage DisplayJigsawPuzzle(bool showGhostPicture)
        {
            if (_sourcePicture == null)
            {
                return(new ResponseMessage
                {
                    Message = "Please provide source picture."
                });
            }

            int boardWidth  = this.ClientSize.Width;
            int boardHeight = this.ClientSize.Height;

            if (boardHeight < 100 || boardWidth < 100)
            {
                return(new ResponseMessage
                {
                    Message = "No source picture loaded."
                });
            }
            _board      = new Bitmap(boardWidth, boardHeight);
            _backBuffer = new Bitmap(boardWidth, boardHeight);
            _background = new Bitmap(boardWidth, boardHeight);

            #region Background tile image

            using (Graphics gfx = Graphics.FromImage(_background))
            {
                if (File.Exists(GameSettings.BACKGROUND_PICTURE_NAME))
                {
                    // This background image is ripped from "Jigsaw Puzzle Golden Edition"
                    Bitmap       tileImage = new Bitmap("background_tile.bmp");
                    TextureBrush tileBrush = new TextureBrush(tileImage);

                    gfx.FillRectangle(tileBrush, 0, 0, _background.Width, _background.Height);
                }
                else
                {
                    SolidBrush colorBrush = new SolidBrush(Color.FromArgb(0, 138, 184));

                    gfx.FillRectangle(colorBrush, 0, 0, _background.Width, _background.Height);
                }
            }

            if (showGhostPicture)
            {
                _background = ImageUtilities.AlphaBlendMatrix(_background, _sourcePicture, GameSettings.GHOST_PICTURE_ALPHA);
            }

            #endregion

            #region Board, backbuffer, and the form

            using (Graphics gfx = Graphics.FromImage(_board))
            {
                gfx.DrawImageUnscaled(_background, 0, 0);

                foreach (PieceCluster cluster in _clusters)
                {
                    gfx.ResetClip();
                    gfx.SetClip(cluster.MovableFigure);
                    gfx.DrawImage(cluster.Picture, cluster.BoardLocation);
                }
            }

            using (Graphics gfx = Graphics.FromImage(_backBuffer))
            {
                gfx.DrawImageUnscaled(_board, 0, 0);
            }

            using (Graphics gfx = this.CreateGraphics())
            {
                gfx.DrawImageUnscaled(_board, 0, 0);
            }

            #endregion

            return(new ResponseMessage
            {
                Okay = true
            });
        }
예제 #12
0
        public override void Draw(Graphics g, int dx, int dy, float zoom)
        {
            GraphicsState gs = g.Save();         //ulozi predchozi transformaci
            Matrix        mx = g.Transform;      // vrati predchozi transformaci

            PointF p = new PointF(zoom * (X + dx + (X1 - X) / 2), zoom * (Y + dy + (Y1 - Y) / 2));

            if (Rotace > 0)
            {
                mx.RotateAt(Rotace, p, MatrixOrder.Append);                 //prida transformaci
            }
            g.Transform = mx;

            // pozadi textove bloku
            Brush myBrush = GetBrush(dx, dy, zoom);

            // prace s texturou a osetreni pri Load / Save protoze C# neumi serializaci TextureBrush tridy
            // musim zde zbytecne tvorit 2 tridy Texturebrush ....
            TextureBrush texture = GetTextureBrush();
            TextureBrush texture2;

            if (texture == null)
            {
                ObrBitmap = ImageOfTexture;
                ObrBitmap = ChangeOpacity(ObrBitmap, (Průhlednost / 100));
                texture2  = new TextureBrush(ObrBitmap);
            }
            else
            {
                ObrImage            = texture.Image;
                ObrImage            = ChangeOpacity(ObrImage, (Průhlednost / 100));
                texture2            = new TextureBrush(ObrImage);
                PrevodImageNaBitmap = new Bitmap(ObrImage);
                ImageOfTexture      = PrevodImageNaBitmap;
            }

            float scalX = zoom;
            float scalY = zoom;

            texture2.Transform = new Matrix(
                scalX,
                0.0f,
                0.0f,
                scalY,
                0.0f,
                0.0f);



            Pen myPen = new Pen(Pero_barva, ScaledPenWidth(zoom));

            myPen.DashStyle = DashStyleMy;
            myPen.Color     = Transparency(Pero_barva, Alpha);

            if (selected)
            {
                myPen.Color = Color.Red;
                myPen.Color = this.Transparency(myPen.Color, 120);
                myPen.Width = myPen.Width + 1;
            }


            if (TextureFilled || ColorFilled)
            {
                if (TextureFilled)
                {
                    g.FillRectangle(texture2, (X + dx) * zoom, (Y + dy) * zoom, (X1 - X) * zoom, (Y1 - Y) * zoom);
                }

                else
                {
                    g.FillRectangle(myBrush, (X + dx) * zoom, (Y + dy) * zoom, (X1 - X) * zoom, (Y1 - Y) * zoom);
                }


                if (Ohraničení || selected)
                {
                    g.DrawRectangle(myPen, (X + dx) * zoom, (Y + dy) * zoom, (X1 - X) * zoom, (Y1 - Y) * zoom);
                }
            }

            StringFormat stringFormat = new StringFormat();

            stringFormat.Alignment     = sa;
            stringFormat.LineAlignment = StringAlignment.Near;

            Font tmpf = new Font(CharFont.FontFamily, CharFont.Size * zoom, CharFont.Style);

            g.DrawString(Text, tmpf, new SolidBrush(this.Pero_barva), new RectangleF((X + dx) * zoom, (Y + dy) * zoom, (X1 - X) * zoom, (Y1 - Y) * zoom), stringFormat);

            texture2.Dispose();
            //obr.Dispose();
            // myPath.Dispose();
            myPen.Dispose();
            // translateMatrix.Dispose();

            tmpf.Dispose();
            myPen.Dispose();


            if (myBrush != null)
            {
                myBrush.Dispose();
            }

            g.Restore(gs);            // obnovi predchozi transformaci
        }
예제 #13
0
    public LayeredImage(Int32 width, Int32 height)
    {
        _width = width;
        _height = height;
        _layers = new Layers(this);

        // checker board brush

        _checkerboard = new Bitmap(32, 32, PixelFormat.Format24bppRgb);
        Color darkgray = Color.FromArgb(102,102,102);
        Color lightgray = Color.FromArgb(153,153,153);
        for (Int32 i = 0; i < 32; i++) {
            for (Int32 j = 0; j < 32; j++) {
                if ((i < 16 && j < 16) || (i >= 16 && j >= 16))
                    _checkerboard.SetPixel(j, i, lightgray);
                else
                    _checkerboard.SetPixel(j, i, darkgray);
            }
        }

        // background layer

        Layer bglayer = _layers.Add();
        Graphics g = Graphics.FromImage(bglayer._bitmap._bitmap);
        TextureBrush brush = new TextureBrush(_checkerboard);
        g.FillRectangle(brush, 0, 0, _width, _height);
        brush.Dispose();
        g.Dispose();
    }
예제 #14
0
        /// <summary>
        /// Gets a <see cref="Brush"/> representing the current paint server.
        /// </summary>
        /// <param name="renderingElement">The owner <see cref="SvgVisualElement"/>.</param>
        /// <param name="renderer">The renderer object.</param>
        /// <param name="opacity">The opacity of the brush.</param>
        /// <param name="forStroke">Not used.</param>
        public override Brush GetBrush(SvgVisualElement renderingElement, ISvgRenderer renderer, float opacity, bool forStroke = false)
        {
            var chain = new List <SvgPatternServer>();
            var curr  = this;

            while (curr != null)
            {
                chain.Add(curr);
                curr = SvgDeferredPaintServer.TryGet <SvgPatternServer>(curr.InheritGradient, renderingElement);
            }

            var childElem = chain.Where((p) => p.Children != null && p.Children.Count > 0).FirstOrDefault();

            if (childElem == null)
            {
                return(null);
            }
            var widthElem  = chain.Where((p) => p.Width != null && p.Width != SvgUnit.None).FirstOrDefault();
            var heightElem = chain.Where((p) => p.Height != null && p.Height != SvgUnit.None).FirstOrDefault();

            if (widthElem == null && heightElem == null)
            {
                return(null);
            }

            var viewBoxElem = chain.Where((p) => p.ViewBox != null && p.ViewBox != SvgViewBox.Empty).FirstOrDefault();
            var viewBox     = viewBoxElem == null ? SvgViewBox.Empty : viewBoxElem.ViewBox;
            var xElem       = chain.Where((p) => p.X != null && p.X != SvgUnit.None).FirstOrDefault();
            var yElem       = chain.Where((p) => p.Y != null && p.Y != SvgUnit.None).FirstOrDefault();
            var xUnit       = xElem == null ? SvgUnit.Empty : xElem.X;
            var yUnit       = yElem == null ? SvgUnit.Empty : yElem.Y;

            var patternUnitElem        = chain.Where((p) => p.PatternUnits != SvgCoordinateUnits.Inherit).FirstOrDefault();
            var patternUnits           = (patternUnitElem == null ? SvgCoordinateUnits.ObjectBoundingBox : patternUnitElem.PatternUnits);
            var patternContentUnitElem = chain.Where((p) => p.PatternContentUnits != SvgCoordinateUnits.Inherit).FirstOrDefault();
            var patternContentUnits    = (patternContentUnitElem == null ? SvgCoordinateUnits.UserSpaceOnUse : patternContentUnitElem.PatternContentUnits);

            try
            {
                if (patternUnits == SvgCoordinateUnits.ObjectBoundingBox)
                {
                    renderer.SetBoundable(renderingElement);
                }

                using (var patternMatrix = new Matrix())
                {
                    var bounds = renderer.GetBoundable().Bounds;
                    var xScale = (patternUnits == SvgCoordinateUnits.ObjectBoundingBox ? bounds.Width : 1);
                    var yScale = (patternUnits == SvgCoordinateUnits.ObjectBoundingBox ? bounds.Height : 1);

                    float x = xScale * NormalizeUnit(xUnit).ToDeviceValue(renderer, UnitRenderingType.Horizontal, this);
                    float y = yScale * NormalizeUnit(yUnit).ToDeviceValue(renderer, UnitRenderingType.Vertical, this);

                    float width  = xScale * NormalizeUnit(widthElem.Width).ToDeviceValue(renderer, UnitRenderingType.Horizontal, this);
                    float height = yScale * NormalizeUnit(heightElem.Height).ToDeviceValue(renderer, UnitRenderingType.Vertical, this);

                    // Apply a scale if needed
                    patternMatrix.Scale((patternContentUnits == SvgCoordinateUnits.ObjectBoundingBox ? bounds.Width : 1) *
                                        (viewBox.Width > 0 ? width / viewBox.Width : 1),
                                        (patternContentUnits == SvgCoordinateUnits.ObjectBoundingBox ? bounds.Height : 1) *
                                        (viewBox.Height > 0 ? height / viewBox.Height : 1), MatrixOrder.Prepend);

                    Bitmap image = new Bitmap((int)width, (int)height);
                    using (var iRenderer = SvgRenderer.FromImage(image))
                    {
                        iRenderer.SetBoundable((_patternContentUnits == SvgCoordinateUnits.ObjectBoundingBox) ? new GenericBoundable(0, 0, width, height) : renderer.GetBoundable());
                        iRenderer.Transform     = patternMatrix;
                        iRenderer.SmoothingMode = SmoothingMode.AntiAlias;
                        iRenderer.SetClip(new Region(new RectangleF(0, 0,
                                                                    viewBox.Width > 0 ? viewBox.Width : width,
                                                                    viewBox.Height > 0 ? viewBox.Height : height)));

                        foreach (SvgElement child in childElem.Children)
                        {
                            child.RenderElement(iRenderer);
                        }
                    }

                    TextureBrush textureBrush   = new TextureBrush(image);
                    var          brushTransform = EffectivePatternTransform.Clone();
                    brushTransform.Translate(x, y, MatrixOrder.Append);
                    textureBrush.Transform = brushTransform;
                    return(textureBrush);
                }
            }
            finally
            {
                if (this.PatternUnits == SvgCoordinateUnits.ObjectBoundingBox)
                {
                    renderer.PopBoundable();
                }
            }
        }
예제 #15
0
        public bool TryMakeDAMapSquareImage(string mapFilePath, ushort mapDimX, ushort mapDimY, double scale, Color bgColor, PixelFormat pixelFormat, out Bitmap daMapImage)
        {
            ushort num = (ushort)(12.0 * scale);

            if ((int)num < 1)
            {
                num = (ushort)1;
            }
            int width  = (int)mapDimX * (int)num;
            int height = (int)mapDimY * (int)num;

            if (width * height > 15000000)
            {
                if (MessageBox.Show("Attempting to make a " + width.ToString((IFormatProvider)CultureInfo.InvariantCulture) + " by " + height.ToString((IFormatProvider)CultureInfo.InvariantCulture) + " dimention image...  Is this intended? Propabably Not! Suggestion:  Change Scale Value, or Change Dimention (If Rhombus).  Continue?", "Warning, Continue?", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    daMapImage = (Bitmap)null;
                    return(false);
                }
            }
            daMapImage = new Bitmap(width, height, pixelFormat);
            using (Graphics graphics = Graphics.FromImage((Image)daMapImage))
            {
                using (SolidBrush solidBrush = new SolidBrush(bgColor))
                    graphics.FillRectangle((Brush)solidBrush, 0, 0, daMapImage.Width, daMapImage.Height);
                bool[,] makeDaMapBool = this.GetMakeDAMapBool(mapFilePath, mapDimX, mapDimY);
                if (makeDaMapBool == null)
                {
                    daMapImage = (Bitmap)null;
                    return(false);
                }
                using (TextureBrush textureBrush = new TextureBrush((Image)Resources.texTRANS, WrapMode.Tile))
                {
                    for (ushort index1 = (ushort)0; (int)index1 < (int)mapDimY; ++index1)
                    {
                        for (ushort index2 = (ushort)0; (int)index2 < (int)mapDimX; ++index2)
                        {
                            if (makeDaMapBool[(int)index2, (int)index1])
                            {
                                graphics.FillRectangle((Brush)textureBrush, (int)index2 * (int)num, (int)index1 * (int)num, (int)num, (int)num);
                                if ((int)index2 > 0 && !makeDaMapBool[(int)index2 - 1, (int)index1])
                                {
                                    graphics.DrawLine(new Pen(Color.White), (int)index2 * (int)num, (int)index1 * (int)num, (int)index2 * (int)num, ((int)index1 + 1) * (int)num);
                                }
                                if ((int)index1 > 0 && !makeDaMapBool[(int)index2, (int)index1 - 1])
                                {
                                    graphics.DrawLine(new Pen(Color.White), (int)index2 * (int)num, (int)index1 * (int)num, ((int)index2 + 1) * (int)num, (int)index1 * (int)num);
                                }
                                if ((int)index2 < (int)mapDimX - 1 && !makeDaMapBool[(int)index2 + 1, (int)index1])
                                {
                                    graphics.DrawLine(new Pen(Color.White), ((int)index2 + 1) * (int)num, (int)index1 * (int)num, ((int)index2 + 1) * (int)num, ((int)index1 + 1) * (int)num);
                                }
                                if ((int)index1 < (int)mapDimY - 1 && !makeDaMapBool[(int)index2, (int)index1 + 1])
                                {
                                    graphics.DrawLine(new Pen(Color.White), (int)index2 * (int)num, ((int)index1 + 1) * (int)num, ((int)index2 + 1) * (int)num, ((int)index1 + 1) * (int)num);
                                }
                            }
                        }
                    }
                }
                Aisling[] aislingArray = new Aisling[this.Client.Base.Aislings.Count];
                Array.Copy((Array)Enumerable.ToArray <Aisling>((IEnumerable <Aisling>) this.Client.Base.Aislings.Values), (Array)aislingArray, aislingArray.Length);

                Entity[] entityArray = new Entity[this.Client.Base.Entitys.Count];
                Array.Copy((Array)Enumerable.ToArray <Entity>((IEnumerable <Entity>) this.Client.Base.Entitys.Values), (Array)entityArray, entityArray.Length);


                foreach (Aisling playerOnMap in aislingArray)
                {
                    if (playerOnMap.Serial == this.Client.Base.Serial)
                    {
                        using (TextureBrush meBrush = new TextureBrush((Image)Resources.textME, WrapMode.Tile))
                        {
                            graphics.FillRectangle((Brush)meBrush, (int)this.Client.Base.MyServerPosition.X * (int)num, (int)this.Client.Base.MyServerPosition.Y * (int)num, (int)num, (int)num);
                        }
                    }
                    else if (playerOnMap.Map == this.Client.Base.DaMap.Number && playerOnMap.Map != playerOnMap.lastMap)
                    {
                        using (TextureBrush playerBrush = new TextureBrush((Image)Resources.textPLAYER, WrapMode.Tile))
                        {
                            graphics.FillRectangle((Brush)playerBrush, (int)playerOnMap.Position.X * (int)num, (int)playerOnMap.Position.Y * (int)num, (int)num, (int)num);
                        }
                    }
                }
                foreach (Entity entityOnMap in entityArray)
                {
                    if (!this.Client.Base.Aislings.ContainsKey(entityOnMap.Serial))
                    {
                        if (entityOnMap.Type == EntityType.Monster && entityOnMap.Serial != this.Client.Base.Me.Serial)
                        {
                            using (TextureBrush monsterBrush = new TextureBrush((Image)Resources.textMONSTER, WrapMode.Tile))
                            {
                                graphics.FillRectangle((Brush)monsterBrush, (int)entityOnMap.Position.X * (int)num, (int)entityOnMap.Position.Y * (int)num, (int)num, (int)num);
                            }
                        }
                        else if (entityOnMap.Type == EntityType.Item && entityOnMap.Serial != this.Client.Base.Me.Serial)
                        {
                            using (TextureBrush itemBrush = new TextureBrush((Image)Resources.textITEM, WrapMode.Tile))
                            {
                                graphics.FillRectangle((Brush)itemBrush, (int)entityOnMap.Position.X * (int)num, (int)entityOnMap.Position.Y * (int)num, (int)num, (int)num);
                            }
                        }
                        else if ((entityOnMap.Type == EntityType.NPC || entityOnMap.Type == EntityType.Pet) && entityOnMap.Serial != this.Client.Base.Me.Serial)
                        {
                            using (TextureBrush specialBrush = new TextureBrush((Image)Resources.textSPECIALENTITY, WrapMode.Tile))
                            {
                                graphics.FillRectangle((Brush)specialBrush, (int)entityOnMap.Position.X * (int)num, (int)entityOnMap.Position.Y * (int)num, (int)num, (int)num);
                            }
                        }
                        else if (entityOnMap.Serial != this.Client.Base.Me.Serial)
                        {
                            using (TextureBrush otherBrush = new TextureBrush((Image)Resources.textOTHER, WrapMode.Tile))
                            {
                                graphics.FillRectangle((Brush)otherBrush, (int)entityOnMap.Position.X * (int)num, (int)entityOnMap.Position.Y * (int)num, (int)num, (int)num);
                            }
                        }
                    }
                }
                foreach (KeyValuePair <int, List <Location> > waypoints in this.Client.Base.Waypoints)
                {
                    if (waypoints.Key == this.Client.Base.DaMap.Number)
                    {
                        foreach (Location waypoint in waypoints.Value)
                        {
                            using (TextureBrush waypointBrush = new TextureBrush((Image)Resources.textWAYPOINT, WrapMode.Tile))
                            {
                                graphics.FillRectangle((Brush)waypointBrush, (int)waypoint.X * (int)num, (int)waypoint.Y * (int)num, (int)num, (int)num);
                            }
                        }
                        break;
                    }
                }
                foreach (KeyValuePair <int, List <Location> > blocks in this.Client.Base.Blocks)
                {
                    if (blocks.Key == this.Client.Base.DaMap.Number)
                    {
                        foreach (Location block in blocks.Value)
                        {
                            using (TextureBrush blockBrush = new TextureBrush((Image)Resources.textBLOCK, WrapMode.Tile))
                            {
                                graphics.FillRectangle((Brush)blockBrush, (int)block.X * (int)num, (int)block.Y * (int)num, (int)num, (int)num);
                            }
                        }
                        break;
                    }
                }
                foreach (KeyValuePair <int, List <Location> > doors in this.Client.Base.Doors)
                {
                    if (doors.Key == this.Client.Base.DaMap.Number)
                    {
                        foreach (Location door in doors.Value)
                        {
                            using (TextureBrush doorBrush = new TextureBrush((Image)Resources.textDOOR, WrapMode.Tile))
                            {
                                graphics.FillRectangle((Brush)doorBrush, (int)door.X * (int)num, (int)door.Y * (int)num, (int)num, (int)num);
                            }
                        }
                        break;
                    }
                }
            }
            return(true);
        }
        private void Temporizador_Principal_Tick(object sender, EventArgs e)
        {
            try
            {
                try
                {
                    if (Pintar != null)
                    {
                        /*double Multiplicador = 0.6d;
                         * for (int Índice = 0; Índice < 8; Índice++)
                         * {
                         *  int Ancho_Alto = (int)Math.Round(512d * Multiplicador, MidpointRounding.AwayFromZero);
                         *  Matriz_Imágenes[Índice] = Program.Obtener_Imagen_Miniatura(Resources.Salvapantallas_particlefield, Ancho_Alto, Ancho_Alto, true, false);
                         *  Matriz_Ancho_Alto[Índice] = Ancho_Alto;
                         *  Multiplicador += 0.2d;
                         * }*/
                        Pintar.Clear(Color.Transparent);
                        double Multiplicador = 0.6d;
                        for (int Índice = 0; Índice < 8; Índice++)
                        {
                            //Pintar.ResetTransform();
                            //Pintar.TranslateTransform((float)((double)Ancho / 2d), (float)((double)Alto / 2d));
                            //Pintar.RotateTransform((float)((Índice * 360d) / 15d));
                            int Desviación = Índice % 4;
                            //TextureBrush Pincel = new TextureBrush(Program.Obtener_Imagen_Miniatura(Resources.Salvapantallas_particlefield.Clone(new RectangleF(Desviación < 2 ? (float)Matriz_Desviaciones[(int)Índice] : 0f, Desviación >= 2 ? (float)Matriz_Desviaciones[(int)Índice] : 0f, 256f, 256f), PixelFormat.Format32bppArgb), (int)Math.Round(256d * Multiplicador, MidpointRounding.AwayFromZero), (int)Math.Round(256d * Multiplicador, MidpointRounding.AwayFromZero), true, false), WrapMode.Tile);
                            int XY = (int)Math.Round(((double)(Matriz_Ancho_Alto[Índice] / 2) * Math.Abs(Matriz_Desviaciones[Índice])) / 100d, MidpointRounding.AwayFromZero);
                            if (XY < 0)
                            {
                                XY = 0;
                            }
                            else if (XY >= Matriz_Ancho_Alto[Índice])
                            {
                                XY = Matriz_Ancho_Alto[Índice] - 1;
                            }
                            TextureBrush Pincel = new TextureBrush(Matriz_Imágenes[Índice].Clone(new RectangleF(Desviación < 2 ? (float)XY : 0f, Desviación >= 2 ? (float)XY : 0f, (float)(Matriz_Ancho_Alto[Índice] / 2), (float)(Matriz_Ancho_Alto[Índice] / 2)), PixelFormat.Format32bppArgb), WrapMode.Tile);
                            Pintar.FillRectangle(Pincel, (float)((double)-Ancho), (float)((double)-Alto), (float)((double)Ancho * 2d), (float)((double)Alto * 2d));
                            //Pintar.FillRectangle(Pincel, (float)((double)-Ancho + (Desviación < 2 ? Matriz_Desviaciones[(int)Índice] : 0)), (float)((double)-Alto + (Desviación >= 2 ? Matriz_Desviaciones[(int)Índice] : 0)), (float)((double)Ancho * 2d), (float)((double)Alto * 2d));
                            Pincel.Dispose();
                            Pincel = null;
                            if (Desviación % 2 == 0)
                            {
                                Matriz_Desviaciones[Índice] -= Multiplicador;
                                while (Matriz_Desviaciones[Índice] < 0d)
                                {
                                    Matriz_Desviaciones[Índice] += 100d;
                                }
                            }
                            else
                            {
                                Matriz_Desviaciones[Índice] += Multiplicador;
                                while (Matriz_Desviaciones[Índice] >= 100d)
                                {
                                    Matriz_Desviaciones[Índice] -= 100d;
                                }
                            }
                            Multiplicador += 0.2d;
                        }
                        Picture.Invalidate();
                    }

                    /*float f1 = (float)this.tileEntityRenderer.playerX;
                     * float f2 = (float)this.tileEntityRenderer.playerY;
                     * float f3 = (float)this.tileEntityRenderer.playerZ;
                     * //GL11.glDisable(GL11.GL_LIGHTING);
                     * Random random = new Random(31100L);
                     * float f4 = 0.75F;
                     *
                     * for (int i = 0; i < 16; ++i)
                     * {
                     *  //GL11.glPushMatrix();
                     *  float f5 = (float)(16 - i);
                     *  float f6 = 0.0625F;
                     *  float f7 = 1.0F / (f5 + 1.0F);
                     *
                     *  if (i == 0)
                     *  {
                     *      this.bindTextureByName(Resources.Salvapantallas_tunnel);
                     *      f7 = 0.1F;
                     *      f5 = 65.0F;
                     *      f6 = 0.125F;
                     *      GL11.glEnable(GL11.GL_BLEND);
                     *      GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
                     *  }
                     *
                     *  if (i == 1)
                     *  {
                     *      this.bindTextureByName(Resources.Salvapantallas_particlefield);
                     *      //GL11.glEnable(GL11.GL_BLEND);
                     *      //GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
                     *      f6 = 0.5F;
                     *  }
                     *
                     *  float f8 = (float)(-(par4 + (double)f4));
                     *  float f9 = f8 + ActiveRenderInfo.objectY;
                     *  float f10 = f8 + f5 + ActiveRenderInfo.objectY;
                     *  float f11 = f9 / f10;
                     *  f11 += (float)(par4 + (double)f4);
                     *  GL11.glTranslatef(f1, f11, f3);
                     *  GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
                     *  GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
                     *  GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
                     *  GL11.glTexGeni(GL11.GL_Q, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_EYE_LINEAR);
                     *  GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, this.func_76907_a(1.0F, 0.0F, 0.0F, 0.0F));
                     *  GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, this.func_76907_a(0.0F, 0.0F, 1.0F, 0.0F));
                     *  GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, this.func_76907_a(0.0F, 0.0F, 0.0F, 1.0F));
                     *  GL11.glTexGen(GL11.GL_Q, GL11.GL_EYE_PLANE, this.func_76907_a(0.0F, 1.0F, 0.0F, 0.0F));
                     *  GL11.glEnable(GL11.GL_TEXTURE_GEN_S);
                     *  GL11.glEnable(GL11.GL_TEXTURE_GEN_T);
                     *  GL11.glEnable(GL11.GL_TEXTURE_GEN_R);
                     *  GL11.glEnable(GL11.GL_TEXTURE_GEN_Q);
                     *  GL11.glPopMatrix();
                     *  GL11.glMatrixMode(GL11.GL_TEXTURE);
                     *  GL11.glPushMatrix();
                     *  GL11.glLoadIdentity();
                     *  GL11.glTranslatef(0.0F, (float)((long)Environment.TickCount % 700000L) / 700000.0F, 0.0F);
                     *  GL11.glScalef(f6, f6, f6);
                     *  GL11.glTranslatef(0.5F, 0.5F, 0.0F);
                     *  GL11.glRotatef((float)(i * i * 4321 + i * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
                     *  GL11.glTranslatef(-0.5F, -0.5F, 0.0F);
                     *  GL11.glTranslatef(-f1, -f3, -f2);
                     *  f9 = f8 + ActiveRenderInfo.objectY;
                     *  GL11.glTranslatef(ActiveRenderInfo.objectX * f5 / f9, ActiveRenderInfo.objectZ * f5 / f9, -f2);
                     *  Tessellator tessellator = Tessellator.instance;
                     *  tessellator.startDrawingQuads();
                     *  f11 = random.nextFloat() * 0.5F + 0.1F;
                     *  float f12 = random.nextFloat() * 0.5F + 0.4F;
                     *  float f13 = random.nextFloat() * 0.5F + 0.5F;
                     *
                     *  if (i == 0)
                     *  {
                     *      f13 = 1.0F;
                     *      f12 = 1.0F;
                     *      f11 = 1.0F;
                     *  }
                     *
                     *  tessellator.setColorRGBA_F(f11 * f7, f12 * f7, f13 * f7, 1.0F);
                     *  tessellator.addVertex(par2, par4 + (double)f4, par6);
                     *  tessellator.addVertex(par2, par4 + (double)f4, par6 + 1.0D);
                     *  tessellator.addVertex(par2 + 1.0D, par4 + (double)f4, par6 + 1.0D);
                     *  tessellator.addVertex(par2 + 1.0D, par4 + (double)f4, par6);
                     *  tessellator.draw();
                     *  //GL11.glPopMatrix();
                     *  //GL11.glMatrixMode(GL11.GL_MODELVIEW);
                     * }
                     *
                     * //GL11.glDisable(GL11.GL_BLEND);
                     * //GL11.glDisable(GL11.GL_TEXTURE_GEN_S);
                     * //GL11.glDisable(GL11.GL_TEXTURE_GEN_T);
                     * //GL11.glDisable(GL11.GL_TEXTURE_GEN_R);
                     * //GL11.glDisable(GL11.GL_TEXTURE_GEN_Q);
                     * //GL11.glEnable(GL11.GL_LIGHTING);*/
                }
                catch (Exception Excepción) { Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null); Variable_Excepción_Total++; Variable_Excepción = true; }
                int Tick = Environment.TickCount;
                try
                {
                    if (Variable_Excepción)
                    {
                        if ((Environment.TickCount / 500) % 2 == 0)
                        {
                            if (!Variable_Excepción_Imagen)
                            {
                                Variable_Excepción_Imagen              = true;
                                Barra_Estado_Botón_Excepción.Image     = Resources.Excepción;
                                Barra_Estado_Botón_Excepción.ForeColor = Color.Red;
                                Barra_Estado_Botón_Excepción.Text      = "Exceptions: " + Program.Traducir_Número(Variable_Excepción_Total);
                            }
                        }
                        else
                        {
                            if (Variable_Excepción_Imagen)
                            {
                                Variable_Excepción_Imagen              = false;
                                Barra_Estado_Botón_Excepción.Image     = Resources.Excepción_Gris;
                                Barra_Estado_Botón_Excepción.ForeColor = Color.Black;
                                Barra_Estado_Botón_Excepción.Text      = "Exceptions: " + Program.Traducir_Número(Variable_Excepción_Total);
                            }
                        }
                        if (!Barra_Estado_Botón_Excepción.Visible)
                        {
                            Barra_Estado_Botón_Excepción.Visible = true;
                        }
                        if (!Barra_Estado_Separador_1.Visible)
                        {
                            Barra_Estado_Separador_1.Visible = true;
                        }
                    }
                }
                catch (Exception Excepción) { Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null); Variable_Excepción_Total++; Variable_Excepción = true; }
                try
                {
                    try
                    {
                        if (Tick % 250 == 0) // Only update every quarter second
                        {
                            if (Program.Rendimiento_Procesador != null)
                            {
                                double CPU = (double)Program.Rendimiento_Procesador.NextValue();
                                if (CPU < 0d)
                                {
                                    CPU = 0d;
                                }
                                else if (CPU > 100d)
                                {
                                    CPU = 100d;
                                }
                                Barra_Estado_Etiqueta_CPU.Text = "CPU: " + Program.Traducir_Número_Decimales_Redondear(CPU, 2) + " %";
                            }
                            Program.Proceso.Refresh();
                            long Memoria_Bytes = Program.Proceso.PagedMemorySize64;
                            Barra_Estado_Etiqueta_Memoria.Text = "RAM: " + Program.Traducir_Tamaño_Bytes_Automático(Memoria_Bytes, 2, true);
                            if (Memoria_Bytes < 4294967296L) // < 4 GB
                            {
                                if (Variable_Memoria)
                                {
                                    Variable_Memoria = false;
                                    Barra_Estado_Etiqueta_Memoria.ForeColor = Color.Black;
                                }
                            }
                            else // >= 4 GB
                            {
                                if ((Environment.TickCount / 500) % 2 == 0)
                                {
                                    if (!Variable_Memoria)
                                    {
                                        Variable_Memoria = true;
                                        Barra_Estado_Etiqueta_Memoria.ForeColor = Color.Red;
                                    }
                                }
                                else
                                {
                                    if (Variable_Memoria)
                                    {
                                        Variable_Memoria = false;
                                        Barra_Estado_Etiqueta_Memoria.ForeColor = Color.Black;
                                    }
                                }
                            }
                        }
                    }
                    catch { Barra_Estado_Etiqueta_Memoria.Text = "RAM: ? MB (? GB)"; }
                }
                catch (Exception Excepción) { Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null); Variable_Excepción_Total++; Variable_Excepción = true; }
                long FPS_Milisegundo = FPS_Cronómetro.ElapsedMilliseconds;
                long FPS_Segundo     = FPS_Milisegundo / 1000L;
                if (FPS_Segundo != FPS_Segundo_Anterior)
                {
                    FPS_Segundo_Anterior           = FPS_Segundo;
                    FPS_Real                       = FPS_Temporal;
                    Barra_Estado_Etiqueta_FPS.Text = FPS_Real.ToString() + " FPS";
                    FPS_Temporal                   = 0L;
                }
                FPS_Temporal++;
            }
            catch (Exception Excepción) { Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null); Variable_Excepción_Total++; Variable_Excepción = true; }
        }
    private static Bitmap CropImageToCircle(Bitmap SourceImage)
    {
        int circleDiameter = SourceImage.Width;
        int circleUpperLeftX = 0;
        int circleUpperLeftY = 0;

        //Load our source image
        //Create a rectangle that crops a square of our image
        Rectangle CropRect = new Rectangle(circleUpperLeftX, circleUpperLeftY, circleDiameter, circleDiameter);

        //Crop the image to that square
        using (Bitmap CroppedImage = SourceImage.Clone(CropRect, SourceImage.PixelFormat))
        {

            //Create a texturebrush to draw our circle with
            using (TextureBrush TB = new TextureBrush(CroppedImage))
            {

                //Create our output image
                Bitmap FinalImage = new Bitmap(circleDiameter, circleDiameter);

                //Create a graphics object to draw with
                using (Graphics myGraphic = FromImage(FinalImage))
                {
                    myGraphic.FillEllipse(TB, 0, 0, circleDiameter, circleDiameter);
                    return FinalImage;
                }
            }
        }
    }
예제 #18
0
        private bool RebarMessageCaptured(ref Message m)
        {
            // Make sure the menu bar obeys the Explorer setting.
            // Was this really so hard, Microsoft?
            if (m.Msg == RB.SETBANDINFO)
            {
                REBARBANDINFO pInfo = (REBARBANDINFO)Marshal.PtrToStructure(m.LParam, typeof(REBARBANDINFO));
                if ((PInvoke.GetClassName(pInfo.hwndChild) == "ToolbarWindow32") && (pInfo.wID == 1))
                {
                    if (MenuHasFocus || MenuBarShown)
                    {
                        pInfo.fStyle &= ~RBBS.HIDDEN;
                    }
                    else
                    {
                        pInfo.fStyle |= RBBS.HIDDEN;
                    }
                    Marshal.StructureToPtr(pInfo, m.LParam, false);
                }
                return(false);
            }

            if (m.Msg == WM.ERASEBKGND && (Config.Skin.UseRebarBGColor || Config.Skin.UseRebarImage))
            {
                bool fFilled = false;
                using (Graphics graphics = Graphics.FromHdc(m.WParam)) {
                    RECT rect;
                    PInvoke.GetWindowRect(Handle, out rect);
                    Rectangle rectRebar = new Rectangle(0, 0, rect.Width, rect.Height);

                    // Fill the Rebar background color
                    if (Config.Skin.UseRebarBGColor)
                    {
                        using (SolidBrush brush = new SolidBrush(Config.Skin.RebarColor)) {
                            graphics.FillRectangle(brush, rectRebar);
                            fFilled = true;
                        }
                    }
                    else if (Config.Skin.RebarStretchMode == StretchMode.Real)
                    {
                        rebarController.DefWndProc(ref m);
                    }

                    // Draw the Rebar image
                    if (VisualStyleRenderer.IsSupported && Config.Skin.UseRebarImage && Config.Skin.RebarImageFile.Length > 0)
                    {
                        if (bmpRebar == null)
                        {
                            CreateRebarImage();
                        }
                        if (bmpRebar != null)
                        {
                            List <Rectangle> rectTargets = new List <Rectangle>();
                            if (Config.Skin.RebarImageSeperateBars)
                            {
                                int bandCount = (int)PInvoke.SendMessage(rebarController.Handle, RB.GETBANDCOUNT, IntPtr.Zero, IntPtr.Zero);
                                graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
                                RECT rectBand   = new RECT();
                                RECT rectMargin = new RECT();
                                for (int i = 0; i < bandCount; i++)
                                {
                                    if (PInvoke.SendMessage(rebarController.Handle, RB.GETRECT, (IntPtr)i, ref rectBand) == IntPtr.Zero)
                                    {
                                        continue;
                                    }
                                    PInvoke.SendMessage(rebarController.Handle, RB.GETBANDBORDERS, (IntPtr)i, ref rectMargin);
                                    rectBand.left   -= !QTUtility.IsXP ? 4 : rectMargin.left;
                                    rectBand.top    -= rectMargin.top;
                                    rectBand.right  += rectMargin.right;
                                    rectBand.bottom += rectMargin.bottom;
                                    rectTargets.Add(rectBand.ToRectangle());
                                }
                            }
                            else
                            {
                                rectTargets.Add(rectRebar);
                            }

                            foreach (Rectangle destRect in rectTargets)
                            {
                                switch (Config.Skin.RebarStretchMode)
                                {
                                case StretchMode.Real:
                                    Rectangle rectDest2 = new Rectangle(new Point(0, 0), destRect.Size);
                                    Rectangle rectBmp   = new Rectangle(new Point(0, 0), bmpRebar.Size);
                                    rectBmp.Intersect(rectDest2);
                                    rectDest2.Intersect(rectBmp);
                                    rectDest2.Offset(destRect.Location);
                                    graphics.DrawImage(bmpRebar, rectDest2, rectBmp, GraphicsUnit.Pixel);
                                    break;

                                case StretchMode.Tile:
                                    textureBrushRebar = textureBrushRebar ?? new TextureBrush(bmpRebar);
                                    textureBrushRebar.TranslateTransform(destRect.X, destRect.Y);
                                    graphics.FillRectangle(textureBrushRebar, destRect);
                                    textureBrushRebar.ResetTransform();
                                    break;

                                default:     // Full
                                    // todo: make this a function
                                    graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
                                    Padding     margin     = Config.Skin.RebarSizeMargin;
                                    int         left       = margin.Left;
                                    int         top        = margin.Top;
                                    int         right      = margin.Right;
                                    int         bottom     = margin.Bottom;
                                    int         vertical   = margin.Vertical;
                                    int         horizontal = margin.Horizontal;
                                    int         width      = bmpRebar.Width;
                                    int         height     = bmpRebar.Height;
                                    Rectangle[] dstRects   = new Rectangle[] {
                                        new Rectangle(destRect.X, destRect.Y, left, top),
                                        new Rectangle(destRect.X + left, destRect.Y, destRect.Width - horizontal, top),
                                        new Rectangle(destRect.Right - right, destRect.Y, right, top),
                                        new Rectangle(destRect.X, destRect.Y + top, left, destRect.Height - vertical),
                                        new Rectangle(destRect.X + left, destRect.Y + top, destRect.Width - horizontal, destRect.Height - vertical),
                                        new Rectangle(destRect.Right - right, destRect.Y + top, right, destRect.Height - vertical),
                                        new Rectangle(destRect.X, destRect.Bottom - bottom, left, bottom),
                                        new Rectangle(destRect.X + left, destRect.Bottom - bottom, destRect.Width - horizontal, bottom),
                                        new Rectangle(destRect.Right - right, destRect.Bottom - bottom, right, bottom)
                                    };
                                    Rectangle[] srcRects = new Rectangle[] {
                                        new Rectangle(0, 0, left, top),
                                        new Rectangle(left, 0, width - horizontal, top),
                                        new Rectangle(width - right, 0, right, top),
                                        new Rectangle(0, top, left, height - vertical),
                                        new Rectangle(left, top, width - horizontal, height - vertical),
                                        new Rectangle(width - right, top, right, height - vertical),
                                        new Rectangle(0, height - bottom, left, bottom),
                                        new Rectangle(left, height - bottom, width - horizontal, bottom),
                                        new Rectangle(width - right, height - bottom, right, bottom),
                                    };
                                    for (int i = 0; i < 9; i++)
                                    {
                                        graphics.DrawImage(bmpRebar, dstRects[i], srcRects[i], GraphicsUnit.Pixel);
                                    }
                                    break;
                                }
                            }
                            fFilled = true;
                        }
                    }
                }
                if (fFilled)
                {
                    m.Result = (IntPtr)1;
                    return(true);
                }
            }
            return(false);
        }
예제 #19
0
        /// <summary>
        /// Fills a rectangle with the gradient.
        /// </summary>
        /// <param name="g">The <see cref="Graphics"/> object to draw to.</param>
        /// <param name="gradient">The gradient to use.</param>
        /// <param name="frame">The rectangle to fill with the gradient.</param>
        /// <param name="direction">The direction of the gradient.</param>
        public static void FillRectangle(Graphics g, IGradient gradient, Rectangle frame, Direction direction)
        {
            BitmapBuilder bmp     = null;
            int           N       = 0;
            bool          reverse = false;

            switch (direction)
            {
            case Direction.Down:
                N       = frame.Height;
                bmp     = new BitmapBuilder(new Rectangle(0, 0, 1, N));
                reverse = false;
                break;

            case Direction.Up:
                N       = frame.Height;
                bmp     = new BitmapBuilder(new Rectangle(0, 0, 1, N));
                reverse = true;
                break;

            case Direction.Left:
                N       = frame.Width;
                bmp     = new BitmapBuilder(new Rectangle(0, 0, N, 1));
                reverse = true;
                break;

            case Direction.Right:
                N       = frame.Width;
                bmp     = new BitmapBuilder(new Rectangle(0, 0, N, 1));
                reverse = false;
                break;
            }
            bmp.Lock();
            unsafe {
                int *pixel = bmp.Pixel(0, 0);
                for (double x = 0; x < N; x++)
                {
                    try {
                        if (reverse)
                        {
                            *pixel = gradient.Color((N - x - 1) / N).ToArgb();
                        }
                        else
                        {
                            *pixel = gradient.Color(x / N).ToArgb();
                        }
                    } catch {
                        *pixel = Color.Transparent.ToArgb();
                    }
                    pixel++;
                }
            }
            bmp.Unlock();
            TextureBrush t  = new TextureBrush(bmp.Bitmap);
            Matrix       T0 = g.Transform.Clone();
            Matrix       T  = g.Transform.Clone();

            T.Translate(frame.X, frame.Y);
            g.Transform = T;
            g.FillRectangle(t, new Rectangle(0, 0, frame.Width, frame.Height));
            g.Transform = T0;
        }
예제 #20
0
		public void SetOpacity (TextureBrush widget, float opacity)
		{
			((BrushObject)widget.ControlObject).Opacity = opacity;
		}
예제 #21
0
		public float GetOpacity (TextureBrush widget)
		{
			return ((BrushObject)widget.ControlObject).Opacity;
		}
예제 #22
0
	// Create a texture brush.
	public virtual IToolkitBrush CreateTextureBrush
				(TextureBrush properties, IToolkitImage image,
				 RectangleF dstRect, ImageAttributes imageAttr)
			{
				return null;
			}
예제 #23
0
        private void DrawCursorGraphics(Graphics g)
        {
            Point     mousePos = InputManager.MousePosition0Based;
            Rectangle currentScreenRect0Based = CaptureHelpers.GetActiveScreenBounds0Based();
            int       cursorOffsetX = 10, cursorOffsetY = 10, itemGap = 10, itemCount = 0;
            Size      totalSize = Size.Empty;

            int    magnifierPosition = 0;
            Bitmap magnifier    = null;

            if (Config.ShowMagnifier)
            {
                if (itemCount > 0)
                {
                    totalSize.Height += itemGap;
                }
                magnifierPosition = totalSize.Height;

                magnifier       = Magnifier(backgroundImage, mousePos, Config.MagnifierPixelCount, Config.MagnifierPixelCount, Config.MagnifierPixelSize);
                totalSize.Width = Math.Max(totalSize.Width, magnifier.Width);

                totalSize.Height += magnifier.Height;
                itemCount++;
            }

            int       infoTextPadding  = 3;
            int       infoTextPosition = 0;
            Rectangle infoTextRect     = Rectangle.Empty;
            string    infoText         = "";

            if (Config.ShowInfo)
            {
                if (itemCount > 0)
                {
                    totalSize.Height += itemGap;
                }
                infoTextPosition = totalSize.Height;

                CurrentPosition = InputManager.MousePosition;
                infoText        = GetInfoText();
                Size textSize = g.MeasureString(infoText, infoFont).ToSize();
                infoTextRect.Size = new Size(textSize.Width + infoTextPadding * 2, textSize.Height + infoTextPadding * 2);
                totalSize.Width   = Math.Max(totalSize.Width, infoTextRect.Width);

                totalSize.Height += infoTextRect.Height;
                itemCount++;
            }

            int x = mousePos.X + cursorOffsetX;

            if (x + totalSize.Width > currentScreenRect0Based.Right)
            {
                x = mousePos.X - cursorOffsetX - totalSize.Width;
            }

            int y = mousePos.Y + cursorOffsetY;

            if (y + totalSize.Height > currentScreenRect0Based.Bottom)
            {
                y = mousePos.Y - cursorOffsetY - totalSize.Height;
            }

            if (Config.ShowMagnifier)
            {
                using (GraphicsQualityManager quality = new GraphicsQualityManager(g))
                    using (TextureBrush brush = new TextureBrush(magnifier))
                    {
                        brush.TranslateTransform(x, y + magnifierPosition);

                        if (Config.UseSquareMagnifier)
                        {
                            g.FillRectangle(brush, x, y + magnifierPosition, magnifier.Width, magnifier.Height);
                            g.DrawRectangleProper(Pens.White, x - 1, y + magnifierPosition - 1, magnifier.Width + 2, magnifier.Height + 2);
                            g.DrawRectangleProper(Pens.Black, x, y + magnifierPosition, magnifier.Width, magnifier.Height);
                        }
                        else
                        {
                            g.FillEllipse(brush, x, y + magnifierPosition, magnifier.Width, magnifier.Height);
                            g.DrawEllipse(Pens.White, x - 1, y + magnifierPosition - 1, magnifier.Width + 2, magnifier.Height + 2);
                            g.DrawEllipse(Pens.Black, x, y + magnifierPosition, magnifier.Width, magnifier.Height);
                        }
                    }
            }

            if (Config.ShowInfo)
            {
                infoTextRect.Location = new Point(x + (totalSize.Width / 2) - (infoTextRect.Width / 2), y + infoTextPosition);
                DrawInfoText(g, infoText, infoTextRect, infoFont, infoTextPadding);
            }
        }
예제 #24
0
        /// <summary>
        /// Processes the given bitmap to apply the current instance of <see cref="IEdgeFilter"/>.
        /// </summary>
        /// <param name="source">The image to process.</param>
        /// <returns>A processed bitmap.</returns>
        public Bitmap ProcessFilter(Image source)
        {
            int width          = source.Width;
            int height         = source.Height;
            int maxWidth       = width + 1;
            int maxHeight      = height + 1;
            int bufferedWidth  = width + 2;
            int bufferedHeight = height + 2;

            Bitmap destination = new Bitmap(width, height, PixelFormat.Format32bppPArgb);
            Bitmap input       = new Bitmap(bufferedWidth, bufferedHeight, PixelFormat.Format32bppPArgb);

            destination.SetResolution(source.HorizontalResolution, source.VerticalResolution);
            input.SetResolution(source.HorizontalResolution, source.VerticalResolution);

            using (Graphics graphics = Graphics.FromImage(input))
            {
                // Fixes an issue with transparency not converting properly.
                graphics.Clear(Color.Transparent);

                Rectangle destinationRectangle = new Rectangle(0, 0, bufferedWidth, bufferedHeight);
                Rectangle rectangle            = new Rectangle(0, 0, width, height);

                // If it's greyscale apply a colormatrix to the image.
                using (ImageAttributes attributes = new ImageAttributes())
                {
                    if (this.greyscale)
                    {
                        attributes.SetColorMatrix(ColorMatrixes.GreyScale);
                    }

                    // We use a trick here to detect right to the edges of the image.
                    // flip/tile the image with a pixel in excess in each direction to duplicate pixels.
                    // Later on we draw pixels without that excess.
                    using (TextureBrush tb = new TextureBrush(source, rectangle, attributes))
                    {
                        tb.WrapMode = WrapMode.TileFlipXY;
                        tb.TranslateTransform(1, 1);

                        graphics.FillRectangle(tb, destinationRectangle);
                    }
                }
            }

            try
            {
                double[,] horizontalFilter = this.edgeFilter.HorizontalGradientOperator;

                int kernelLength = horizontalFilter.GetLength(0);
                int radius       = kernelLength >> 1;

                using (FastBitmap sourceBitmap = new FastBitmap(input))
                {
                    using (FastBitmap destinationBitmap = new FastBitmap(destination))
                    {
                        // Loop through the pixels.
                        Parallel.For(
                            0,
                            bufferedHeight,
                            y =>
                        {
                            for (int x = 0; x < bufferedWidth; x++)
                            {
                                double rX = 0;
                                double gX = 0;
                                double bX = 0;

                                // Apply each matrix multiplier to the color components for each pixel.
                                for (int fy = 0; fy < kernelLength; fy++)
                                {
                                    int fyr     = fy - radius;
                                    int offsetY = y + fyr;

                                    // Skip the current row
                                    if (offsetY < 0)
                                    {
                                        continue;
                                    }

                                    // Outwith the current bounds so break.
                                    if (offsetY >= bufferedHeight)
                                    {
                                        break;
                                    }

                                    for (int fx = 0; fx < kernelLength; fx++)
                                    {
                                        int fxr     = fx - radius;
                                        int offsetX = x + fxr;

                                        // Skip the column
                                        if (offsetX < 0)
                                        {
                                            continue;
                                        }

                                        if (offsetX < bufferedWidth)
                                        {
                                            // ReSharper disable once AccessToDisposedClosure
                                            Color currentColor = sourceBitmap.GetPixel(offsetX, offsetY);
                                            double r           = currentColor.R;
                                            double g           = currentColor.G;
                                            double b           = currentColor.B;

                                            rX += horizontalFilter[fy, fx] * r;

                                            gX += horizontalFilter[fy, fx] * g;

                                            bX += horizontalFilter[fy, fx] * b;
                                        }
                                    }
                                }

                                // Apply the equation and sanitize.
                                byte red   = rX.ToByte();
                                byte green = gX.ToByte();
                                byte blue  = bX.ToByte();

                                Color newColor = Color.FromArgb(red, green, blue);
                                if (y > 0 && x > 0 && y < maxHeight && x < maxWidth)
                                {
                                    // ReSharper disable once AccessToDisposedClosure
                                    destinationBitmap.SetPixel(x - 1, y - 1, newColor);
                                }
                            }
                        });
                    }
                }
            }
            finally
            {
                // We created a new image. Cleanup.
                input.Dispose();
            }

            return(destination);
        }
예제 #25
0
    protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
    {
        Graphics G = e.Graphics;
        base.OnPaint(e);
        TopGrip = TopSize + TopSpace;

        this.Padding = new Padding(BorderSize + InsideBorderSize, TopSize + TopSpace + InsideBorderSize, BorderSize + InsideBorderSize, BorderSize + InsideBorderSize);
        this.ParentForm.TransparencyKey = Color.Fuchsia;
        this.ParentForm.MinimumSize = MinimumSize;
        if (!(this.ParentForm.FormBorderStyle == FormBorderStyle.None))
        {
            this.ParentForm.FormBorderStyle = FormBorderStyle.None;
        }
        G.Clear(this.ParentForm.TransparencyKey);

        //| Drawing the main rectangle base.
        Rectangle MainRect = new Rectangle(0, TopSpace, Width - 1, Height - (1 + TopSpace));
        Rectangle MainHighlightRect = new Rectangle(1, 1 + TopSpace, Width - 3, Height - (3+ TopSpace));
        TextureBrush BGTextureBrush = new TextureBrush(D.CodeToImage(D.BGTexture), WrapMode.TileFlipXY);
        G.FillRectangle(BGTextureBrush, MainRect);
        G.DrawRectangle(new Pen(Color.FromArgb(40, Pal.ColHighest)), MainHighlightRect);
        G.DrawRectangle(Pens.Black, MainRect);

        //| Detail to the main rect's top grip
        Rectangle ShineRect = new Rectangle(0, TopSpace, Width, Height);
        //G.FillRectangle(new SolidBrush(Color.FromArgb(40, Pal.ColMed)), ShineRect);
        LinearGradientBrush SubShineLGB1 = new LinearGradientBrush(ShineRect, Color.Black, Color.Black, 0, false);
        LinearGradientBrush SubShineLGB2 = new LinearGradientBrush(ShineRect, Color.Black, Color.Black, 0, false);
        ColorBlend Blend = new ColorBlend();
        Blend.Positions = new[]{0,1 / 3f,2 / 3f,1};
        Blend.Colors = new[]{
            Color.FromArgb(50, Color.Black),
            Color.FromArgb(150, Color.Black),
            Color.FromArgb(50, Color.Black),
            Color.Transparent
        };
        SubShineLGB1.InterpolationColors = Blend;
        SubShineLGB1.RotateTransform(45);
        Blend.Colors = new[]{
            Color.FromArgb(50, Pal.ColHighest),
            Color.FromArgb(150, Pal.ColHighest),
            Color.FromArgb(50, Pal.ColHighest),
            Color.Transparent
        };
        SubShineLGB2.InterpolationColors = Blend;
        SubShineLGB2.RotateTransform(45);
        //|
        //D.FillGradientBeam(G, Color.Transparent, Color.FromArgb(80, Pal.ColHighest), ShineRect, GradientAlignment.Vertical);
        //G.DrawLine(new Pen(SubShineLGB1), new Point(1, ShineRect.Height), new Point(Width - 2, ShineRect.Height));
        //G.DrawLine(new Pen(SubShineLGB2), new Point(1, ShineRect.Height + 1), new Point(Width - 2, ShineRect.Height + 1));

        //| Goind back through and making the rect below the detail darker
        Rectangle DarkRect = new Rectangle(2, TopSpace + 2, Width - 4, Height - 4 - TopSpace);
        LinearGradientBrush DarkLGB = new LinearGradientBrush(DarkRect, Color.FromArgb(100, Color.Black), Color.FromArgb(100, Color.Black), 90);
        if (Darker) {
            G.FillRectangle(DarkLGB, DarkRect);
        }
        //Lighter
        //G.FillRectangle(new SolidBrush(Color.FromArgb(80, Pal.ColHigh)), DarkRect);

        //| The inner and slightly brigher rectangle of the form
        Rectangle InnerRect = new Rectangle(BorderSize-1, TopSpace + TopSize-1, Width - (BorderSize*2)+1, Height - BorderSize - TopSize - TopSpace+1);
        Rectangle InnerHighlightRect = new Rectangle(BorderSize + 1, TopSpace + TopSize + 1, Width - (BorderSize * 2) - 1, Height - BorderSize - TopSize - TopSpace - 1);
        Rectangle InnerHighlightRect2 = new Rectangle(BorderSize + InsideBorderSize, TopSpace + TopSize + InsideBorderSize, Width - (BorderSize * 2) - (InsideBorderSize*2), Height - BorderSize - TopSize - TopSpace - (InsideBorderSize*2));
        // G.FillRectangle(BGTextureBrush, InnerRect);
        // G.FillRectangle(new SolidBrush(Color.FromArgb(45, Pal.ColHigh)), InnerRect);
        G.FillRectangle(new SolidBrush(D.ColorFromHex("#33373B")), InnerRect);
        G.FillRectangle(new SolidBrush(BackColor), InnerHighlightRect2);
        G.DrawRectangle(new Pen(Color.FromArgb(65, Pal.ColHighest)), InnerRect);
        //G.DrawRectangle(new Pen(Color.FromArgb(40, Pal.ColHighest)), MainHighlightRect);
        //G.DrawRectangle(Pens.Black, MainRect);

        //G.FillRectangle(new SolidBrush(D.ColorFromHex("#33373B")), InnerHighlightRect);
        //G.FillRectangle(new SolidBrush(BackColor), InnerHighlightRect2);
        //G.DrawRectangle(new Pen(Color.FromArgb(80, Pal.ColHighest)), InnerHighlightRect);
        //G.DrawRectangle(Pens.Black, InnerRect);

        int textPad = 0;

        if (this.ParentForm.ShowIcon)
        {
            G.DrawIcon(this.ParentForm.Icon, new Rectangle(BorderSize-4, TopSpace + 3, TopSize - 4, TopSize - 4));
            textPad = BorderSize + TopSize - 5 + 4;
        }

        if(TitleAlignment == HorizontalAlignment.Center) {
            textPad = 0;
        }else if(TitleAlignment == HorizontalAlignment.Left && this.ParentForm.ShowIcon == false){
            textPad = BorderSize + 1;
        }
        D.DrawTextWithShadow(G, new Rectangle(textPad, TopSpace, Width, TopSize + TitleYOffset), Text, TitleFont, TitleAlignment, TitleColor, Color.Black);

        if (Sizable == true)
        {
            Rectangle SizeRect = new Rectangle(Width - BorderSize+1, Height - BorderSize+1, BorderSize-3, BorderSize-3);
            LinearGradientBrush SizeLGB = new LinearGradientBrush(DarkRect, Color.FromArgb(10, Color.LightGray), Color.FromArgb(10, Color.LightGray), 90);
            G.FillRectangle(SizeLGB, SizeRect);
            G.FillRectangle(SizeLGB, SizeRect);
        }
    }
예제 #26
0
        private void Button1_Click(object sender, EventArgs e)
        {
            this.Refresh();
            Graphics g = pictureBox1.CreateGraphics();

            Point[] point = new Point[9] {
                new Point(120, 20),
                new Point(240, 10), new Point(300, 30),
                new Point(420, 30), new Point(420, 80),
                new Point(300, 98), new Point(180, 80),
                new Point(120, 90), new Point(135, 55)
            };
            //рисуем сверху прямоугольник(9 углов)
            g.DrawPolygon(new Pen(Color.Black, 2), point);



            Font         fn = new Font("Arial", 11, FontStyle.Bold);
            StringFormat sf = new StringFormat();

            sf.Alignment     = StringAlignment.Center;
            sf.LineAlignment = StringAlignment.Center;

            string s = "Цена автомобиля \"ВАЗ\" в восьми городах.";

            g.DrawString(s, fn, Brushes.OrangeRed, new Rectangle(125, 20, 300, 70), sf);
            g.DrawString("Тыс. руб.", fn, Brushes.DarkOrange, new Rectangle(0, 80, 100, 100));
            g.DrawRectangle(new Pen(Color.Blue, 1), 0, 0, pictureBox1.Width - 1, pictureBox1.Height - 1);

            // Задаем координаты начала и конца осей x и y
            int nachalo_x = 30; int konec_x = pictureBox1.Width - 10;
            int nachalo_y = 110; int konec_y = pictureBox1.Height - 20;


            // Рисуем ось x
            g.DrawLine(new Pen(Color.Black, 1), nachalo_x, konec_y, konec_x, konec_y);
            // Рисуем ось y
            g.DrawLine(new Pen(Color.Black, 1), nachalo_x, nachalo_y, nachalo_x, konec_y);



            // Задаем названия городов
            string[] year = new string[8] {
                "Донецк", "Енакиево", "Тельманово", "Горловка", "Зугрэс", "Харцызск", "Амвросиевка", "Макеевка"
            };
            // Задаем цены автомобилей ВАЗ
            int[] value = new int[8] {
                65, 50, 77, 87, 58, 96, 115, 107
            };



            // Находим максимум в массиве цен
            int max = -1;

            for (int i = 0; i < value.Length; i++)
            {
                if (value[i] > max)
                {
                    max = value[i];
                }
            }
            // Задаем масштабный делитель
            double mash = 5.0;
            // Определяем количество точек на единицу заработной платы
            double dy = (konec_y - nachalo_y) / (max / mash);
            // Задаем ширину прямоугольников диаграммы
            int widthRect = ((konec_x - nachalo_x) / value.Length) / 2;
            // Определяем сплошную закраску
            SolidBrush sb = new SolidBrush(Color.CornflowerBlue);
            // Определяем закраску штриховкой
            HatchBrush hb = new HatchBrush(HatchStyle.BackwardDiagonal, Color.CornflowerBlue, Color.LightSkyBlue);
            // Определяем закраску изображением
            Image        img = Image.FromFile("img.jpg");
            TextureBrush tb  = new TextureBrush(img);

            // Задаем начальную координату x
            int x = nachalo_x + widthRect;

            // Организуем цикл по элементам массива цен
            for (int i = 0; i < value.Length; i++)
            {
                // Задаем прямоугольную область элемента диаграммы
                Rectangle rect = new Rectangle(x, konec_y - (int)(dy * (value[i] /
                                                                        mash)), widthRect, (int)(dy * (value[i] / mash)));
                // Выводим закрашенные разными стилями и цветом прямоугольники
                if (i < 3)
                {
                    g.FillRectangle(sb, rect);
                }
                if ((i >= 3) && (i < 6))
                {
                    g.FillRectangle(hb, rect);
                }
                if ((i >= 6) && (i < 8))
                {
                    g.FillRectangle(tb, rect);
                }
                // Выводим рамку вокруг прямоугольника
                g.DrawRectangle(new Pen(Color.Black, 1), rect);
                // Переходим к отображению следующего элемента
                x += 2 * widthRect;
            }
            // Разметка по оси Y
            Pen p = new Pen(Color.Blue, 2);

            p.DashStyle      = System.Drawing.Drawing2D.DashStyle.Dash;
            fn               = new Font("Arial", 7, FontStyle.Bold);
            sf.Alignment     = StringAlignment.Near;
            sf.LineAlignment = StringAlignment.Center;
            for (int i = 0; i < value.Length; i++)
            {
                // Рисуем штрихпунктирные линии
                g.DrawLine(p, nachalo_x - 5, konec_y - (int)(dy * (value[i] /
                                                                   mash)), konec_x, konec_y - (int)(dy * (value[i] / mash)));
                // Выводим размеры зарплат
                g.DrawString(value[i].ToString(), fn, Brushes.DarkOliveGreen,
                             new Rectangle(1, konec_y - (int)(dy * (value[i] / mash)) -
                                           (int)fn.Size, 30, 20), sf);
            }
            // Разметка по оси X
            sf.Alignment = StringAlignment.Center;
            x            = nachalo_x + widthRect + widthRect / 2;
            for (int i = 0; i < year.Length; i++)
            {
                // Рисуем черточки по оси X
                g.DrawLine(new Pen(Color.Black, 1), x, konec_y - 5, x, konec_y + 5);
                // Выводим годы
                g.DrawString(year[i], fn, Brushes.Black, new Rectangle(x - 25, konec_y, 50, 22), sf);
                x += 2 * widthRect;
            }
        }
예제 #27
0
 public void SetBrush(TextureBrush _tb)
 {
     tb = _tb;
 }
예제 #28
0
        public bool TryMakeDAMapRhombusImage(string mapFile, ushort mapDimX, ushort mapDimY, double scale, Color bgColor, PixelFormat pixelFormat, out Bitmap daMapImage)
        {
            ushort num1 = (ushort)(10.0 * scale);
            ushort num2 = (ushort)(5.0 * scale);

            if ((int)num1 < 2 || (int)num2 < 1)
            {
                num1 = (ushort)2;
                num2 = (ushort)1;
            }
            int width  = (int)num1 * ((int)mapDimX + 2 + (int)mapDimY);
            int height = (int)num2 * ((int)mapDimX + 2 + (int)mapDimY);

            if (width * height > 15000000)
            {
                if (MessageBox.Show("Attempting to make a " + width.ToString((IFormatProvider)CultureInfo.InvariantCulture) + " by " + height.ToString((IFormatProvider)CultureInfo.InvariantCulture) + " dimention image...  Is this intended? Propabably Not! Suggestion:  Change Scale Value, or Change Dimention (If Rhombus).  Continue?", "Warning, Continue?", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    daMapImage = (Bitmap)null;
                    return(false);
                }
            }
            daMapImage = new Bitmap(width, height, pixelFormat);
            using (Graphics graphics = Graphics.FromImage((Image)daMapImage))
            {
                using (SolidBrush solidBrush = new SolidBrush(bgColor))
                    graphics.FillRectangle((Brush)solidBrush, 0, 0, daMapImage.Width, daMapImage.Height);
                bool[,] makeDaMapBool = this.GetMakeDAMapBool(mapFile, mapDimX, mapDimY);
                if (makeDaMapBool == null)
                {
                    daMapImage = (Bitmap)null;
                    return(false);
                }
                using (TextureBrush textureBrush = new TextureBrush((Image)Resources.texTRANS, WrapMode.Tile))
                {
                    for (ushort index1 = (ushort)0; (int)index1 < (int)mapDimY; ++index1)
                    {
                        for (ushort index2 = (ushort)0; (int)index2 < (int)mapDimX; ++index2)
                        {
                            if (makeDaMapBool[(int)index2, (int)index1])
                            {
                                Point[] points = new Point[4]
                                {
                                    new Point((int)num1 * ((int)mapDimY + 1 - (int)index1 + (int)index2), (int)num2 * ((int)index2 + (int)index1)),
                                    new Point((int)num1 * ((int)mapDimY + 2 - (int)index1 + (int)index2), (int)num2 * ((int)index2 + (int)index1 + 1)),
                                    new Point((int)num1 * ((int)mapDimY + 1 - (int)index1 + (int)index2), (int)index2 * (int)num2 + (int)index1 * (int)num2 + (int)num1),
                                    new Point((int)num1 * ((int)mapDimY - (int)index1 + (int)index2), (int)num2 * ((int)index2 + (int)index1 + 1))
                                };
                                graphics.FillPolygon((Brush)textureBrush, points);
                                if ((int)index2 > 0 && !makeDaMapBool[(int)index2 - 1, (int)index1])
                                {
                                    graphics.DrawLine(new Pen(Color.White), points[3], points[0]);
                                }
                                if ((int)index1 > 0 && !makeDaMapBool[(int)index2, (int)index1 - 1])
                                {
                                    graphics.DrawLine(new Pen(Color.White), points[0], points[1]);
                                }
                                if ((int)index2 < (int)mapDimX - 1 && !makeDaMapBool[(int)index2 + 1, (int)index1])
                                {
                                    graphics.DrawLine(new Pen(Color.White), points[1], points[2]);
                                }
                                if ((int)index1 < (int)mapDimY - 1 && !makeDaMapBool[(int)index2, (int)index1 + 1])
                                {
                                    graphics.DrawLine(new Pen(Color.White), points[2], points[3]);
                                }
                            }
                        }
                    }
                }
            }
            return(true);
        }
예제 #29
0
        public void UpdateData(bool bSave)
        {
            if (brushData == null)
            {
                return;
            }
            if (bSave)
            {
                brushData.BrushType = (NSBrushType)tabControl1.SelectedIndex;
                //solid
                brushData.SolidBrushInfo.Color    = solidUserControl1.color;
                brushData.LinearGradientBrushInfo = linearGradientUserControl1.LinearGradientBrushInfo;
                brushData.HatchBrushInfo          = hatchBrushInfo;

                TextrueBrushInfo.ImageDrawMode = GetImageDrawMode();
                TextrueBrushInfo.WrapMode      = GetWrapMode();
                brushData.TextrueBrushInfo     = TextrueBrushInfo;

                PathGradientBrushInfo.LinearGradient = linearGradientUserControl2.LinearGradientBrushInfo;
                brushData.PathGradientBrushInfo      = PathGradientBrushInfo;
            }
            else//映射到窗口
            {
                tabControl1.SelectedIndex = (int)brushData.BrushType;
                //solid
                solidUserControl1.color = brushData.SolidBrushInfo.Color;
                Event_SolidBrushControl(solidUserControl1.color);


                //linear
                linearGradientUserControl1.LinearGradientBrushInfo = brushData.LinearGradientBrushInfo;

                //path
                linearGradientUserControl2.LinearGradientBrushInfo = brushData.PathGradientBrushInfo.LinearGradient;

                //hatch
                hatchBrushInfo           = brushData.HatchBrushInfo;
                buttonEx_ForeColor.Color = brushData.HatchBrushInfo.ForeColor;
                buttonEx_BackColor.Color = brushData.HatchBrushInfo.BackColor;
                HScrollBarUserControl_ForeColor.Value = brushData.HatchBrushInfo.ForeAValue;
                hScrollBarUserControl_BackColor.Value = brushData.HatchBrushInfo.BackAValue;
                if (_hatchBrushExample != null)
                {
                    _hatchBrushExample.Dispose();
                }
                _hatchBrushExample = new HatchBrush(hatchBrushInfo.Style, hatchBrushInfo.ForeColor, hatchBrushInfo.BackColor);

                //image
                TextrueBrushInfo   = brushData.TextrueBrushInfo;
                textBox_image.Text = TextrueBrushInfo.FileName;

                RadioButtonEanble();
                SetWrapMode(TextrueBrushInfo.WrapMode);
                SetImageDrawMode(TextrueBrushInfo.ImageDrawMode);
                if (brushData.BrushType == NSBrushType.Textrue)
                {
                    if (TextrueBrushInfo.IsResource)
                    {
                        if (TextrueBrushInfo.ResourceImage != "")
                        {
                            Object res = Resources.ResourceManager.GetObject(TextrueBrushInfo.ResourceImage);
                            Image  im  = res as Image;
                            _textureBrushExample = new TextureBrush(im, TextrueBrushInfo.WrapMode);
                        }
                    }
                    else
                    {
                        if (TextrueBrushInfo.FileName != "")
                        {
                            Bitmap _ImageBmp = new Bitmap(TextrueBrushInfo.FileName);
                            _textureBrushExample = new TextureBrush(_ImageBmp, TextrueBrushInfo.WrapMode);
                        }
                    }
                }
            }
        }
예제 #30
0
        private static Bitmap CutImage(Texture2D m_Texture2D, Sprite m_Sprite, RectangleF textureRect, SpriteSettings settingsRaw)
        {
            var texture2D     = new Texture2DConverter(m_Texture2D);
            var originalImage = texture2D.ConvertToBitmap(false);

            if (originalImage != null)
            {
                using (originalImage)
                {
                    var spriteImage = originalImage.Clone(textureRect, PixelFormat.Format32bppArgb);

                    if (settingsRaw.packed == 1)
                    {
                        //RotateAndFlip
                        switch (settingsRaw.packingRotation)
                        {
                        case SpritePackingRotation.kSPRFlipHorizontal:
                            spriteImage.RotateFlip(RotateFlipType.RotateNoneFlipX);
                            break;

                        case SpritePackingRotation.kSPRFlipVertical:
                            spriteImage.RotateFlip(RotateFlipType.RotateNoneFlipY);
                            break;

                        case SpritePackingRotation.kSPRRotate180:
                            spriteImage.RotateFlip(RotateFlipType.Rotate180FlipNone);
                            break;

                        case SpritePackingRotation.kSPRRotate90:
                            spriteImage.RotateFlip(RotateFlipType.Rotate270FlipNone);
                            break;
                        }

                        //Tight
                        //TODO 2017 and up use m_PhysicsShape should be better
                        if (settingsRaw.packingMode == SpritePackingMode.kSPMTight)
                        {
                            try
                            {
                                var triangles = GetTriangles(m_Sprite.m_RD);
                                var points    = triangles.Select(x => x.Select(y => new PointF(y.X, y.Y)).ToArray());
                                using (var path = new GraphicsPath())
                                {
                                    foreach (var p in points)
                                    {
                                        path.AddPolygon(p);
                                    }
                                    using (var matr = new Matrix())
                                    {
                                        if (m_Sprite.m_Pivot == Vector2.Zero) //5.4.2 down
                                        {
                                            matr.Translate(m_Sprite.m_Rect.Width * 0.5f, m_Sprite.m_Rect.Height * 0.5f);
                                        }
                                        else
                                        {
                                            matr.Translate(m_Sprite.m_Rect.Width * m_Sprite.m_Pivot.X, m_Sprite.m_Rect.Height * m_Sprite.m_Pivot.Y);
                                        }
                                        matr.Scale(m_Sprite.m_PixelsToUnits, m_Sprite.m_PixelsToUnits);
                                        path.Transform(matr);
                                        var bitmap = new Bitmap((int)textureRect.Width, (int)textureRect.Height);
                                        using (var graphic = Graphics.FromImage(bitmap))
                                        {
                                            using (var brush = new TextureBrush(spriteImage))
                                            {
                                                graphic.FillPath(brush, path);
                                                bitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);
                                                return(bitmap);
                                            }
                                        }
                                    }
                                }
                            }
                            catch
                            {
                                // ignored
                            }
                        }
                    }

                    //Rectangle
                    spriteImage.RotateFlip(RotateFlipType.RotateNoneFlipY);
                    return(spriteImage);
                }
            }

            return(null);
        }
예제 #31
0
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            string pathToImage = parameters["Path to Original Image"];
            string pathToLogo  = parameters["Path to Logo Image"];
            string saveToPath  = parameters["Save to path (.jpg)"];

            string position = parameters["Position"];

            string myx = parameters["Custom X"];
            string myy = parameters["Custom Y"];

            int cx = 0;
            int cy = 0;

            if (myx == "")
            {
                cx = Convert.ToInt32(0);
            }
            else
            {
                cx = Convert.ToInt32(parameters["Custom X"]);
            }
            if (myy == "")
            {
                cy = Convert.ToInt32(0);
            }
            else
            {
                cy = Convert.ToInt32(parameters["Custom Y"]);
            }


            using (Image image = Image.FromFile(pathToImage))
                using (Image watermarkImage = Image.FromFile(pathToLogo))
                    using (Graphics imageGraphics = Graphics.FromImage(image))
                        using (TextureBrush watermarkBrush = new TextureBrush(watermarkImage))
                        {
                            if (position == "Top Left")
                            {
                                int x = 10;
                                int y = 10;
                                watermarkBrush.TranslateTransform(x, y);
                                imageGraphics.FillRectangle(watermarkBrush, new System.Drawing.Rectangle(new System.Drawing.Point(x, y), new System.Drawing.Size(watermarkImage.Width + 1, watermarkImage.Height)));
                            }
                            else if (position == "Top Right")
                            {
                                int x = (image.Width - watermarkImage.Width - 5);
                                int y = 10;
                                watermarkBrush.TranslateTransform(x, y);
                                imageGraphics.FillRectangle(watermarkBrush, new System.Drawing.Rectangle(new System.Drawing.Point(x, y), new System.Drawing.Size(watermarkImage.Width + 1, watermarkImage.Height)));
                            }
                            else if (position == "Top Middle")
                            {
                                int x = (image.Width / 2 - watermarkImage.Width / 2);
                                int y = 10;
                                watermarkBrush.TranslateTransform(x, y);
                                imageGraphics.FillRectangle(watermarkBrush, new System.Drawing.Rectangle(new System.Drawing.Point(x, y), new System.Drawing.Size(watermarkImage.Width + 1, watermarkImage.Height)));
                            }
                            else if (position == "Bottom Left")
                            {
                                int x = 10;
                                int y = (image.Height - 10 - watermarkImage.Width);
                                watermarkBrush.TranslateTransform(x, y);
                                imageGraphics.FillRectangle(watermarkBrush, new System.Drawing.Rectangle(new System.Drawing.Point(x, y), new System.Drawing.Size(watermarkImage.Width + 1, watermarkImage.Height)));
                            }
                            else if (position == "Bottom Right")
                            {
                                int x = (image.Width - watermarkImage.Width - 5);
                                int y = (image.Height - 10 - watermarkImage.Width);
                                watermarkBrush.TranslateTransform(x, y);
                                imageGraphics.FillRectangle(watermarkBrush, new System.Drawing.Rectangle(new System.Drawing.Point(x, y), new System.Drawing.Size(watermarkImage.Width + 1, watermarkImage.Height)));
                            }
                            else if (position == "Bottom Middle")
                            {
                                int x = (image.Width / 2 - watermarkImage.Width / 2);
                                int y = (image.Height - 10 - watermarkImage.Width);
                                watermarkBrush.TranslateTransform(x, y);
                                imageGraphics.FillRectangle(watermarkBrush, new System.Drawing.Rectangle(new System.Drawing.Point(x, y), new System.Drawing.Size(watermarkImage.Width + 1, watermarkImage.Height)));
                            }
                            else if (position == "Middle Left")
                            {
                                int x = 10;
                                int y = (image.Height / 2 - watermarkImage.Height / 2);
                                watermarkBrush.TranslateTransform(x, y);
                                imageGraphics.FillRectangle(watermarkBrush, new System.Drawing.Rectangle(new System.Drawing.Point(x, y), new System.Drawing.Size(watermarkImage.Width + 1, watermarkImage.Height)));
                            }
                            else if (position == "Middle Right")
                            {
                                int x = (image.Width - watermarkImage.Width - 5);
                                int y = (image.Height / 2 - watermarkImage.Height / 2);
                                watermarkBrush.TranslateTransform(x, y);
                                imageGraphics.FillRectangle(watermarkBrush, new System.Drawing.Rectangle(new System.Drawing.Point(x, y), new System.Drawing.Size(watermarkImage.Width + 1, watermarkImage.Height)));
                            }
                            else if (position == "Middle Center")
                            {
                                int x = (image.Width / 2 - watermarkImage.Width / 2);
                                int y = (image.Height / 2 - watermarkImage.Height / 2);
                                watermarkBrush.TranslateTransform(x, y);
                                imageGraphics.FillRectangle(watermarkBrush, new System.Drawing.Rectangle(new System.Drawing.Point(x, y), new System.Drawing.Size(watermarkImage.Width + 1, watermarkImage.Height)));
                            }
                            else if (position == "Custom XY")
                            {
                                int x = cx;
                                int y = cy;
                                watermarkBrush.TranslateTransform(x, y);
                                imageGraphics.FillRectangle(watermarkBrush, new System.Drawing.Rectangle(new System.Drawing.Point(x, y), new System.Drawing.Size(watermarkImage.Width + 1, watermarkImage.Height)));
                            }
                            else
                            {
                                int x = (image.Width / 2 - watermarkImage.Width / 2);
                                int y = (image.Height / 2 - watermarkImage.Height / 2);
                                watermarkBrush.TranslateTransform(x, y);
                                imageGraphics.FillRectangle(watermarkBrush, new System.Drawing.Rectangle(new System.Drawing.Point(x, y), new System.Drawing.Size(watermarkImage.Width + 1, watermarkImage.Height)));
                            }

                            image.Save(saveToPath);

                            image.Dispose();
                            watermarkImage.Dispose();
                            imageGraphics.Dispose();
                            watermarkBrush.Dispose();
                        }
        }
예제 #32
0
파일: Theme.cs 프로젝트: burber/APBEMUPANEL
    private void CreateTile()
    {
        Bitmap TileImage = new Bitmap(6, 6);
        Color[] TileColors = new Color[] {
            GetColor("Hatch1"),
            GetColor("Hatch2"),
            GetColor("Hatch3"),
            GetColor("Hatch4")
        };

        for (int I = 0; I <= 35; I++)
        {
            TileImage.SetPixel(I % 6, I / 6, TileColors[TileData[I]]);
        }

        Tile = new TextureBrush(TileImage);
        TileImage.Dispose();
    }
예제 #33
0
        public static Image CreateTornEdge(Image sourceImage, int toothHeight, int horizontalToothRange, int verticalToothRange, AnchorStyles sides)
        {
            Image result = sourceImage.CreateEmptyBitmap();

            using (GraphicsPath path = new GraphicsPath())
            {
                Random random            = new Random();
                int    horizontalRegions = sourceImage.Width / horizontalToothRange;
                int    verticalRegions   = sourceImage.Height / verticalToothRange;

                Point previousEndingPoint = new Point(horizontalToothRange, random.Next(1, toothHeight));
                Point newEndingPoint;

                if (sides.HasFlag(AnchorStyles.Top))
                {
                    for (int i = 0; i < horizontalRegions; i++)
                    {
                        int x = previousEndingPoint.X + horizontalToothRange;
                        int y = random.Next(1, toothHeight);
                        newEndingPoint = new Point(x, y);
                        path.AddLine(previousEndingPoint, newEndingPoint);
                        previousEndingPoint = newEndingPoint;
                    }
                }
                else
                {
                    previousEndingPoint = new Point(0, 0);
                    newEndingPoint      = new Point(sourceImage.Width, 0);
                    path.AddLine(previousEndingPoint, newEndingPoint);
                    previousEndingPoint = newEndingPoint;
                }

                if (sides.HasFlag(AnchorStyles.Right))
                {
                    for (int i = 0; i < verticalRegions; i++)
                    {
                        int x = sourceImage.Width - random.Next(1, toothHeight);
                        int y = previousEndingPoint.Y + verticalToothRange;
                        newEndingPoint = new Point(x, y);
                        path.AddLine(previousEndingPoint, newEndingPoint);
                        previousEndingPoint = newEndingPoint;
                    }
                }
                else
                {
                    previousEndingPoint = new Point(sourceImage.Width, 0);
                    newEndingPoint      = new Point(sourceImage.Width, sourceImage.Height);
                    path.AddLine(previousEndingPoint, newEndingPoint);
                    previousEndingPoint = newEndingPoint;
                }

                if (sides.HasFlag(AnchorStyles.Bottom))
                {
                    for (int i = 0; i < horizontalRegions; i++)
                    {
                        int x = previousEndingPoint.X - horizontalToothRange;
                        int y = sourceImage.Height - random.Next(1, toothHeight);
                        newEndingPoint = new Point(x, y);
                        path.AddLine(previousEndingPoint, newEndingPoint);
                        previousEndingPoint = newEndingPoint;
                    }
                }
                else
                {
                    previousEndingPoint = new Point(sourceImage.Width, sourceImage.Height);
                    newEndingPoint      = new Point(0, sourceImage.Height);
                    path.AddLine(previousEndingPoint, newEndingPoint);
                    previousEndingPoint = newEndingPoint;
                }

                if (sides.HasFlag(AnchorStyles.Left))
                {
                    for (int i = 0; i < verticalRegions; i++)
                    {
                        int x = random.Next(1, toothHeight);
                        int y = previousEndingPoint.Y - verticalToothRange;
                        newEndingPoint = new Point(x, y);
                        path.AddLine(previousEndingPoint, newEndingPoint);
                        previousEndingPoint = newEndingPoint;
                    }
                }
                else
                {
                    previousEndingPoint = new Point(0, sourceImage.Height);
                    newEndingPoint      = new Point(0, 0);
                    path.AddLine(previousEndingPoint, newEndingPoint);
                    previousEndingPoint = newEndingPoint;
                }

                path.CloseFigure();

                using (Graphics graphics = Graphics.FromImage(result))
                {
                    graphics.SmoothingMode      = SmoothingMode.HighQuality;
                    graphics.PixelOffsetMode    = PixelOffsetMode.HighQuality;
                    graphics.CompositingQuality = CompositingQuality.HighQuality;
                    graphics.InterpolationMode  = InterpolationMode.HighQualityBicubic;

                    // Draw the created figure with the original image by using a TextureBrush so we have anti-aliasing
                    using (Brush brush = new TextureBrush(sourceImage))
                    {
                        graphics.FillPath(brush, path);
                    }
                }
            }

            return(result);
        }
예제 #34
0
        public override void Draw(Graphics g, int dx, int dy, float zoom)
        {
            Brush myBrush = GetBrush(dx, dy, zoom);

            // prace s texturou a osetreni pri Load / Save protoze C# neumi serializaci TextureBrush tridy
            // musim zde zbytecne tvorit 2 tridy Texturebrush ....
            TextureBrush texture = GetTextureBrush();
            TextureBrush texture2;

            if (texture == null)
            {
                ObrBitmap = ImageOfTexture;
                ObrBitmap = ChangeOpacity(ObrBitmap, (Průhlednost / 100));
                texture2  = new TextureBrush(ObrBitmap);
            }
            else
            {
                ObrImage            = texture.Image;
                ObrImage            = ChangeOpacity(ObrImage, (Průhlednost / 100));
                texture2            = new TextureBrush(ObrImage);
                PrevodImageNaBitmap = new Bitmap(ObrImage);
                ImageOfTexture      = PrevodImageNaBitmap;
            }

            float scalX = zoom;
            float scalY = zoom;

            texture2.Transform = new Matrix(
                scalX,
                0.0f,
                0.0f,
                scalY,
                0.0f,
                0.0f);

            Pen myPen = new Pen(Pero_barva, ScaledPenWidth(zoom));

            myPen.DashStyle = DashStyleMy;
            myPen.Color     = Transparency(Pero_barva, Alpha);

            if (selected)
            {
                myPen.Color = Color.Red;
                myPen.Color = Transparency(myPen.Color, 120);
                myPen.Width = myPen.Width + 1;
            }

            // Vytvori Graphics Path a prida tam objekt PointSet pomoci ArrayList pole
            GraphicsPath myPath = new GraphicsPath();

            PointF[] myArr = new PointF[points.Count];
            int      i     = 0;

            foreach (PointWrapper p in points)
            {
                myArr[i++] = new PointF((p.X + X + dx) * zoom, (p.Y + Y + dy) * zoom);
            }

            if (myArr.Length < 3 | !Zakřivení)
            {
                if (Closed & myArr.Length >= 3)
                {
                    myPath.AddPolygon(myArr);
                }
                else
                {
                    myPath.AddLines(myArr);
                }
            }
            else
            {
                if (Closed)
                {
                    myPath.AddClosedCurve(myArr);
                }
                else
                {
                    myPath.AddCurve(myArr);
                }
            }

            // pouzije vlstnost GDI+ ...trida  Matrix predstavuje geometricke transformace. Zde konkretne delam retaci kolem PointF bodu
            Matrix translateMatrix = new Matrix();

            translateMatrix.RotateAt(Rotace, new PointF((X + dx + (X1 - X) / 2) * zoom, (Y + dy + (Y1 - Y) / 2) * zoom));

            // Na muj Graphics Path pouziji transformacni Matrix
            myPath.Transform(translateMatrix);

            // A konecne nakresli transformovany objekt polygon na obrazovku:
            if (TextureFilled || ColorFilled)
            {
                if (TextureFilled)
                {
                    g.FillPath(texture2, myPath);
                }
                else
                {
                    g.FillPath(myBrush, myPath);
                }

                if (Ohraničení)
                {
                    g.DrawPath(myPen, myPath);
                }
            }
            else
            {
                g.DrawPath(myPen, myPath);
            }

            texture2.Dispose();
            //obr.Dispose();
            myPath.Dispose();
            myPen.Dispose();
            translateMatrix.Dispose();


            if (myBrush != null)
            {
                myBrush.Dispose();
            }
        }
예제 #35
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            this.SynchronizePreview();

            bool linkBroken = this.ReferenceBroken;

            Color bgColorBright = Color.White;

            if (this.dragHover)
            {
                bgColorBright = bgColorBright.MixWith(Color.FromArgb(192, 255, 0), 0.4f);
            }
            else if (this.multiple)
            {
                bgColorBright = Color.Bisque;
            }
            else if (linkBroken)
            {
                bgColorBright = Color.FromArgb(255, 128, 128);
            }

            bool      darkBg    = false;
            Rectangle rectImage = new Rectangle(this.rectPanel.X + 2, this.rectPanel.Y + 2, this.rectPanel.Width - 4, this.rectPanel.Height - 4);

            if (this.prevImage == null)
            {
                if (this.ReadOnly || !this.Enabled)
                {
                    e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(64, bgColorBright)), rectImage);
                }
                else
                {
                    e.Graphics.FillRectangle(new SolidBrush(bgColorBright), rectImage);
                }
            }
            else
            {
                Color brightChecker = this.prevImageLum > 0.5f ? Color.FromArgb(48, 48, 48) : Color.FromArgb(224, 224, 224);
                Color darkChecker   = this.prevImageLum > 0.5f ? Color.FromArgb(32, 32, 32) : Color.FromArgb(192, 192, 192);

                if (this.dragHover)
                {
                    brightChecker = brightChecker.MixWith(Color.FromArgb(192, 255, 0), 0.4f);
                    darkChecker   = darkChecker.MixWith(Color.FromArgb(192, 255, 0), 0.4f);
                }
                else if (this.multiple)
                {
                    brightChecker = brightChecker.MixWith(Color.FromArgb(255, 200, 128), 0.4f);
                    darkChecker   = darkChecker.MixWith(Color.FromArgb(255, 200, 128), 0.4f);
                }
                else if (linkBroken)
                {
                    brightChecker = brightChecker.MixWith(Color.FromArgb(255, 128, 128), 0.4f);
                    darkChecker   = darkChecker.MixWith(Color.FromArgb(255, 128, 128), 0.4f);
                }

                e.Graphics.FillRectangle(new HatchBrush(HatchStyle.LargeCheckerBoard, brightChecker, darkChecker), rectImage);

                TextureBrush bgImageBrush = new TextureBrush(this.prevImage);
                bgImageBrush.ResetTransform();
                bgImageBrush.TranslateTransform(rectImage.X, rectImage.Y);
                e.Graphics.FillRectangle(bgImageBrush, rectImage);

                darkBg = this.prevImageLum > 0.5f;
                if (this.ReadOnly || !this.Enabled)
                {
                    e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(128, SystemColors.Control)), rectImage);
                    darkBg = (this.prevImageLum + SystemColors.Control.GetLuminance()) * 0.5f < 0.5f;
                }
            }

            if (this.prevSound != null)
            {
                if (this.prevSoundInst != null)
                {
                    e.Graphics.DrawImage(darkBg ? EditorBaseResCache.IconSpeakerWhite : EditorBaseResCache.IconSpeakerBlack,
                                         this.rectPrevSound.X,
                                         this.rectPrevSound.Y);
                }
                else
                {
                    e.Graphics.DrawImageAlpha(darkBg ? EditorBaseResCache.IconSpeakerWhite : EditorBaseResCache.IconSpeakerBlack,
                                              0.5f,
                                              this.rectPrevSound.X,
                                              this.rectPrevSound.Y);
                }
            }

            StringFormat format = StringFormat.GenericDefault;

            format.Alignment     = StringAlignment.Center;
            format.LineAlignment = StringAlignment.Center;
            format.Trimming      = StringTrimming.EllipsisPath;
            SizeF textSize = e.Graphics.MeasureString(
                this.ReferenceName ?? "null",
                SystemFonts.DefaultFont,
                new SizeF(this.rectPanel.Width, this.rectPanel.Height),
                format);

            Rectangle rectText;

            if (this.prevImage == null)
            {
                rectText = this.rectPanel;
            }
            else
            {
                rectText = new Rectangle(
                    this.rectPanel.X, this.rectPanel.Bottom - (int)textSize.Height - 2, this.rectPanel.Width, (int)textSize.Height);
            }

            if (this.prevImage != null)
            {
                e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(192, bgColorBright)),
                                         rectText.X + rectText.Width / 2 - textSize.Width / 2 - 1,
                                         rectText.Y + rectText.Height / 2 - textSize.Height / 2 - 2,
                                         textSize.Width + 1,
                                         textSize.Height + 2);
            }
            e.Graphics.DrawString(
                this.ReferenceName ?? "null",
                SystemFonts.DefaultFont,
                new SolidBrush(this.Enabled ? SystemColors.ControlText : SystemColors.GrayText),
                rectText,
                format);

            this.ControlRenderer.DrawBorder(e.Graphics,
                                            this.rectPanel,
                                            BorderStyle.ContentBox,
                                            (this.ReadOnly || !this.Enabled) ? BorderState.Disabled : BorderState.Normal);

            ButtonState buttonStateReset = ButtonState.Disabled;

            if (!this.ReadOnly && this.Enabled && this.ReferenceName != null)
            {
                if (this.buttonResetPressed)
                {
                    buttonStateReset = ButtonState.Pressed;
                }
                else if (this.buttonResetHovered)
                {
                    buttonStateReset = ButtonState.Hot;
                }
                else
                {
                    buttonStateReset = ButtonState.Normal;
                }
            }
            this.ControlRenderer.DrawButton(
                e.Graphics,
                this.rectButtonReset,
                buttonStateReset,
                null,
                iconReset);

            ButtonState buttonStateSelect = ButtonState.Disabled;

            if (!this.ReadOnly && this.Enabled)
            {
                if (this.buttonSelectPressed)
                {
                    buttonStateSelect = ButtonState.Pressed;
                }
                else if (this.buttonSelectHovered || this.Focused)
                {
                    buttonStateSelect = ButtonState.Hot;
                }
                else
                {
                    buttonStateSelect = ButtonState.Normal;
                }
            }
            this.ControlRenderer.DrawButton(
                e.Graphics,
                this.rectButtonSelect,
                buttonStateSelect,
                null,
                iconSelect);
        }
예제 #36
0
        void Effectual_PaintHook(System.Windows.Forms.PaintEventArgs e)
        {
            Bitmap    B         = new Bitmap(Width, Height);
            Graphics  G         = Graphics.FromImage(B);
            Rectangle MainBox   = new Rectangle(0, 0, Width, 32);
            Rectangle SecondBox = new Rectangle(0, 33, Width, Height);
            Rectangle BottomBox = new Rectangle(-3, Height - 25, Width + 5, Height - 25);


            G.Clear(Color.Fuchsia);

            G.CompositingQuality = CompositingQuality.HighQuality;
            Effectual_ImageToCodeClass d = new Effectual_ImageToCodeClass();
            Bitmap       HATCHIMAGE      = (Bitmap)(d.CodeToImage("/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAA/APgDASIAAhEBAxEB/8QAHwAA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GoZZIVT5pVI4YfIQeetAxY532EDAPBz36VEFIVuro+OvXn+f40xdQhywUKcrnJzgc9vbpTYbmL7OXLryoGACC2R9P84oFYdd3DvbhkUKBt2gKRgnsf8ParUaidYQoSSVAPl3EH9enIzj6VSutVBQqWBQAL069Ktx67DmFJFjxFH8x8vdkDH6YpitoTPYQreSs0scbIDghshhjt9euPrzRSfaraYboyUZDnOOMBT0Hb86KaQmf/9k="));
            Bitmap       BODYIMAGE       = (Bitmap)(d.CodeToImage("iVBORw0KGgoAAAANSUhEUgAAAGUAAABkCAIAAAAQQmk9AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AABLkUlEQVR4XiXdCZriWM8sYPa/rTSjwfM8m5XUK6qf/363uyoTzDkaQqGQuJzrNEzbltfDUf/VVZJc12Zt9j7fl+lsvsM5j/25DPmxpU36fL3rfh7L+Xse61H626qfsqpbl/n9fldZWm9dOx1V01VN3+1tVTfNMM/LWiSvvErWPl/qdammZq36Ol/L4aj6bJsez9ereCzbMa/HvgzfuWum00sPe7Oty+OT/HmqrC6qulrbsz+aY9yWediKYStfr/STvLuu3eplaEsPX5dFvs9Vvyzj8CxfyfPdN+XWHXnVFrPHasajGZZzm/pHUiW3V15US1fUddUUZzeM21lObVZ0c5neXmk658NWjUdWbPFH02UdSv897n76GNZiqPO8asq5ro9xqbd8qudv+y3qudmHcfFrwzg5vqbtpuZYp36exrEt8mP3H8MwzO3X33abF1ur2nnV4zQtZ3P6o2Nomnrc8v3Mxm93jFW8eN4V3bSUw3qWQ+UhunNqsmNr12rpSy/lXYah7/phWta8nbahbOryOI5i7fu2Lrt5cLZtduZFU1dl07vOYizKY/Ypjrw8x6orVsYwn/XQ5FufVcfcHsOcteNWHEVTFaeXGqqtPJayqpej2Pp824/WP+O2+6fotu4clqM+l+rcLnt37ENRT1ntvtLrvbgP1dHu3dpsxzKMzTn1dTWX32Yq34/r7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OVa7LqJaCdQ7DiRANqWwVjzqUHYcAvvhRAHut01pR00c6JKTX6419DAVgzKBFUui62r1X1tWFApCtneh5NUYJVte/dU6O2abCa3GvG6Kba3s526xx9CIW61B4LcaRAa5aix2FBHm80SBm9YVtnmkBXZtdscI19B6YaDO4atfXFEL9p1Vhzp05Hc/6Wn2qUye/xpVWYQPfgu6cMpFlFAGPqDNojp4dkkzVlWRVlYkjaraH3ieN7ltoQQKNULcJAqAJk/Tfw40GgTAi2/wNekMHVqU8DpgAAAABJRU5ErkJggg=="));
            TextureBrush TEXTUREIMAGE    = new TextureBrush(HATCHIMAGE, WrapMode.TileFlipXY);
            TextureBrush BACKIMAGE       = new TextureBrush(BODYIMAGE, WrapMode.TileFlipXY);

            G.FillRectangle(TEXTUREIMAGE, MainBox);

            Pen p1 = new Pen(new SolidBrush(Color.FromArgb(35, 35, 35)));

            G.DrawLine(p1, 0, 31, Width, 31);
            Pen p2 = new Pen(new SolidBrush(Color.FromArgb(50, 50, 50)));

            G.DrawLine(p2, 0, 30, Width, 30);
            G.DrawLine(Pens.Black, 0, 32, Width, 32);

            G.FillRectangle(BACKIMAGE, SecondBox);

            Point[] Pt =
            {
                new Point(10,  0),
                new Point(10, 66),
                new Point(36, 40),
                new Point(62, 66),
                new Point(62, 0)
            };

            Pen penCurrent = new Pen(Color.Black);

            G.DrawPolygon(penCurrent, Pt);
            SolidBrush br = new SolidBrush(Color.FromArgb(86, 86, 86));

            G.FillPolygon(br, Pt);

            Point[] Pt2 =
            {
                new Point(14,  0),
                new Point(14, 62),
                new Point(36, 40),
                new Point(58, 62),
                new Point(58, 0)
            };

            Pen penCurrent2 = new Pen(Color.FromArgb(51, 51, 50));

            G.DrawPolygon(penCurrent2, Pt2);
            HatchBrush br2 = new HatchBrush(HatchStyle.SmallGrid, Color.FromArgb(52, 52, 51), Color.FromArgb(48, 49, 48));

            G.FillPolygon(TEXTUREIMAGE, Pt2);

            G.DrawLine(Pens.Black, 10, 0, 10, 66);
            G.DrawLine(Pens.Black, 10, 66, 36, 40);

            Font p = new Font("Tahoma", 10, FontStyle.Bold);

            G.DrawString(_SubText, p, Brushes.WhiteSmoke, 68, 9);

            Rectangle IconRect = new Rectangle(23, 8, 26, 26);

            G.DrawIcon(Parent.FindForm().Icon, IconRect);

            Pen BottomPen = new Pen(new SolidBrush(Color.FromArgb(99, 99, 99)), 7);

            G.DrawRectangle(BottomPen, BottomBox);
            Bitmap       BOTTOMIMAGE   = (Bitmap)(d.CodeToImage("/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAA9AL8DASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb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);

            G.FillRectangle(BOTTOMTEXTURE, BottomBox);

            e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0);
            G.Dispose();
            B.Dispose();
        }
예제 #37
0
        public static void DrawImageEx(this Graphics g, Bitmap bit, Rectangle area,
                                       CompositingQuality CompositingQuality,
                                       InterpolationMode InterpolationMode,
                                       PixelOffsetMode PixelOffsetMode,
                                       SmoothingMode SmoothingMode,
                                       ZoomType ZoomType, ImageAttributes ImageAttributes
                                       )
        {
            g.CompositingQuality = CompositingQuality;
            g.InterpolationMode  = InterpolationMode;
            g.PixelOffsetMode    = PixelOffsetMode;
            g.SmoothingMode      = SmoothingMode;

            if (ZoomType == ZoomType.CenterIfNoZoom)
            {
                if (bit.Width < area.Width && bit.Height < area.Height)
                {
                    ZoomType = Drawing.ZoomType.Center;
                }
                else
                {
                    ZoomType = Drawing.ZoomType.Zoom;
                }
            }

            switch (ZoomType)
            {
            case ZoomType.Tile:
                if (ImageAttributes != null)
                {
                    using (var brush = new TextureBrush(bit, area, ImageAttributes)) {
                        g.FillRectangle(brush, area);
                    }
                }
                else
                {
                    using (var brush = new TextureBrush(bit)) {
                        g.FillRectangle(brush, area);
                    }
                }
                break;

            case ZoomType.Center:
                area.X += (area.Width - bit.Width) / 2;
                area.Y += (area.Height - bit.Height) / 2;

                area.Width  = bit.Width;
                area.Height = bit.Height;

                FinalDraw(g, bit, area, ImageAttributes);
                break;

            case ZoomType.Stretch:
                FinalDraw(g, bit, area, ImageAttributes);
                break;

            case ZoomType.Zoom:
                int nw, nh;
                SetZoomSize(bit.Width, bit.Height, area.Width, area.Height, out nw, out nh);

                area.X      = ((area.Width - nw) / 2) + area.X;
                area.Y      = ((area.Height - nh) / 2) + area.Y;
                area.Width  = nw;
                area.Height = nh;

                FinalDraw(g, bit, area, ImageAttributes);
                break;

            case Drawing.ZoomType.Crop:
                SetCorpSize(bit.Width, bit.Height, area.Width, area.Height, out nw, out nh);

                g.SetClip(area);
                area.X      = ((area.Width - nw) / 2) + area.X;
                area.Y      = ((area.Height - nh) / 2) + area.Y;
                area.Width  = nw;
                area.Height = nh;

                FinalDraw(g, bit, area, ImageAttributes);
                break;
            }
        }
예제 #38
0
        /// <summary>
        /// Applies the halftone filter.
        /// </summary>
        /// <param name="source">
        /// The <see cref="Bitmap"/> to apply the filter to.
        /// </param>
        /// <returns>
        /// The <see cref="Bitmap"/> with the filter applied.
        /// </returns>
        public Bitmap ApplyFilter(Bitmap source)
        {
            // TODO: Make this class implement an interface?
            Bitmap padded   = null;
            Bitmap cyan     = null;
            Bitmap magenta  = null;
            Bitmap yellow   = null;
            Bitmap keyline  = null;
            Bitmap newImage = null;

            try
            {
                int sourceWidth  = source.Width;
                int sourceHeight = source.Height;
                int width        = source.Width + this.distance;
                int height       = source.Height + this.distance;

                // Draw a slightly larger image, flipping the top/left pixels to prevent
                // jagged edge of output.
                padded = new Bitmap(width, height, PixelFormat.Format32bppPArgb);
                padded.SetResolution(source.HorizontalResolution, source.VerticalResolution);
                using (Graphics graphicsPadded = Graphics.FromImage(padded))
                {
                    graphicsPadded.Clear(Color.White);
                    Rectangle destinationRectangle = new Rectangle(0, 0, sourceWidth + this.distance, source.Height + this.distance);
                    using (TextureBrush tb = new TextureBrush(source))
                    {
                        tb.WrapMode = WrapMode.TileFlipXY;
                        tb.TranslateTransform(this.distance, this.distance);
                        graphicsPadded.FillRectangle(tb, destinationRectangle);
                    }
                }

                // Calculate min and max widths/heights.
                Rectangle rotatedBounds = this.GetBoundingRectangle(width, height);
                int       minY          = -(rotatedBounds.Height + height);
                int       maxY          = rotatedBounds.Height + height;
                int       minX          = -(rotatedBounds.Width + width);
                int       maxX          = rotatedBounds.Width + width;
                Point     center        = Point.Empty;

                // Yellow oversaturates the output.
                int   offset            = this.distance;
                float yellowMultiplier  = this.distance * 1.587f;
                float magentaMultiplier = this.distance * 2.176f;
                float multiplier        = this.distance * 2.2f;
                float max        = this.distance * (float)Math.Sqrt(2);
                float magentaMax = this.distance * (float)Math.Sqrt(1.4545);

                // Bump up the keyline max so that black looks black.
                float keylineMax = max * (float)Math.Sqrt(2);

                // Color sampled process colours from Wikipedia pages.
                // Keyline brush is declared separately.
                Brush cyanBrush    = new SolidBrush(Color.FromArgb(0, 183, 235));
                Brush magentaBrush = new SolidBrush(Color.FromArgb(255, 0, 144));
                Brush yellowBrush  = new SolidBrush(Color.FromArgb(255, 239, 0));

                // Create our images.
                cyan     = new Bitmap(width, height, PixelFormat.Format32bppPArgb);
                magenta  = new Bitmap(width, height, PixelFormat.Format32bppPArgb);
                yellow   = new Bitmap(width, height, PixelFormat.Format32bppPArgb);
                keyline  = new Bitmap(width, height, PixelFormat.Format32bppPArgb);
                newImage = new Bitmap(sourceWidth, sourceHeight, PixelFormat.Format32bppPArgb);

                // Ensure the correct resolution is set.
                cyan.SetResolution(source.HorizontalResolution, source.VerticalResolution);
                magenta.SetResolution(source.HorizontalResolution, source.VerticalResolution);
                yellow.SetResolution(source.HorizontalResolution, source.VerticalResolution);
                keyline.SetResolution(source.HorizontalResolution, source.VerticalResolution);
                newImage.SetResolution(source.HorizontalResolution, source.VerticalResolution);

                // Check bounds against this.
                Rectangle rectangle = new Rectangle(0, 0, width, height);

                using (Graphics graphicsCyan = Graphics.FromImage(cyan))
                    using (Graphics graphicsMagenta = Graphics.FromImage(magenta))
                        using (Graphics graphicsYellow = Graphics.FromImage(yellow))
                            using (Graphics graphicsKeyline = Graphics.FromImage(keyline))
                            {
                                // Set the quality properties.
                                graphicsCyan.PixelOffsetMode    = PixelOffsetMode.HighQuality;
                                graphicsMagenta.PixelOffsetMode = PixelOffsetMode.HighQuality;
                                graphicsYellow.PixelOffsetMode  = PixelOffsetMode.HighQuality;
                                graphicsKeyline.PixelOffsetMode = PixelOffsetMode.HighQuality;

                                graphicsCyan.SmoothingMode    = SmoothingMode.AntiAlias;
                                graphicsMagenta.SmoothingMode = SmoothingMode.AntiAlias;
                                graphicsYellow.SmoothingMode  = SmoothingMode.AntiAlias;
                                graphicsKeyline.SmoothingMode = SmoothingMode.AntiAlias;

                                graphicsCyan.CompositingQuality    = CompositingQuality.HighQuality;
                                graphicsMagenta.CompositingQuality = CompositingQuality.HighQuality;
                                graphicsYellow.CompositingQuality  = CompositingQuality.HighQuality;
                                graphicsKeyline.CompositingQuality = CompositingQuality.HighQuality;

                                // Set up the canvas.
                                graphicsCyan.Clear(Color.White);
                                graphicsMagenta.Clear(Color.White);
                                graphicsYellow.Clear(Color.White);
                                graphicsKeyline.Clear(Color.White);

                                // This is too slow. The graphics object can't be called within a parallel
                                // loop so we have to do it old school. :(
                                using (FastBitmap sourceBitmap = new FastBitmap(padded))
                                {
                                    for (int y = minY; y < maxY; y += offset)
                                    {
                                        for (int x = minX; x < maxX; x += offset)
                                        {
                                            Color     color;
                                            CmykColor cmykColor;
                                            float     brushWidth;

                                            // Cyan
                                            Point rotatedPoint = ImageMaths.RotatePoint(new Point(x, y), this.cyanAngle, center);
                                            int   angledX      = rotatedPoint.X;
                                            int   angledY      = rotatedPoint.Y;
                                            if (rectangle.Contains(new Point(angledX, angledY)))
                                            {
                                                color      = sourceBitmap.GetPixel(angledX, angledY);
                                                cmykColor  = color;
                                                brushWidth = Math.Min((cmykColor.C / 100f) * multiplier, max);
                                                graphicsCyan.FillEllipse(cyanBrush, angledX, angledY, brushWidth, brushWidth);
                                            }

                                            // Magenta
                                            rotatedPoint = ImageMaths.RotatePoint(new Point(x, y), this.magentaAngle, center);
                                            angledX      = rotatedPoint.X;
                                            angledY      = rotatedPoint.Y;
                                            if (rectangle.Contains(new Point(angledX, angledY)))
                                            {
                                                color      = sourceBitmap.GetPixel(angledX, angledY);
                                                cmykColor  = color;
                                                brushWidth = Math.Min((cmykColor.M / 100f) * magentaMultiplier, magentaMax);
                                                graphicsMagenta.FillEllipse(magentaBrush, angledX, angledY, brushWidth, brushWidth);
                                            }

                                            // Yellow
                                            rotatedPoint = ImageMaths.RotatePoint(new Point(x, y), this.yellowAngle, center);
                                            angledX      = rotatedPoint.X;
                                            angledY      = rotatedPoint.Y;
                                            if (rectangle.Contains(new Point(angledX, angledY)))
                                            {
                                                color      = sourceBitmap.GetPixel(angledX, angledY);
                                                cmykColor  = color;
                                                brushWidth = Math.Min((cmykColor.Y / 100f) * yellowMultiplier, max);
                                                graphicsYellow.FillEllipse(yellowBrush, angledX, angledY, brushWidth, brushWidth);
                                            }

                                            // Keyline
                                            rotatedPoint = ImageMaths.RotatePoint(new Point(x, y), this.keylineAngle, center);
                                            angledX      = rotatedPoint.X;
                                            angledY      = rotatedPoint.Y;
                                            if (rectangle.Contains(new Point(angledX, angledY)))
                                            {
                                                color      = sourceBitmap.GetPixel(angledX, angledY);
                                                cmykColor  = color;
                                                brushWidth = Math.Min((cmykColor.K / 100f) * multiplier, keylineMax);

                                                // Just using black is too dark.
                                                Brush keylineBrush = new SolidBrush(CmykColor.FromCmykColor(0, 0, 0, cmykColor.K));
                                                graphicsKeyline.FillEllipse(keylineBrush, angledX, angledY, brushWidth, brushWidth);
                                            }
                                        }
                                    }
                                }

                                // Set our white background.
                                using (Graphics graphics = Graphics.FromImage(newImage))
                                {
                                    graphics.Clear(Color.White);
                                }

                                // Blend the colors now to mimic adaptive blending.
                                using (FastBitmap cyanBitmap = new FastBitmap(cyan))
                                    using (FastBitmap magentaBitmap = new FastBitmap(magenta))
                                        using (FastBitmap yellowBitmap = new FastBitmap(yellow))
                                            using (FastBitmap keylineBitmap = new FastBitmap(keyline))
                                                using (FastBitmap destinationBitmap = new FastBitmap(newImage))
                                                {
                                                    Parallel.For(
                                                        offset,
                                                        height,
                                                        y =>
                                                    {
                                                        for (int x = offset; x < width; x++)
                                                        {
                                                            // ReSharper disable AccessToDisposedClosure
                                                            Color cyanPixel    = cyanBitmap.GetPixel(x, y);
                                                            Color magentaPixel = magentaBitmap.GetPixel(x, y);
                                                            Color yellowPixel  = yellowBitmap.GetPixel(x, y);
                                                            Color keylinePixel = keylineBitmap.GetPixel(x, y);

                                                            // Negate the offset.
                                                            int xBack = x - offset;
                                                            int yBack = y - offset;

                                                            CmykColor blended = cyanPixel.AddAsCmykColor(magentaPixel, yellowPixel, keylinePixel);
                                                            if (rectangle.Contains(new Point(xBack, yBack)))
                                                            {
                                                                destinationBitmap.SetPixel(xBack, yBack, blended);
                                                            }
                                                            // ReSharper restore AccessToDisposedClosure
                                                        }
                                                    });
                                                }
                            }

                padded.Dispose();
                cyan.Dispose();
                magenta.Dispose();
                yellow.Dispose();
                keyline.Dispose();
                source.Dispose();
                source = newImage;
            }
            catch
            {
                if (padded != null)
                {
                    padded.Dispose();
                }

                if (cyan != null)
                {
                    cyan.Dispose();
                }

                if (magenta != null)
                {
                    magenta.Dispose();
                }

                if (yellow != null)
                {
                    yellow.Dispose();
                }

                if (keyline != null)
                {
                    keyline.Dispose();
                }

                if (newImage != null)
                {
                    newImage.Dispose();
                }
            }

            return(source);
        }
예제 #39
0
        public void DrawGraphicFile(Graphics zGraphics, string sFile, ProjectLayoutElement zElement, int nXGraphicOffset = 0, int nYGraphicOffset = 0)
        {
            var sPath = sFile;

            if (string.IsNullOrEmpty(sFile) ||
                sPath.Equals("none", StringComparison.CurrentCultureIgnoreCase))
            {
                return;
            }
            if (sPath.StartsWith(APPLICATION_FOLDER_MARKER))
            {
                sPath = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location),
                                     sPath.Replace(APPLICATION_FOLDER_MARKER, string.Empty));
            }
            if (!File.Exists(sPath))
            {
                sPath = ProjectManager.Instance.ProjectPath + sFile;
            }
            if (!File.Exists(sPath))
            {
                IssueManager.Instance.FireAddIssueEvent("Image file not found: " + sFile);
                return;
            }

            var zBmp = 255 != zElement.opacity
                ? ImageCache.LoadCustomImageFromCache(sPath, zElement)
                : ImageCache.LoadImageFromCache(sPath);

            var nWidth  = zElement.width;
            var nHeight = zElement.height;

            // TODO: sub processor methods (at a minimum)

            if (!string.IsNullOrWhiteSpace(zElement.tilesize) &&
                zElement.tilesize.Trim() != "-")
            {
                var zMatch = regexImageTile.Match(zElement.tilesize);
                if (zMatch.Success)
                {
                    var nTileWidth  = Math.Max(-1, ParseUtil.ParseDefault(zMatch.Groups[1].Value, -1));
                    var nTileHeight = Math.Max(-1, ParseUtil.ParseDefault(zMatch.Groups[3].Value, -1));
                    GetAspectRatioHeight(zBmp, nTileWidth, nTileHeight, out nTileWidth, out nTileHeight);
                    // paranoia...
                    nTileWidth  = Math.Max(1, nTileWidth);
                    nTileHeight = Math.Max(1, nTileHeight);

                    zBmp = ImageCache.LoadCustomImageFromCache(sFile, zElement, nTileWidth, nTileHeight);
                }
                using (var zTextureBrush = new TextureBrush(zBmp, WrapMode.Tile))
                {
                    // backup the transform
                    var zOriginalTransform = zGraphics.Transform;
                    // need to translate so the tiling starts with a full image if offset
                    zGraphics.TranslateTransform(nXGraphicOffset, nYGraphicOffset);
                    zGraphics.FillRectangle(zTextureBrush, 0, 0, nWidth, nHeight);
                    zGraphics.Transform = zOriginalTransform;
                }
                return;
            }

            if (zElement.keeporiginalsize)
            {
                DrawGraphicOriginalSize(zGraphics, zBmp, zElement);
                return;
            }

            if (zElement.lockaspect)
            {
                GetSizeFromAspectRatio((float)zBmp.Tag, nWidth, nHeight, out nWidth, out nHeight);
            }

            var nX = 0;
            var nY = 0;

            // standard alignment adjustment
            UpdateAlignmentValue(zElement.GetHorizontalAlignment(), ref nX, zElement.width, nWidth);
            UpdateAlignmentValue(zElement.GetVerticalAlignment(), ref nY, zElement.height, nHeight);
            zGraphics.DrawImage(zBmp, nX + nXGraphicOffset, nY + nYGraphicOffset, nWidth, nHeight);
        }
예제 #40
0
        private Bitmap RenderMap(List <int> layers, Rectangle clipping_rect)
        {
            if ((fmf_data_ == null) || (obs_data_ == null) || (MapDesignCB.SelectedIndex < 0))
            {
                return(new Bitmap(32, 32));
            }

            var bmp = new Bitmap(clipping_rect.Width, clipping_rect.Height);

            var width  = (int)fmf_data_.width;
            var height = (int)fmf_data_.height;

            using (var g = Graphics.FromImage(bmp))
            {
                g.InterpolationMode = InterpolationMode.NearestNeighbor;
                g.CompositingMode   = CompositingMode.SourceOver;
                //g.CompositingQuality = CompositingQuality.HighQuality;
                g.PixelOffsetMode = PixelOffsetMode.HighQuality;

                using (var tex = new Bitmap(16, 16))
                    using (var b1 = new SolidBrush(Color.DarkGray))
                        using (var b2 = new SolidBrush(Color.LightGray))
                            using (var g2 = Graphics.FromImage(tex))
                            {
                                g2.FillRectangle(b1, 0, 0, 8, 8);
                                g2.FillRectangle(b1, 8, 8, 8, 8);
                                g2.FillRectangle(b2, 8, 0, 8, 8);
                                g2.FillRectangle(b2, 0, 8, 8, 8);
                                using (var b3 = new TextureBrush(tex))
                                {
                                    g.FillRectangle(b3, 0, 0, bmp.Width, bmp.Height);
                                }
                            }

                for (var i = 0; i < 13; ++i)
                {
                    if (!layers.Contains(i))
                    {
                        continue;
                    }

                    if ((i < 8) || (i == 12))
                    {
                        for (var j = 0; j < (width * height); ++j)
                        {
                            var tileset  = (uint)map_layers_[i][(j * 2) + 1];
                            var index    = (int)chp_data_[tileset].index_map[(uint)map_layers_[i][j * 2]];
                            var src_rect = new Rectangle((index % 8) * 16, (index / 8) * 16, 16, 16);
                            var dst_rect = new Rectangle(((j % width) * 16) - clipping_rect.X, ((j / width) * 16) - clipping_rect.Y, 16, 16);

                            if ((index != 0) || (tileset != 0))
                            {
                                g.DrawImage(chp_bmps_[tileset], dst_rect, src_rect, GraphicsUnit.Pixel);
                            }
                        }
                    }
                    if (i >= 8)
                    {
                        using (var fnt = new Font("Arial", 9))
                            using (var bkgrnd_brush = new SolidBrush(Color.DarkSlateGray))
                                using (var text_brush = new SolidBrush(Color.White))
                                {
                                    for (var j = 0; j < (width * height); ++j)
                                    {
                                        var index    = (uint)BitConverter.ToUInt16(map_layers_[i], j * 2);
                                        var src_rect = new Rectangle(0, 0, 32, 32);
                                        var dst_rect = new Rectangle((((j % width) * 16) - 8) - clipping_rect.X, (((j / width) * 16) - 16) - clipping_rect.Y, 32, 32);
                                        var obj_id   = obs_data_.entries[(index < obs_data_.entries.Length) ? index : 0].object_id;

                                        if (index > 0)
                                        {
                                            if ((obj_id > 0) && (i != 8) && (i != 9) && (i != 12))
                                            {
                                                if (!objects_.ContainsKey(obj_id))
                                                {
                                                    objects_[obj_id] = LoadObjectBmp(obj_id);
                                                }
                                                var obj_bmp = objects_[obj_id];
                                                g.DrawImage(obj_bmp, dst_rect, src_rect, GraphicsUnit.Pixel);
                                            }

                                            if (DesignLabelCB.Checked || (i == 8) || (i == 9))
                                            {
                                                var str = index.ToString();
                                                var fmt = new StringFormat();
                                                fmt.Alignment     = StringAlignment.Center;
                                                fmt.LineAlignment = StringAlignment.Center;
                                                fmt.FormatFlags   = StringFormatFlags.NoWrap;
                                                fmt.Trimming      = StringTrimming.None;
                                                var text_sz   = g.MeasureString(str, fnt);
                                                var text_rect = dst_rect;
                                                text_rect.Width  = (int)text_sz.Width;
                                                text_rect.Height = (int)text_sz.Height;
                                                text_rect.X     += ((32 - text_rect.Width) / 2);
                                                text_rect.Y     += 16 + ((16 - text_rect.Height) / 2);
                                                g.FillRectangle(bkgrnd_brush, text_rect);
                                                g.DrawString(str, fnt, text_brush, text_rect, fmt);
                                            }
                                        }
                                    }
                                }
                    }
                }

                if (MapGridCB.Checked)
                {
                    using (var pen1 = new Pen(Color.Gray))
                        using (var pen2 = new Pen(Color.Gray))
                        {
                            pen1.Width       = 1;
                            pen1.DashPattern = new float[] { 5.0f, 3.0f };
                            pen2.Width       = 1;
                            for (int i = (clipping_rect.X / 16); i < width; ++i)
                            {
                                var x = (16 * i) - clipping_rect.X;
                                var y = (16 * height) - clipping_rect.Y;
                                if ((i % 2) == 0)
                                {
                                    g.DrawLine(pen1, x, -3 - clipping_rect.Y, x, y);
                                }
                                else
                                {
                                    g.DrawLine(pen2, x, 0 - clipping_rect.Y, x, y);
                                }
                            }
                            for (int i = (clipping_rect.Y / 16); i < height; ++i)
                            {
                                var x = (16 * width) - clipping_rect.X;
                                var y = (16 * i) - clipping_rect.Y;
                                if ((i % 2) == 0)
                                {
                                    g.DrawLine(pen1, -3 - clipping_rect.X, y, x, y);
                                }
                                else
                                {
                                    g.DrawLine(pen2, 0 - clipping_rect.X, y, x, y);
                                }
                            }
                        }
                }
            }

            return(bmp);
        }
예제 #41
0
        protected internal void Draw(PaintEventArgs paintEventArgs, DrawTypes drawType)
        {
            paintEventArgs.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;

            if (paintEventArgs != null)
            {
                // If the control is currently Disabled...
                Color borderColor;

                if (!this.Enabled)
                {
                    // Let the user know
                    borderColor     = DisabledBorderColor;
                    checkMarkColor  = DisabledCheckmarkColor;
                    checkBoxColor   = DisabledCheckBoxBackgroundColor;
                    backgroundColor = DisabledBackgroundColor;
                    //separatorColor = DisabledSeparatorColor;
                }
                else
                {
                    // either way...
                    borderColor = BorderColor;
                }

                switch (drawType)
                {
                case DrawTypes.Border:
                    if (confirmed)
                    {
                        if (buttonHasFocus)
                        {
                            using (Pen borderPen = new Pen(ConfirmedBorderColor, BorderThickness))
                            {
                                borderPen.DashStyle = FocusedBorderStyle;

                                paintEventArgs.Graphics.DrawRectangle(
                                    borderPen,
                                    0, 0,
                                    this.Bounds.Width - BorderThickness,
                                    this.Bounds.Height - BorderThickness);
                            }
                        }
                        else
                        {
                            using (Pen borderPen = new Pen(ConfirmedBorderColor, BorderThickness))
                            {
                                borderPen.DashStyle = BorderStyle;

                                paintEventArgs.Graphics.DrawRectangle(
                                    borderPen,
                                    0, 0,
                                    this.Bounds.Width - BorderThickness,
                                    this.Bounds.Height - BorderThickness);
                            }
                        }
                    }
                    else
                    {
                        if (buttonHasFocus)
                        {
                            using (Pen borderPen = new Pen(borderColor, BorderThickness))
                            {
                                borderPen.DashStyle = FocusedBorderStyle;

                                paintEventArgs.Graphics.DrawRectangle(
                                    borderPen,
                                    0, 0,
                                    this.Bounds.Width - BorderThickness,
                                    this.Bounds.Height - BorderThickness);
                            }
                        }
                        else
                        {
                            using (Pen borderPen = new Pen(borderColor, BorderThickness))
                            {
                                borderPen.DashStyle = BorderStyle;

                                paintEventArgs.Graphics.DrawRectangle(
                                    borderPen,
                                    0, 0,
                                    this.Bounds.Width - BorderThickness,
                                    this.Bounds.Height - BorderThickness);
                            }
                        }
                    }
                    break;

                case DrawTypes.Text:
                    TextFormatFlags textFormatFlags = TextFormatFlags.HorizontalCenter
                                                      | TextFormatFlags.VerticalCenter
                                                      | TextFormatFlags.EndEllipsis;

                    if (RequiresConfirmation)
                    {
                        TextRenderer.DrawText(
                            paintEventArgs.Graphics,
                            this.Text, this.Font,
                            new Rectangle(
                                SeparatorDistance, 0,
                                this.Bounds.Width - SeparatorDistance, this.Bounds.Height),
                            this.ForeColor,
                            textFormatFlags);
                    }
                    else
                    {
                        TextRenderer.DrawText(
                            paintEventArgs.Graphics,
                            this.Text, this.Font,
                            new Rectangle(0, 0,
                                          this.Bounds.Width, this.Bounds.Height),
                            this.ForeColor,
                            textFormatFlags);
                    }
                    break;

                case DrawTypes.Checkmark:
                    Color checkmarkColor;
                    float thickness = 1.0f;

                    if (this.SynchronizeCheckMarkWithBorderSettings)
                    {
                        checkmarkColor = this.BorderColor.IsEmpty ? this.ForeColor : this.BorderColor;
                        thickness      = this.BorderThickness;
                    }
                    else
                    {
                        checkmarkColor = this.CheckmarkColor.IsEmpty ? this.ForeColor : this.CheckmarkColor;
                        thickness      = CheckmarkThickness;
                    }

                    if (confirmed)
                    {
                        checkmarkColor = ConfirmedCheckmarkColor;
                        thickness      = CheckmarkThickness;
                    }

                    if (!this.Enabled)
                    {
                        checkmarkColor = DisabledCheckmarkColor;
                    }

                    paintEventArgs.Graphics.DrawLine(
                        new Pen(
                            checkmarkColor,
                            thickness),
                        7, 15, 11, 18);
                    paintEventArgs.Graphics.DrawLine(
                        new Pen(
                            checkmarkColor,
                            thickness),
                        11, 18, 18, 10);

                    checkmarkColor = Color.Empty;
                    thickness      = 1.0f;
                    break;

                case DrawTypes.Image:
                    break;

                case DrawTypes.Separator:
                    if (confirmed)
                    {
                        paintEventArgs.Graphics.DrawLine(
                            new Pen(
                                ConfirmedBorderColor,
                                BorderThickness
                                ),
                            SeparatorDistance,
                            0,
                            SeparatorDistance,
                            this.Bounds.Height
                            );
                    }
                    else
                    {
                        separatorColor = this.Enabled ? BorderColor : DisabledSeparatorColor;
                        paintEventArgs.Graphics.DrawLine(
                            new Pen(
                                separatorColor,
                                BorderThickness
                                ),
                            SeparatorDistance,
                            0,
                            SeparatorDistance,
                            this.Bounds.Height
                            );
                    }
                    break;

                case DrawTypes.CheckBoxFiller:
                    Color color;
                    if (StyleButtonSeparately)
                    {
                        if (mouseHasEntered)
                        {
                            color = CheckboxHighlightColor;
                        }
                        else if (mouseButtonIsDown)
                        {
                            color = CheckboxActiveColor;
                        }
                        else
                        {
                            color = CheckboxBackgroundColor;
                        }

                        if (!this.Enabled && !confirmed)
                        {
                            color = DisabledCheckBoxBackgroundColor;
                        }

                        using (SolidBrush brush = new SolidBrush(color))
                        {
                            paintEventArgs.Graphics.FillRectangle(
                                brush,
                                0,
                                0,
                                SeparatorDistance,
                                (this.Bounds.Height - 1)
                                );
                        }
                    }

                    if (shouldFillCheckBoxArea)
                    {
                        color = this.Enabled ? ActiveColor : DisabledCheckBoxBackgroundColor;

                        using (SolidBrush brush = new SolidBrush(color))
                        {
                            paintEventArgs.Graphics.FillRectangle(
                                brush,
                                0,
                                0,
                                SeparatorDistance,
                                this.Bounds.Height
                                );
                        }

                        shouldFillCheckBoxArea = false;
                    }

                    if (RequiresConfirmation && confirmed)
                    {
                        if (!ConfirmedCheckBoxBackgroundColor.IsEmpty)
                        {
                            using (SolidBrush brush = new SolidBrush(ConfirmedCheckBoxBackgroundColor))
                            {
                                paintEventArgs.Graphics.FillRectangle(
                                    brush,
                                    0,
                                    0,
                                    SeparatorDistance,
                                    this.Bounds.Height
                                    );
                            }
                        }
                    }
                    break;

                case DrawTypes.TexturedBackground:
                    if (BackgroundTexture != null)
                    {
                        // Create a mapping of all image layout types to functions that generate rectangles for that type
                        Dictionary <ImageLayout, Func <Rectangle> > LayoutMap = new Dictionary <ImageLayout, Func <Rectangle> >()
                        {
                            {
                                ImageLayout.None,
                                () => new Rectangle(
                                    new Point(
                                        (int)BorderThickness,
                                        (int)BorderThickness),
                                    new Size(
                                        BackgroundTexture.Width,
                                        BackgroundTexture.Height
                                        )
                                    )
                            },
                            {
                                ImageLayout.Stretch,
                                () => new Rectangle(
                                    new Point(
                                        (int)BorderThickness,
                                        (int)BorderThickness),
                                    new Size(
                                        (Width - (int)BorderThickness),
                                        (Height - (int)BorderThickness)
                                        )
                                    )
                            },
                            {
                                ImageLayout.Tile,
                                () => new Rectangle(
                                    new Point(
                                        (int)BorderThickness,
                                        (int)BorderThickness),
                                    new Size(
                                        (Width - (int)BorderThickness),
                                        (Height - (int)BorderThickness)
                                        )
                                    )
                            },
                            {
                                ImageLayout.Zoom,
                                () =>
                                {
                                    throw new NotImplementedException("Zoom is not yet supported for the confirmation button.");
                                }
                            },
                            {
                                ImageLayout.Center,
                                () =>
                                {
                                    int xLocation = (Width / 2) - (BackgroundTexture.Width / 2) - ((int)BorderThickness * 2);
                                    int yLocation = (Height / 2) - (BackgroundTexture.Height / 2) - ((int)BorderThickness * 2);

                                    return(new Rectangle(
                                               new Point(xLocation, yLocation),
                                               new Size(
                                                   BackgroundTexture.Width,
                                                   BackgroundTexture.Height)
                                               ));
                                }
                            }
                        };

                        // Attempt to get a rectangle generating function from the dictionary defined above.
                        // Because the ImageLayout type is an enum, we don't need a default case (as the default case will be ImageLayout.None)
                        Func <Rectangle> GenerateLayout;
                        if (LayoutMap.TryGetValue(BackgroundTextureLayout, out GenerateLayout))
                        {
                            // If the layout mode is anything other than tile, just draw the image:
                            if (BackgroundTextureLayout != ImageLayout.Tile)
                            {
                                using (TextureBrush textureBrush = new TextureBrush(BackgroundTexture))
                                {
                                    paintEventArgs.Graphics.DrawImage(textureBrush.Image, GenerateLayout());
                                }
                            }
                            // Otherwise, use a tiling brush and fill the rectangle with the texture
                            else
                            {
                                using (TextureBrush textureBrush = new TextureBrush(BackgroundTexture, WrapMode.Tile))
                                {
                                    paintEventArgs.Graphics.FillRectangle(textureBrush, GenerateLayout());
                                }
                            }
                        }
                    }
                    break;
                }
            }
        }
예제 #42
0
파일: GDI.cs 프로젝트: ChrisMoreton/Test3
		/// <summary>
		/// Creates and returns a new brush,
		/// given its string representation.
		/// </summary>
		public static Brush Deserialize(string image)
		{
			Brush brush = null;

			int semicolon = image.IndexOf(";");
			if (semicolon == -1)
				return null;

			string code = image.Substring(0, semicolon);
			string representation = image.Substring(semicolon + 1);

			switch (code)
			{

				case "solid":
					brush = new SolidBrush(Color.Black);
					break;

				case "hatch":
					brush = new HatchBrush(HatchStyle.Cross, Color.Black);
					break;

				case "gradient":
					brush = new LinearGradientBrush(Color.Black, Color.Black);
					break;

				case "texture":
					brush = new TextureBrush((Image)null);
					break;

			}

			if (brush == null)
				return null;

			brush.Restore(representation);

			return brush;
		}
예제 #43
0
        protected override void OnCellPainting(DataGridViewCellPaintingEventArgs e)
        {
            try
            {
                #region  含合并列标题背景
                if (e.RowIndex == -1)
                {
                    if (!this.SpanRows.ContainsKey(e.ColumnIndex))
                    {
                        int X = e.CellBounds.X;
                        int Y = e.CellBounds.Y;
                        int W = e.CellBounds.Width;
                        int H = e.CellBounds.Height;

                        using (Pen blackPen = new Pen(Color.FromArgb(221, 221, 221)))                 //(163, 192, 232)))//边框颜色
                        {
                            Image image = ServiceStationClient.Skin.Properties.Resources.DataGrid_Bg; //_GV_Title;//背景图片
                            using (TextureBrush tBrush = new TextureBrush(image))
                            {
                                e.Graphics.FillRectangle(tBrush, new Rectangle(X, Y, W, H));
                            }
                            if (e.ColumnIndex == 0)
                            {
                                e.Graphics.DrawRectangle(blackPen, new Rectangle(X, Y + 1, W - 1, H - 2));
                            }
                            else
                            {
                                e.Graphics.DrawRectangle(blackPen, new Rectangle(X - 1, Y + 1, W, H - 2));
                            }
                            e.PaintContent(e.CellBounds);
                            e.Handled = true;
                        }
                    }
                }
                #endregion
                #region 合并列标题背景
                if (((e.RowIndex <= -1) || (e.ColumnIndex <= -1)) && ((e.RowIndex == -1) && this.SpanRows.ContainsKey(e.ColumnIndex)))
                {
                    Graphics graphics = e.Graphics;
                    e.Paint(e.CellBounds, DataGridViewPaintParts.Border | DataGridViewPaintParts.Background);
                    int left   = e.CellBounds.Left;
                    int y      = e.CellBounds.Top + 2;
                    int right  = e.CellBounds.Right;
                    int bottom = e.CellBounds.Bottom;
                    switch (this.SpanRows[e.ColumnIndex].Position)
                    {
                    case 1:
                        left += 2;
                        break;

                    case 3:
                        right -= 2;
                        break;
                    }
                    Image image = ServiceStationClient.Skin.Properties.Resources.DataGrid_Bg;//_GV_Title;//背景图片
                    using (TextureBrush tBrush = new TextureBrush(image))
                    {
                        graphics.FillRectangle(tBrush, new Rectangle(left, y, right - left, (bottom - y) / 2));
                        graphics.FillRectangle(tBrush, new Rectangle(left, y, right - left, (bottom - y)));
                    }
                    using (Pen blackPen = new Pen(Color.FromArgb(221, 221, 221))) //(163, 192, 232)))//边框颜色
                    {
                        e.Graphics.DrawRectangle(blackPen, new Rectangle(left - 1, y + (bottom - y) / 2, right - left, (bottom - y) / 2));
                    }
                    //graphics.FillRectangle(new SolidBrush(this._mergecolumnheaderbackcolor), left, y, right - left, (bottom - y) / 2);
                    graphics.DrawLine(new Pen(base.GridColor), left, (y + bottom) / 2, right, (y + bottom) / 2);
                    StringFormat format = new StringFormat
                    {
                        Alignment     = StringAlignment.Center,
                        LineAlignment = StringAlignment.Center
                    };
                    //graphics.DrawString("",e.CellStyle.Font,Brushes.Black,
                    graphics.DrawString(e.Value.ToString(), e.CellStyle.Font, Brushes.Black, new RectangleF(left, (y + bottom) / 2, right - left, (bottom - y) / 2), format);
                    left = base.GetColumnDisplayRectangle(this.SpanRows[e.ColumnIndex].Left, true).Left - 2;
                    if (left < 0)
                    {
                        left = base.GetCellDisplayRectangle(-1, -1, true).Width;
                    }
                    right = base.GetColumnDisplayRectangle(this.SpanRows[e.ColumnIndex].Right, true).Right - 2;
                    if (right < 0)
                    {
                        right = base.Width;
                    }
                    graphics.DrawString(this.SpanRows[e.ColumnIndex].Text, e.CellStyle.Font, Brushes.Black, new Rectangle(left, y, right - left, (bottom - y) / 2), format);

                    e.Handled = true;
                }
                base.OnCellPainting(e);
                #endregion
            }
            catch
            {
            }
        }
예제 #44
0
 private void loadBrush(int index)
 {
     brushTexture = s_BrushTextures[index];
     if (currentTextureBrush != null)
         currentTextureBrush.Dispose();
     currentTextureBrush = new TextureBrush();
     currentTextureBrush.Load(brushTexture,64);
 }
예제 #45
0
        /// <summary>
        /// Gets a <see cref="Brush"/> representing the current paint server.
        /// </summary>
        /// <param name="renderingElement">The owner <see cref="SvgVisualElement"/>.</param>
        /// <param name="renderer">The renderer object.</param>
        /// <param name="opacity">The opacity of the brush.</param>
        /// <param name="forStroke">Not used.</param>
        public override Brush GetBrush(SvgVisualElement renderingElement, ISvgRenderer renderer, float opacity, bool forStroke = false)
        {
            var chain = new List <SvgPatternServer>();

            var curr = this;

            do
            {
                chain.Add(curr);
                curr = SvgDeferredPaintServer.TryGet <SvgPatternServer>(curr.InheritGradient, renderingElement);
            } while (curr != null);

            var firstChildren = chain.Where(p => p.Children.Count > 0).FirstOrDefault();

            if (firstChildren == null)
            {
                return(null);
            }
            var firstX      = chain.Where(p => p.X != null && p.X != SvgUnit.None).FirstOrDefault();
            var firstY      = chain.Where(p => p.Y != null && p.Y != SvgUnit.None).FirstOrDefault();
            var firstWidth  = chain.Where(p => p.Width != null && p.Width != SvgUnit.None).FirstOrDefault();
            var firstHeight = chain.Where(p => p.Height != null && p.Height != SvgUnit.None).FirstOrDefault();

            if (firstWidth == null || firstHeight == null)
            {
                return(null);
            }
            var firstPatternUnit        = chain.Where(p => p._patternUnits.HasValue).FirstOrDefault();
            var firstPatternContentUnit = chain.Where(p => p._patternContentUnits.HasValue).FirstOrDefault();
            var firstViewBox            = chain.Where(p => p.ViewBox != null && p.ViewBox != SvgViewBox.Empty).FirstOrDefault();

            var xUnit      = firstX == null ? new SvgUnit(0f) : firstX.X;
            var yUnit      = firstY == null ? new SvgUnit(0f) : firstY.Y;
            var widthUnit  = firstWidth.Width;
            var heightUnit = firstHeight.Height;

            var patternUnits        = firstPatternUnit == null ? SvgCoordinateUnits.ObjectBoundingBox : firstPatternUnit.PatternUnits;
            var patternContentUnits = firstPatternContentUnit == null ? SvgCoordinateUnits.UserSpaceOnUse : firstPatternContentUnit.PatternContentUnits;
            var viewBox             = firstViewBox == null ? SvgViewBox.Empty : firstViewBox.ViewBox;

            var isPatternObjectBoundingBox = patternUnits == SvgCoordinateUnits.ObjectBoundingBox;

            try
            {
                if (isPatternObjectBoundingBox)
                {
                    renderer.SetBoundable(renderingElement);
                }

                var x      = xUnit.ToDeviceValue(renderer, UnitRenderingType.Horizontal, this);
                var y      = yUnit.ToDeviceValue(renderer, UnitRenderingType.Vertical, this);
                var width  = widthUnit.ToDeviceValue(renderer, UnitRenderingType.Horizontal, this);
                var height = heightUnit.ToDeviceValue(renderer, UnitRenderingType.Vertical, this);

                if (isPatternObjectBoundingBox)
                {
                    var bounds = renderer.GetBoundable().Bounds;    // Boundary without stroke is expect...

                    if (xUnit.Type != SvgUnitType.Percentage)
                    {
                        x *= bounds.Width;
                    }
                    if (yUnit.Type != SvgUnitType.Percentage)
                    {
                        y *= bounds.Height;
                    }
                    if (widthUnit.Type != SvgUnitType.Percentage)
                    {
                        width *= bounds.Width;
                    }
                    if (heightUnit.Type != SvgUnitType.Percentage)
                    {
                        height *= bounds.Height;
                    }
                    x += bounds.X;
                    y += bounds.Y;
                }

                var tile = new Bitmap((int)Math.Ceiling(width), (int)Math.Ceiling(height));
                using (var tileRenderer = SvgRenderer.FromImage(tile))
                {
                    tileRenderer.SetBoundable(renderingElement);
                    if (viewBox != SvgViewBox.Empty)
                    {
                        var bounds = tileRenderer.GetBoundable().Bounds;
                        tileRenderer.ScaleTransform(width / viewBox.Width, height / viewBox.Height);
                    }
                    else if (patternContentUnits == SvgCoordinateUnits.ObjectBoundingBox)
                    {
                        var bounds = tileRenderer.GetBoundable().Bounds;
                        tileRenderer.ScaleTransform(bounds.Width, bounds.Height);
                    }

                    foreach (var child in firstChildren.Children)
                    {
                        child.RenderElement(tileRenderer);
                    }
                }

                using (var transform = EffectivePatternTransform)
                {
                    var textureBrush = new TextureBrush(tile, new RectangleF(0f, 0f, width, height))
                    {
                        Transform = transform
                    };
                    textureBrush.TranslateTransform(x, y);
                    return(textureBrush);
                }
            }
            finally
            {
                if (isPatternObjectBoundingBox)
                {
                    renderer.PopBoundable();
                }
            }
        }
예제 #46
0
		public void SetTransform (TextureBrush widget, IMatrix transform)
		{
			((sd.TextureBrush)widget.ControlObject).Transform = transform.ToSD ();
		}
예제 #47
0
        // Must be called before show form
        public void Prepare(Image img)
        {
            Image = img;

            if (Mode == RegionCaptureMode.Editor)
            {
                Rectangle rect = CaptureHelpers.GetActiveScreenBounds0Based();

                if (Image.Width > rect.Width || Image.Height > rect.Height)
                {
                    rect = ScreenRectangle0Based;
                }

                ImageRectangle = new Rectangle(rect.X + rect.Width / 2 - Image.Width / 2, rect.Y + rect.Height / 2 - Image.Height / 2, Image.Width, Image.Height);

                using (Image background = ImageHelpers.DrawCheckers(ScreenRectangle0Based.Width, ScreenRectangle0Based.Height))
                    using (Graphics g = Graphics.FromImage(background))
                    {
                        g.DrawImage(Image, ImageRectangle);

                        backgroundBrush = new TextureBrush(background)
                        {
                            WrapMode = WrapMode.Clamp
                        };
                    }
            }
            else if (Config.UseDimming)
            {
                using (Bitmap darkBackground = (Bitmap)Image.Clone())
                    using (Graphics g = Graphics.FromImage(darkBackground))
                        using (Brush brush = new SolidBrush(Color.FromArgb(30, Color.Black)))
                        {
                            g.FillRectangle(brush, 0, 0, darkBackground.Width, darkBackground.Height);

                            backgroundBrush = new TextureBrush(darkBackground)
                            {
                                WrapMode = WrapMode.Clamp
                            };
                        }

                backgroundHighlightBrush = new TextureBrush(Image)
                {
                    WrapMode = WrapMode.Clamp
                };
            }
            else
            {
                backgroundBrush = new TextureBrush(Image)
                {
                    WrapMode = WrapMode.Clamp
                };
            }

            ShapeManager = new ShapeManager(this);
            ShapeManager.WindowCaptureMode = Config.DetectWindows;
            ShapeManager.IncludeControls   = Config.DetectControls;

            if (Mode == RegionCaptureMode.OneClick || ShapeManager.WindowCaptureMode)
            {
                IntPtr handle = Handle;

                TaskEx.Run(() =>
                {
                    WindowsRectangleList wla = new WindowsRectangleList();
                    wla.IgnoreHandle         = handle;
                    wla.IncludeChildWindows  = ShapeManager.IncludeControls;
                    ShapeManager.Windows     = wla.GetWindowInfoListAsync(5000);
                });
            }

            if (Config.UseCustomInfoText || Mode == RegionCaptureMode.ScreenColorPicker)
            {
                bmpBackgroundImage = new Bitmap(Image);
            }
        }
예제 #48
0
        /*
         * public override void RenderObject()
         * {
         *  Thread thread = new Thread(new ThreadStart(ExRenderObject));
         *  thread.Start();
         *
         * }
         */

        public override void RenderObject()
        {
            Size   realObjectSize;
            double xOffset, yOffset;

            if (!SizeInPercent)
            {
                realObjectSize = new Size((int)Width, (int)Height);
            }
            else
            {
                realObjectSize = new Size((int)((float)Paper.Width * Width / 100.0f),
                                          (int)((float)Paper.Height * Height / 100.0f));
            }

            // Limit Size to a minimum of 1
            realObjectSize = realObjectSize.Max(1);

            Bitmap c = new Bitmap(realObjectSize.Width, realObjectSize.Height);
            Bitmap i = new Bitmap(Resources.Get(ResourceID));

            Graphics g = Graphics.FromImage(c);

            if (IsVertical)
            {
                i.RotateFlip(RotateFlipType.Rotate90FlipNone);
            }

            if (IsTurned180)
            {
                i.RotateFlip(RotateFlipType.Rotate180FlipNone);
            }

            switch (drawingType)
            {
            case DrawingTypes.Tiles:
                using (TextureBrush brush = new TextureBrush(i, WrapMode.Tile))
                {
                    g.FillRectangle(brush, 0, 0, realObjectSize.Width, realObjectSize.Height);
                }
                break;

            case DrawingTypes.Stretch:

                g.DrawImage(i, 0, 0, realObjectSize.Width, realObjectSize.Height);
                break;

            case DrawingTypes.Center:

                xOffset = (double)(c.Width - i.Width) / 2.0d;
                yOffset = (double)(c.Height - i.Height) / 2.0d;

                g.DrawImage(i, (int)xOffset, (int)yOffset, i.Width, i.Height);

                break;

            case DrawingTypes.Zoom:

                Size newSize;

                double cRatio = (double)c.Width / c.Height;
                double iRatio = (double)i.Width / i.Height;

                if (cRatio > iRatio)
                {
                    newSize = new Size((int)(i.Width * ((double)c.Height / i.Height)), c.Height);
                }
                else
                {
                    newSize = new Size(c.Width, (int)(i.Height * ((double)c.Width / i.Width)));
                }

                xOffset = (double)(c.Width - newSize.Width) / 2.0d;
                yOffset = (double)(c.Height - newSize.Height) / 2.0d;

                g.DrawImage(i, (int)xOffset, (int)yOffset, newSize.Width, newSize.Height);

                break;

            default:
                break;
            }

            // To prevent bitmap-ception, anchors will be off when zooming in/out for ImageObjects
            // After thinking I left the anchors to be shown even if zoomed but they become blurry (whatever) :/
            // Draw the anchor point for this label
            //
            Point anchor = new Point(0, 0);

            if (Config.ShowAnchorPoints /*&& Zoom.currentAppliedZoom == 100*/)
            {
                // Reset rotation for anchors (only if show [Optimisation :3])
                g.ResetTransform();

                if (IsCenter())
                {
                    anchor.X = (int)(c.Width * 0.5F);
                }
                if (IsRight())
                {
                    anchor.X = (int)c.Width - 1;
                }

                if (IsMiddle())
                {
                    anchor.Y = (int)(c.Height * 0.5F);
                }
                if (IsDown())
                {
                    anchor.Y = (int)c.Height - 1;
                }

                g.DrawLine(Config.AnchorPen, anchor.X - Config.ANCHOR_SIZE, anchor.Y, anchor.X + Config.ANCHOR_SIZE, anchor.Y);
                g.DrawLine(Config.AnchorPen, anchor.X, anchor.Y - Config.ANCHOR_SIZE, anchor.X, anchor.Y + Config.ANCHOR_SIZE);
            }

            // Release previous rendered bitmap (A lil bit of memore'h :3)
            if (Holder.Image != null)
            {
                Holder.Image.Dispose();
            }



            // Dispose of the copy
            i.Dispose();

            Holder.Image = c;
            Holder.Size  = Zoom.Calculate(realObjectSize);

            base.RenderObject();
        }
예제 #49
0
        private static Bitmap CutImage(ObjectReader texture2DAsset, RectangleF textureRect, Sprite m_Sprite, SpriteSettings settingsRaw)
        {
            var texture2D     = new Texture2DConverter(new Texture2D(texture2DAsset, true));
            var originalImage = texture2D.ConvertToBitmap(false);

            if (originalImage != null)
            {
                using (originalImage)
                {
                    var spriteImage = originalImage.Clone(textureRect, PixelFormat.Format32bppArgb);

                    //RotateAndFlip
                    switch (settingsRaw.packingRotation)
                    {
                    case SpritePackingRotation.kSPRFlipHorizontal:
                        spriteImage.RotateFlip(RotateFlipType.RotateNoneFlipX);
                        break;

                    case SpritePackingRotation.kSPRFlipVertical:
                        spriteImage.RotateFlip(RotateFlipType.RotateNoneFlipY);
                        break;

                    case SpritePackingRotation.kSPRRotate180:
                        spriteImage.RotateFlip(RotateFlipType.Rotate180FlipNone);
                        break;

                    case SpritePackingRotation.kSPRRotate90:
                        spriteImage.RotateFlip(RotateFlipType.Rotate270FlipNone);
                        break;
                    }

                    /* TODO Tight
                     * 2017之前没有PhysicsShape
                     * 5.6之前使用vertices
                     * 5.6需要使用VertexData
                     */
                    if (settingsRaw.packingMode == SpritePackingMode.kSPMTight && m_Sprite.m_PhysicsShape?.Length > 0) //Tight
                    {
                        try
                        {
                            using (var brush = new TextureBrush(spriteImage))
                            {
                                using (var path = new GraphicsPath())
                                {
                                    foreach (var p in m_Sprite.m_PhysicsShape)
                                    {
                                        path.AddPolygon(p);
                                    }
                                    using (var matr = new Matrix())
                                    {
                                        matr.Translate(m_Sprite.m_Rect.Width * m_Sprite.m_Pivot.X, m_Sprite.m_Rect.Height * m_Sprite.m_Pivot.Y);
                                        matr.Scale(m_Sprite.m_PixelsToUnits, m_Sprite.m_PixelsToUnits);
                                        path.Transform(matr);
                                        var bitmap = new Bitmap((int)textureRect.Width, (int)textureRect.Height);
                                        using (var graphic = Graphics.FromImage(bitmap))
                                        {
                                            graphic.FillPath(brush, path);
                                            bitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);
                                            return(bitmap);
                                        }
                                    }
                                }
                            }
                        }
                        catch
                        {
                            spriteImage = originalImage.Clone(textureRect, PixelFormat.Format32bppArgb);
                            spriteImage.RotateFlip(RotateFlipType.RotateNoneFlipY);
                            return(spriteImage);
                        }
                    }

                    //Rectangle
                    spriteImage.RotateFlip(RotateFlipType.RotateNoneFlipY);
                    return(spriteImage);
                }
            }

            return(null);
        }
예제 #50
0
 protected void SetDefaultBackground()
 {
     Background = new TextureBrush(assets.LoadTexture(typeof(ScreenComponent), "background_new"), TextureBrushMode.Stretch);
 }
	// Create a texture brush.
	public IToolkitBrush CreateTextureBrush
		(TextureBrush properties, IToolkitImage image,
		RectangleF dstRect, ImageAttributes imageAttr)
	{
		return new DrawingTextureBrush
			(this, properties, image, dstRect, imageAttr);
	}