Ejemplo n.º 1
0
        public static void RenderGradientOnPattern(Endogine.Interpolation.InterpolatorColor interpol, Endogine.BitmapHelpers.Canvas canvas)
        {
            Graphics g = canvas.GetGraphics();

            BackgroundPattern.Fill(g);

            Bitmap bmp = new Bitmap(255, 1, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

            Endogine.BitmapHelpers.Canvas c2 = Endogine.BitmapHelpers.Canvas.Create(bmp);
            RenderGradient(interpol, c2);
            g.InterpolationMode = InterpolationMode.NearestNeighbor;
            g.DrawImage(bmp, new Rectangle(0, 0, canvas.Width, canvas.Height * 2));
        }
Ejemplo n.º 2
0
        private void Redraw()
        {
            if (this._colorObject != null)
            {
                Graphics g = Graphics.FromImage(this.BackgroundImage);
                BackgroundPattern.Fill(g);

                Rectangle rct = new Rectangle(0, 0, this.Width, this.Height); // - 1, this.Height - 1);

                Color clr = this._colorObject.ColorRGBA;
                //clr = Color.FromArgb(30, clr.R, clr.G, clr.B);
                g.FillRectangle(new SolidBrush(clr), rct);

                clr = Color.FromArgb(255, clr.R, clr.G, clr.B);
                g.FillPolygon(new SolidBrush(clr), new Point[] { new Point(rct.X, rct.Y), new Point(rct.Right, rct.Y), new Point(rct.Right, rct.Bottom) });

                this.Invalidate();
            }
        }
Ejemplo n.º 3
0
        private void RenderGradient()
        {
            Bitmap bmp = new Bitmap(255, 1, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

            Endogine.BitmapHelpers.Canvas canvas = Endogine.BitmapHelpers.Canvas.Create(bmp);

            Endogine.Interpolation.InterpolatorColor interpol = GetInterpolator();

            RenderGradient(interpol, canvas);

            if (this._bmpBg == null)
            {
                this._bmpBg = new Bitmap(this.panel1.Width, this.panel1.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
                this.panel1.BackgroundImage = this._bmpBg;
            }
            Graphics g = Graphics.FromImage(this._bmpBg);

            BackgroundPattern.Fill(g);
            g.InterpolationMode = InterpolationMode.NearestNeighbor;
            g.DrawImage(bmp, new Rectangle(0, 0, this._bmpBg.Width, this._bmpBg.Height * 2));

            //ColorBlend blend = this.ColorBlend;
            //GraphicsPath path = new GraphicsPath();
            ////path.AddRectangle(new RectangleF(0, 0, bmp.Width, bmp.Height));
            //path.AddLine(0, 0, bmp.Width, 0);
            //PathGradientBrush pthGrBrush = new PathGradientBrush(path);
            //pthGrBrush.InterpolationColors = blend;

            //g.FillRectangle(pthGrBrush, 0, 0, bmp.Width, bmp.Height);
            this.panel1.Invalidate();

            if (this.GradientChanged != null)
            {
                GradientChanged(this, null);
            }
        }