Exemplo n.º 1
0
        public void SetupHueSaturationGradient(float brightness = 1.0f, int accuracy = 256)
        {
            ColorBlend blendX = new ColorBlend();

            blendX.Colors = new Color[] {
                ExtMethodsSystemDrawingColor.ColorFromHSV(0.0f, 1.0f, brightness),
                ExtMethodsSystemDrawingColor.ColorFromHSV(1.0f / 6.0f, 1.0f, brightness),
                ExtMethodsSystemDrawingColor.ColorFromHSV(2.0f / 6.0f, 1.0f, brightness),
                ExtMethodsSystemDrawingColor.ColorFromHSV(3.0f / 6.0f, 1.0f, brightness),
                ExtMethodsSystemDrawingColor.ColorFromHSV(4.0f / 6.0f, 1.0f, brightness),
                ExtMethodsSystemDrawingColor.ColorFromHSV(5.0f / 6.0f, 1.0f, brightness),
                ExtMethodsSystemDrawingColor.ColorFromHSV(1.0f, 1.0f, brightness)
            };
            blendX.Positions = new float[] {
                0.0f,
                1.0f / 6.0f,
                2.0f / 6.0f,
                3.0f / 6.0f,
                4.0f / 6.0f,
                5.0f / 6.0f,
                1.0f
            };

            ColorBlend blendY = new ColorBlend();

            blendY.Colors = new Color[] {
                Color.FromArgb((int)Math.Round(255.0f * brightness), (int)Math.Round(255.0f * brightness), (int)Math.Round(255.0f * brightness)),
                Color.Transparent
            };
            blendY.Positions = new float[] {
                0.0f,
                1.0f
            };
            this.SetupXYGradient(blendX, blendY, accuracy);
        }
Exemplo n.º 2
0
        public void SetupHueBrightnessGradient(float saturation = 1.0f, int accuracy = 256)
        {
            ColorBlend blendX = new ColorBlend();

            blendX.Colors = new Color[] {
                ExtMethodsSystemDrawingColor.ColorFromHSV(0.0f, saturation, 1.0f),
                ExtMethodsSystemDrawingColor.ColorFromHSV(1.0f / 6.0f, saturation, 1.0f),
                ExtMethodsSystemDrawingColor.ColorFromHSV(2.0f / 6.0f, saturation, 1.0f),
                ExtMethodsSystemDrawingColor.ColorFromHSV(3.0f / 6.0f, saturation, 1.0f),
                ExtMethodsSystemDrawingColor.ColorFromHSV(4.0f / 6.0f, saturation, 1.0f),
                ExtMethodsSystemDrawingColor.ColorFromHSV(5.0f / 6.0f, saturation, 1.0f),
                ExtMethodsSystemDrawingColor.ColorFromHSV(1.0f, saturation, 1.0f)
            };
            blendX.Positions = new float[] {
                0.0f,
                1.0f / 6.0f,
                2.0f / 6.0f,
                3.0f / 6.0f,
                4.0f / 6.0f,
                5.0f / 6.0f,
                1.0f
            };

            ColorBlend blendY = new ColorBlend();

            blendY.Colors = new Color[] {
                Color.FromArgb(0, 0, 0),
                Color.Transparent
            };
            blendY.Positions = new float[] {
                0.0f,
                1.0f
            };
            this.SetupXYGradient(blendX, blendY, accuracy);
        }
Exemplo n.º 3
0
        private void UpdateColorPanelGradient()
        {
            Color tmp;

            switch (this.primAttrib)
            {
            default:
            case PrimaryAttrib.Hue:
                this.colorPanel.SetupXYGradient(
                    Color.White,
                    ExtMethodsSystemDrawingColor.ColorFromHSV(this.selColor.h, 1.0f, 1.0f),
                    Color.Black,
                    Color.Transparent);
                break;

            case PrimaryAttrib.Saturation:
                this.colorPanel.SetupHueBrightnessGradient(this.selColor.s);
                break;

            case PrimaryAttrib.Brightness:
                this.colorPanel.SetupHueSaturationGradient(this.selColor.v);
                break;

            case PrimaryAttrib.Red:
                tmp = this.selColor.ToColor();
                this.colorPanel.SetupGradient(
                    Color.FromArgb(255, tmp.R, 255, 0),
                    Color.FromArgb(255, tmp.R, 255, 255),
                    Color.FromArgb(255, tmp.R, 0, 0),
                    Color.FromArgb(255, tmp.R, 0, 255),
                    32);
                break;

            case PrimaryAttrib.Green:
                tmp = this.selColor.ToColor();
                this.colorPanel.SetupGradient(
                    Color.FromArgb(255, 255, tmp.G, 0),
                    Color.FromArgb(255, 255, tmp.G, 255),
                    Color.FromArgb(255, 0, tmp.G, 0),
                    Color.FromArgb(255, 0, tmp.G, 255),
                    32);
                break;

            case PrimaryAttrib.Blue:
                tmp = this.selColor.ToColor();
                this.colorPanel.SetupGradient(
                    Color.FromArgb(255, 255, 0, tmp.B),
                    Color.FromArgb(255, 255, 255, tmp.B),
                    Color.FromArgb(255, 0, 0, tmp.B),
                    Color.FromArgb(255, 0, 255, tmp.B),
                    32);
                break;
            }
        }
Exemplo n.º 4
0
        private void UpdateColorSliderGradient()
        {
            Color tmp;

            switch (this.primAttrib)
            {
            default:
            case PrimaryAttrib.Hue:
                this.colorSlider.SetupHueGradient(/*this.selColor.GetHSVSaturation(), this.selColor.GetHSVBrightness()*/);
                break;

            case PrimaryAttrib.Saturation:
                this.colorSlider.SetupGradient(
                    ExtMethodsSystemDrawingColor.ColorFromHSV(this.selColor.h, 0.0f, this.selColor.v),
                    ExtMethodsSystemDrawingColor.ColorFromHSV(this.selColor.h, 1.0f, this.selColor.v));
                break;

            case PrimaryAttrib.Brightness:
                this.colorSlider.SetupGradient(
                    ExtMethodsSystemDrawingColor.ColorFromHSV(this.selColor.h, this.selColor.s, 0.0f),
                    ExtMethodsSystemDrawingColor.ColorFromHSV(this.selColor.h, this.selColor.s, 1.0f));
                break;

            case PrimaryAttrib.Red:
                tmp = this.selColor.ToColor();
                this.colorSlider.SetupGradient(
                    Color.FromArgb(255, 0, tmp.G, tmp.B),
                    Color.FromArgb(255, 255, tmp.G, tmp.B));
                break;

            case PrimaryAttrib.Green:
                tmp = this.selColor.ToColor();
                this.colorSlider.SetupGradient(
                    Color.FromArgb(255, tmp.R, 0, tmp.B),
                    Color.FromArgb(255, tmp.R, 255, tmp.B));
                break;

            case PrimaryAttrib.Blue:
                tmp = this.selColor.ToColor();
                this.colorSlider.SetupGradient(
                    Color.FromArgb(255, tmp.R, tmp.G, 0),
                    Color.FromArgb(255, tmp.R, tmp.G, 255));
                break;
            }
        }
Exemplo n.º 5
0
        public void SetupHueGradient(float saturation = 1.0f, float brightness = 1.0f, int accuracy = 256)
        {
            ColorBlend blend = new ColorBlend();

            blend.Colors = new Color[] {
                ExtMethodsSystemDrawingColor.ColorFromHSV(0.0f, saturation, brightness),
                ExtMethodsSystemDrawingColor.ColorFromHSV(1.0f / 6.0f, saturation, brightness),
                ExtMethodsSystemDrawingColor.ColorFromHSV(2.0f / 6.0f, saturation, brightness),
                ExtMethodsSystemDrawingColor.ColorFromHSV(3.0f / 6.0f, saturation, brightness),
                ExtMethodsSystemDrawingColor.ColorFromHSV(4.0f / 6.0f, saturation, brightness),
                ExtMethodsSystemDrawingColor.ColorFromHSV(5.0f / 6.0f, saturation, brightness),
                ExtMethodsSystemDrawingColor.ColorFromHSV(1.0f, saturation, brightness)
            };
            blend.Positions = new float[] {
                0.0f,
                1.0f / 6.0f,
                2.0f / 6.0f,
                3.0f / 6.0f,
                4.0f / 6.0f,
                5.0f / 6.0f,
                1.0f
            };
            this.SetupGradient(blend, accuracy);
        }
Exemplo n.º 6
0
 public Color ToColor()
 {
     return(Color.FromArgb((int)Math.Round(A * 255.0f), ExtMethodsSystemDrawingColor.ColorFromHSV(H, S, V)));
 }
Exemplo n.º 7
0
 public Color ToColor()
 {
     return(Color.FromArgb((int)Math.Round(this.a * 255.0f), ExtMethodsSystemDrawingColor.ColorFromHSV(this.h, this.s, this.v)));
 }