Exemplo n.º 1
0
        protected override void DrawHSBSaturation()
        {
            using (Graphics g = Graphics.FromImage(bmp))
            {
                HSB start = new HSB((int)SelectedColor.hsb.Hue360, 100, (int)SelectedColor.hsb.Brightness100, SelectedColor.argb.A);
                HSB end   = new HSB((int)SelectedColor.hsb.Hue360, 0, (int)SelectedColor.hsb.Brightness100, SelectedColor.argb.A);

                using (LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, clientWidth, clientHeight), start, end, LinearGradientMode.Vertical))
                {
                    g.FillRectangle(brush, new Rectangle(0, 0, clientWidth, clientHeight));
                }
            }
        }
Exemplo n.º 2
0
        protected override void DrawHSBHue()
        {
            using (Graphics g = Graphics.FromImage(bmp))
            {
                HSB color = new HSB(0, 100, 100, SelectedColor.argb.A);

                for (int y = 0; y < clientHeight; y++)
                {
                    color.Hue = (float)(1.0 - ((double)y / clientHeight));

                    using (Pen pen = new Pen(color))
                    {
                        g.DrawLine(pen, 0, y, clientWidth, y);
                    }
                }
            }
        }
Exemplo n.º 3
0
        // slider controls brightness
        // x = hue 0 -> 360
        // y = saturation 100 -> 0
        protected override void DrawHSBBrightness()
        {
            using (Graphics g = Graphics.FromImage(bmp))
            {
                HSB start = new HSB(0, 100, (int)selectedColor.hsb.Brightness100, selectedColor.argb.A);
                HSB end   = new HSB(0, 0, (int)selectedColor.hsb.Brightness100, selectedColor.argb.A);

                for (int x = 0; x < clientWidth; x++)
                {
                    start.Hue = end.Hue = (float)((double)x / (clientHeight));

                    using (LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, 1, clientHeight), start, end, LinearGradientMode.Vertical))
                    {
                        g.FillRectangle(brush, new Rectangle(x, 0, 1, clientHeight));
                    }
                }
            }
        }
Exemplo n.º 4
0
        // slider controls hue
        // x = saturation 0 -> 100
        // y = brightness 100 -> 0
        protected override void DrawHSBHue()
        {
            using (Graphics g = Graphics.FromImage(bmp))
            {
                HSB start = new HSB((int)selectedColor.hsb.Hue360, 0, 0, selectedColor.argb.A);
                HSB end   = new HSB((int)selectedColor.hsb.Hue360, 100, 0, selectedColor.argb.A);

                for (int y = 0; y < clientHeight; y++)
                {
                    start.Brightness = end.Brightness = (float)(1.0 - ((double)y / (clientHeight)));

                    using (LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, clientWidth, 1), start, end, LinearGradientMode.Horizontal))
                    {
                        g.FillRectangle(brush, new Rectangle(0, y, clientWidth, 1));
                    }
                }
            }
        }