Ejemplo n.º 1
0
            private void FillBuffer()
            {
                ColorHLS[] colors = new ColorHLS[0];

                switch (_colorMode)
                {
                default:
                case ColorSliderMode.Hue:
                    colors = ColorUtils.CreateGradientColorArray(
                        new ColorHLS[]
                    {
                        new ColorHLS(255, 255, 0, 0),
                        new ColorHLS(255, 255, 255, 0),
                        new ColorHLS(255, 0, 255, 0),
                        new ColorHLS(255, 0, 255, 255),
                        new ColorHLS(255, 0, 0, 255),
                        new ColorHLS(255, 255, 0, 255),
                        new ColorHLS(255, 255, 0, 0)
                    },
                        256
                        );
                    break;

                case ColorSliderMode.Saturation:
                    colors = ColorUtils.CreateGradientColorArray(
                        new ColorHLS[]
                    {
                        new ColorHLS(255, 255, 255, 255),
                        _baseColor
                    },
                        256
                        );
                    break;

                case ColorSliderMode.Brightness:
                    colors = ColorUtils.CreateGradientColorArray(
                        new ColorHLS[]
                    {
                        new ColorHLS(255, 0, 0, 0),
                        _baseColor
                    },
                        256
                        );
                    break;
                }

                //ColorHLS[] colors = ColorUtils.CreateGradientColorArray(new ColorHLS(255,255, 0, 0), new ColorHLS(255,255, 255, 0), 256);
                for (int y = 0; y < this.Height; y++)
                {
                    _pixBuffer.DrawLine(0, this.Height - 1 - y, this.Width, this.Height - 1 - y, colors[y]);
                }
            }
Ejemplo n.º 2
0
            private void FillBuffer()
            {
                ColorHLS startColor = new ColorHLS(255, 255, 255, 255);
                ColorHLS endColor   = _baseColor.Clone();

                float[,] colorsStepStart = ColorUtils.GetGradientColorSteps(startColor, new ColorHLS(255, 0, 0, 0), 256);
                float[,] colorsStepEnd   = ColorUtils.GetGradientColorSteps(endColor, new ColorHLS(255, 0, 0, 0), 256);

                for (int i = 0; i < 256; i++)
                {
                    startColor.SetRGB((byte)colorsStepStart[i, 0], (byte)colorsStepStart[i, 1], (byte)colorsStepStart[i, 2]);
                    endColor.SetRGB((byte)colorsStepEnd[i, 0], (byte)colorsStepEnd[i, 1], (byte)colorsStepEnd[i, 2]);
                    _pixBuffer.DrawLine(0, i, 256, i, startColor, endColor);
                }
            }
Ejemplo n.º 3
0
        private void FillBuffer()
        {
            ColorHLS[] colors = new ColorHLS[0];

            switch (_colorMode)
            {
            default:
            case ColorSliderMode.Hue:
                colors = ColorUtils.CreateGradientColorArray(
                    new ColorHLS[]
                {
                    new ColorHLS(255, 255, 0, 0),
                    new ColorHLS(255, 255, 255, 0),
                    new ColorHLS(255, 0, 255, 0),
                    new ColorHLS(255, 0, 255, 255),
                    new ColorHLS(255, 0, 0, 255),
                    new ColorHLS(255, 255, 0, 255),
                    new ColorHLS(255, 255, 0, 0)
                },
                    256
                    );
                break;

            case ColorSliderMode.Saturation:
                colors = ColorUtils.CreateGradientColorArray(
                    new ColorHLS[]
                {
                    new ColorHLS(255, 255, 255, 255),
                    _baseColor
                },
                    256
                    );
                break;

            case ColorSliderMode.Luminance:
                colors = ColorUtils.CreateGradientColorArray(
                    new ColorHLS[]
                {
                    new ColorHLS(255, 0, 0, 0),
                    _baseColor
                },
                    256
                    );
                break;
            }

            if (_orientation == ColorSliderOrientation.Vertical)
            {
                //ColorHLS[] colors = ColorUtils.CreateGradientColorArray(new ColorHLS(255,255, 0, 0), new ColorHLS(255,255, 255, 0), 256);
                for (int y = 0; y < this.Height; y++)
                {
                    _pixBuffer.DrawLine(0, this.Height - 1 - y, this.Width, this.Height - 1 - y, colors[y]);
                }
            }
            else
            {
                for (int x = 0; x < this.Width; x++)
                {
                    _pixBuffer.DrawLine(x, 0, x, this.Height, colors[x]);
                }
            }
        }