public static Color ModifyBrightness(Color c, double brightness)
        {
            HSB hsb = RGB.ToHSB(c);

            hsb.Brightness *= brightness;
            return(hsb.ToColor());
        }
        public static Color ModifySaturation(Color c, double Saturation)
        {
            HSB hsb = RGB.ToHSB(c);

            hsb.Saturation *= Saturation;
            return(hsb.ToColor());
        }
        public static Color ModifyHue(Color c, double Hue)
        {
            HSB hsb = RGB.ToHSB(c);

            hsb.Hue *= Hue;
            return(hsb.ToColor());
        }
Exemple #4
0
        // Hue = 0 -> 360
        // Saturation = 100 -> 0
        protected override void DrawBrightness()
        {
            Graphics g     = Graphics.FromImage(bmp);
            HSB      start = new HSB(0.0, 1.0, SetColor.HSB.Brightness);
            HSB      end   = new HSB(0.0, 0.0, SetColor.HSB.Brightness);

            for (int i = 0; i < width; i++)
            {
                start.Hue = end.Hue = (double)i / (height - 1);
                LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, 1, height),
                                                                    start.ToColor(), end.ToColor(), 90, false);
                g.FillRectangle(brush, new Rectangle(i, 0, 1, height));
            }
        }
Exemple #5
0
        // Saturation = 0 -> 100
        // Brightness = 100 -> 0
        protected override void DrawHue()
        {
            Graphics g     = Graphics.FromImage(bmp);
            HSB      start = new HSB(SetColor.HSB.Hue, 0.0, 0.0);
            HSB      end   = new HSB(SetColor.HSB.Hue, 1.0, 0.0);

            for (int i = 0; i < height; i++)
            {
                start.Brightness = end.Brightness = 1.0 - (double)i / (height - 1);
                LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, width, 1),
                                                                    start.ToColor(), end.ToColor(), 0, false);
                g.FillRectangle(brush, new Rectangle(0, i, width, 1));
            }
        }
        // Hue = 0 -> 360
        // Saturation = 100 -> 0
        protected override void DrawBrightness()
        {
            Graphics g = Graphics.FromImage(bmp);
            HSB start = new HSB(0.0, 1.0, SetColor.HSB.Brightness);
            HSB end = new HSB(0.0, 0.0, SetColor.HSB.Brightness);

            for (int i = 0; i < width; i++)
            {
                start.Hue = end.Hue = (double)i / (height - 1);
                LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, 1, height),
                    start.ToColor(), end.ToColor(), 90, false);
                g.FillRectangle(brush, new Rectangle(i, 0, 1, height));
            }
        }
        // Saturation = 0 -> 100
        // Brightness = 100 -> 0
        protected override void DrawHue()
        {
            Graphics g = Graphics.FromImage(bmp);
            HSB start = new HSB(SetColor.HSB.Hue, 0.0, 0.0);
            HSB end = new HSB(SetColor.HSB.Hue, 1.0, 0.0);

            for (int i = 0; i < height; i++)
            {
                start.Brightness = end.Brightness = 1.0 - (double)i / (height - 1);
                LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, width, 1),
                    start.ToColor(), end.ToColor(), 0, false);
                g.FillRectangle(brush, new Rectangle(0, i, width, 1));
            }
        }