Ejemplo n.º 1
0
        public ColorChooseControl()
        {
            InitializeComponent();
            _currentColor = new ColorHLS(255, 255, 0, 0);

            lsView.BaseColor         = _currentColor;
            hueView.BaseColor        = _currentColor;
            saturationView.BaseColor = _currentColor;
            luminanceView.BaseColor  = _currentColor;

            hueView.ColorMode        = ColorSliderMode.Hue;
            saturationView.ColorMode = ColorSliderMode.Saturation;
            luminanceView.ColorMode  = ColorSliderMode.Brightness;

            hueView.Value        = 0;
            saturationView.Value = 1;
            luminanceView.Value  = 1;

            lsView.ColorChanged         += new ColorChangedDelegate(lsView_ColorChanged);
            hueView.ColorChanged        += new ColorChangedDelegate(hueView_ColorChanged);
            saturationView.ColorChanged += new ColorChangedDelegate(saturationView_ColorChanged);
            luminanceView.ColorChanged  += new ColorChangedDelegate(luminanceView_ColorChanged);

            lsView.Invalidate();
        }
Ejemplo n.º 2
0
            private void SetValue(float value)
            {
                float y = -3;

                switch (_colorMode)
                {
                default:
                case ColorSliderMode.Hue:
                    value %= 360;
                    y      = 255 - (((value / 359) * 255) + 3);
                    _hue   = value;
                    break;

                case ColorSliderMode.Saturation:
                    if (value < 0 || value > 1)
                    {
                        throw new ArgumentOutOfRangeException("value");
                    }
                    y           = (((1 - value) * 255)) - 3;
                    _saturation = value;
                    break;

                case ColorSliderMode.Brightness:
                    if (value < 0 || value > 1)
                    {
                        throw new ArgumentOutOfRangeException("value");
                    }
                    y          = ((1 - value) * 255) - 3;
                    _luminance = value;
                    break;
                }
                _cursorRect.Y = (int)y;
                _currentColor = GetColorAt(1, _cursorRect.Y + 3);
                this.Invalidate();
            }
Ejemplo n.º 3
0
            private void MouseEvent(MouseEventArgs e)
            {
                Point newPos = new Point(e.X - 4, e.Y - 4);

                if (newPos.X < -4)
                {
                    newPos.X = -4;
                }
                if (newPos.Y < -4)
                {
                    newPos.Y = -4;
                }
                if (newPos.X > (256 - 5))
                {
                    newPos.X = (256 - 5);
                }
                if (newPos.Y > (256 - 5))
                {
                    newPos.Y = (256 - 5);
                }
                _cursorRect.Location = newPos;

                _currentColor = GetColorAt(newPos.X + 4, newPos.Y + 4);

                this.Invalidate();

                if (this.ColorChanged != null)
                {
                    this.ColorChanged(this, new ColorChangedEventArgs(_previusColor, _currentColor));
                }
            }
Ejemplo n.º 4
0
            public ColorSlider(ColorSliderMode colorMode)
            {
                _colorMode = colorMode;

                _baseColor    = new ColorHLS(255, 255, 0, 0);
                _currentColor = _baseColor.Clone();
                _previusColor = _baseColor.Clone();

                this.SetStyle(
                    ControlStyles.AllPaintingInWmPaint |
                    ControlStyles.FixedHeight |
                    ControlStyles.FixedWidth |
                    ControlStyles.OptimizedDoubleBuffer |
                    ControlStyles.UserPaint,
                    true);
                this.Size = new System.Drawing.Size(20, 256);

                _cursorRect = new Rectangle(0, 256 - 4, 20, 7);
                _onDrag     = false;

                _pixBuffer = new PixelBuffer(20, 256);
                FillBuffer();

                this.Invalidate();
            }
 public void Start(IWindowsFormsEditorService edSvc, object value)
 {
     this._edSvc = edSvc;
     this._value = (ColorHLS)value;
     if (value != null)
     {
     }
 }
Ejemplo n.º 6
0
            protected override void OnMouseDown(MouseEventArgs e)
            {
                base.OnMouseDown(e);

                _previusColor = _currentColor.Clone();
                MouseEvent(e);
                _onDrag = true;
            }
Ejemplo n.º 7
0
        static TabStripCloseButton()
        {
            ColorHLS hls = new ColorHLS(SystemColors.Highlight);

            hls.Lighten(0.3f);
            hls.Alpha = 150;

            _HighLightColor = hls.Color;
        }
Ejemplo n.º 8
0
        public void Start(IWindowsFormsEditorService edSvc, object value)
        {
            this._edSvc = edSvc;
            this._value = (ColorHLS)value;
            if (value != null)
            {

            }
        }
Ejemplo n.º 9
0
 public ColorHLS(ColorHLS hls)
 {
     _alpha = hls.Alpha;
     _red = hls.Red;
     _blue = hls.Blue;
     _green = hls.Green;
     _luminance = hls.Luminance;
     _hue = hls.Hue;
     _saturation = hls.Saturation;
 }
Ejemplo n.º 10
0
 public ColorHLS(ColorHLS hls)
 {
     _alpha      = hls.Alpha;
     _red        = hls.Red;
     _blue       = hls.Blue;
     _green      = hls.Green;
     _luminance  = hls.Luminance;
     _hue        = hls.Hue;
     _saturation = hls.Saturation;
 }
Ejemplo n.º 11
0
        public ColorHlsUI()
        {
            InitializeComponent();

            colorSliderHue.Value = 360;
            colorSliderSat.Value = 0;
            colorSliderLum.Value = 1;

            _value = new ColorHLS(colorSliderHue.Value, colorSliderLum.Value, colorSliderSat.Value);
            panelColor.BackColor = _value.Color;
        }
Ejemplo n.º 12
0
            public void SetLuminance(float luminance)
            {
                _cursorRect.Y = 255 - (int)(255 * luminance) - 4;

                this.Invalidate();

                _currentColor = this.GetColorAt(
                    _cursorRect.Left + 4,
                    _cursorRect.Top + 4
                    );
            }
Ejemplo n.º 13
0
            public void SetSaturation(float saturation)
            {
                _cursorRect.X = (int)(255 * saturation) - 4;

                this.Invalidate();

                _currentColor = this.GetColorAt(
                    _cursorRect.Left + 4,
                    _cursorRect.Top + 4
                    );
            }
        public ColorHlsUI()
        {
            InitializeComponent();

            colorSliderHue.Value = 360;
            colorSliderSat.Value = 0;
            colorSliderLum.Value = 1;

            _value = new ColorHLS(colorSliderHue.Value, colorSliderLum.Value, colorSliderSat.Value);
            panelColor.BackColor = _value.Color;
        }
Ejemplo n.º 15
0
        private void numB_ValueChanged(object sender, EventArgs e)
        {
            if (!lsView.IsFocused)
            {
                ColorHLS newColor = lsView.CurrentColor.Clone();
                newColor.Blue = (byte)numR.Value;

                hueView.Value = newColor.Hue;
                lsView.SetHue(newColor.Hue);
            }
        }
Ejemplo n.º 16
0
        private void numHue_ValueChanged(object sender, EventArgs e)
        {
            lsView.SetHue((float)numHue.Value);
            hueView.Value = (float)numHue.Value;

            ColorHLS baseColor = new ColorHLS((float)numHue.Value, 0.5f, 1);

            saturationView.BaseColor = baseColor;
            luminanceView.BaseColor  = baseColor;

            this.panelColor2.BackColor = lsView.CurrentColor.Color;
        }
Ejemplo n.º 17
0
            public void SetHue(float hue)
            {
                _baseColor = new ColorHLS(hue, 0.5f, 1);
                FillBuffer();

                this.Invalidate();

                _currentColor = this.GetColorAt(
                    _cursorRect.Left + 4,
                    _cursorRect.Top + 4
                    );
            }
Ejemplo n.º 18
0
        void lsView_ColorChanged(object sender, ColorChooseControl.ColorChangedEventArgs e)
        {
            _currentColor = lsView.CurrentColor;

            numR.Value = _currentColor.Red;
            numG.Value = _currentColor.Green;
            numB.Value = _currentColor.Blue;

            numHue.Value = new decimal(lsView.Hue);
            numSat.Value = new decimal(lsView.Saturation * 100);
            numLum.Value = new decimal(lsView.Luminance * 100);
        }
Ejemplo n.º 19
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.º 20
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.º 21
0
        public void DrawGlyph(Graphics gfx)
        {
            if (_IsMouseOver)
            {
                ColorHLS hls = new ColorHLS(SystemColors.Highlight);
                hls.Lighten(0.3f);
                hls.Alpha = 150;

                gfx.FillRectangle(new SolidBrush(hls.Color), glyphRect);

                Rectangle borderRect = glyphRect;

                borderRect.Width--;
                borderRect.Height--;

                gfx.DrawRectangle(SystemPens.Highlight, borderRect);
            }

            SmoothingMode bak = gfx.SmoothingMode;

            gfx.SmoothingMode = SmoothingMode.Default;

            using (Pen pen = new Pen(Color.Black))
            {
                pen.Width = 2;

                gfx.DrawLine(pen, new Point(glyphRect.Left + (glyphRect.Width / 3) - 2, glyphRect.Height / 2 - 1),
                             new Point(glyphRect.Right - (glyphRect.Width / 3), glyphRect.Height / 2 - 1));
            }

            gfx.FillPolygon(Brushes.Black, new Point[] {
                new Point(glyphRect.Left + (glyphRect.Width / 3) - 2, glyphRect.Height / 2 + 2),
                new Point(glyphRect.Right - (glyphRect.Width / 3), glyphRect.Height / 2 + 2),
                new Point(glyphRect.Left + glyphRect.Width / 2 - 1, glyphRect.Bottom - 4)
            });

            gfx.SmoothingMode = bak;
        }
Ejemplo n.º 22
0
            private void MouseEvent(MouseEventArgs e)
            {
                Point newPos = new Point(0, e.Y - 3);

                if (newPos.Y < -3)
                {
                    newPos.Y = -3;
                }
                if (newPos.Y > (256 - 4))
                {
                    newPos.Y = (256 - 4);
                }
                _cursorRect.Location = newPos;

                _currentColor = GetColorAt(1, newPos.Y + 3);

                switch (_colorMode)
                {
                case ColorSliderMode.Saturation:
                    _saturation = 1 - ((float)(newPos.Y + 3) / 255);
                    break;

                case ColorSliderMode.Brightness:
                    _luminance = 1 - ((float)(newPos.Y + 3) / 255);   //_currentColor.Luminance * 2;
                    break;

                case ColorSliderMode.Hue:
                    _hue = (float)Math.Round(((double)(255 - (newPos.Y + 3)) / 255) * 359, MidpointRounding.ToEven);  //_currentColor.Hue;
                    break;
                }

                this.Invalidate();

                if (this.ColorChanged != null)
                {
                    this.ColorChanged(this, new ColorChangedEventArgs(_previusColor, _currentColor));
                }
            }
Ejemplo n.º 23
0
            public ColorPicker()
            {
                _baseColor    = new ColorHLS(255, 255, 0, 0);
                _currentColor = _baseColor.Clone();
                _previusColor = _baseColor.Clone();
                this.SetStyle(
                    ControlStyles.AllPaintingInWmPaint |
                    ControlStyles.FixedHeight |
                    ControlStyles.FixedWidth |
                    ControlStyles.OptimizedDoubleBuffer |
                    ControlStyles.UserPaint,
                    true);
                this.Size = new System.Drawing.Size(256, 256);

                _cursorRect = new Rectangle(252, -3, 9, 9);
                _onDrag     = false;

                _pixBuffer = new PixelBuffer(256, 256);
                FillBuffer();



                MouseEvent(new MouseEventArgs(MouseButtons.Left, 1, _cursorRect.X + 4, _cursorRect.Y + 4, 0));
            }
Ejemplo n.º 24
0
        public ColorSlider(ColorSliderMode colorMode, ColorSliderOrientation orientation)
        {
            _colorMode   = colorMode;
            _orientation = orientation;

            _baseColor    = new ColorHLS(255, 255, 0, 0);
            _currentColor = _baseColor.Clone();
            _previusColor = _baseColor.Clone();

            this.SetStyle(
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.FixedHeight |
                ControlStyles.FixedWidth |
                ControlStyles.OptimizedDoubleBuffer |
                ControlStyles.UserPaint,
                true);

            if (_orientation == ColorSliderOrientation.Vertical)
            {
                this.Size   = new System.Drawing.Size(20, 256);
                _cursorRect = new Rectangle(0, 256 - 4, 20, 7);
            }
            else
            {
                this.Size   = new System.Drawing.Size(256, 20);
                _cursorRect = new Rectangle(-3, 0, 7, 20);
            }


            _onDrag = false;

            //_pixBuffer = new PixelBuffer(this.Width, this.Height);
            //FillBuffer();

            this.Invalidate();
        }
Ejemplo n.º 25
0
        public ColorSlider(ColorSliderMode colorMode,ColorSliderOrientation orientation)
        {
            _colorMode = colorMode;
            _orientation = orientation;

            _baseColor = new ColorHLS(255, 255, 0, 0);
            _currentColor = _baseColor.Clone();
            _previusColor = _baseColor.Clone();

            this.SetStyle(
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.FixedHeight |
                ControlStyles.FixedWidth |
                ControlStyles.OptimizedDoubleBuffer |
                ControlStyles.UserPaint,
                true);

            if (_orientation == ColorSliderOrientation.Vertical)
            {
                this.Size = new System.Drawing.Size(20, 256);
                _cursorRect = new Rectangle(0, 256 - 4, 20, 7);
            }
            else
            {
                this.Size = new System.Drawing.Size(256, 20);
                _cursorRect = new Rectangle(- 3,0 , 7, 20);
            }

            
            _onDrag = false;

            //_pixBuffer = new PixelBuffer(this.Width, this.Height);
            //FillBuffer();

            this.Invalidate();
        }
Ejemplo n.º 26
0
        private void SetValue(float value)
        {

            if (_orientation == ColorSliderOrientation.Vertical)
            {
                float y = -3;
                switch (_colorMode)
                {
                    default:
                    case ColorSliderMode.Hue:
                        value %= 360;
                        y = 255 - (((value / 359) * 255) + 3);
                        _hue = value;
                        break;
                    case ColorSliderMode.Saturation:
                        if (value < 0 || value > 1)
                        {
                            throw new ArgumentOutOfRangeException("value");
                        }
                        y = (((1 - value) * 255)) - 3;
                        _saturation = value;
                        break;
                    case ColorSliderMode.Luminance:
                        if (value < 0 || value > 1)
                        {
                            throw new ArgumentOutOfRangeException("value");
                        }
                        y = ((1 - value) * 255) - 3;
                        _luminance = value;
                        break;
                }
                _cursorRect.Y = (int)y;
                _currentColor = GetColorAt(1, _cursorRect.Y + 3);
            }
            else
            {
                float x = -3;
                switch (_colorMode)
                {
                    default:
                    case ColorSliderMode.Hue:
                        value %= 360;
                        x = (((value / 359) * 255) - 3);
                        _hue = value;
                        break;
                    case ColorSliderMode.Saturation:
                        if (value < 0 || value > 1)
                        {
                            throw new ArgumentOutOfRangeException("value");
                        }
                        x = (value * 255) - 3;
                        _saturation = value;
                        break;
                    case ColorSliderMode.Luminance:
                        if (value < 0 || value > 1)
                        {
                            throw new ArgumentOutOfRangeException("value");
                        }
                        x = (value * 255) - 3;
                        _luminance = value;
                        break;
                }
                _cursorRect.X = (int)x;
                _currentColor = GetColorAt(_cursorRect.X+3, 1);
            }
            
            this.Invalidate();
        }
Ejemplo n.º 27
0
        private void MouseEvent(MouseEventArgs e)
        {
            if (_orientation == ColorSliderOrientation.Vertical)
            {
                Point newPos = new Point(0, e.Y - 3);
                if (newPos.Y < -3) newPos.Y = -3;
                if (newPos.Y > (256 - 4)) newPos.Y = (256 - 4);
                _cursorRect.Location = newPos;

                _currentColor = GetColorAt(1, newPos.Y + 3);

                switch (_colorMode)
                {
                    case ColorSliderMode.Saturation:
                        _saturation = 1 - ((float)(newPos.Y + 3) / 255);
                        break;
                    case ColorSliderMode.Luminance:
                        _luminance = 1 - ((float)(newPos.Y + 3) / 255); //_currentColor.Luminance * 2;
                        break;
                    case ColorSliderMode.Hue:
                        _hue = (float)Math.Round(((double)(255 - (newPos.Y + 3)) / 255) * 359, MidpointRounding.ToEven); //_currentColor.Hue;
                        break;
                }
            }
            else
            {
                Point newPos = new Point(e.X-3, 0);
                if (newPos.X < -3) newPos.X = -3;
                if (newPos.X > (256 - 4)) newPos.X = (256 - 4);
                _cursorRect.Location = newPos;

                _currentColor = GetColorAt(newPos.X+3, 1);

                switch (_colorMode)
                {
                    case ColorSliderMode.Saturation:
                        _saturation = ((float)(newPos.X + 3) / 255);
                        break;
                    case ColorSliderMode.Luminance:
                        _luminance = ((float)(newPos.X + 3) / 255); //_currentColor.Luminance * 2;
                        break;
                    case ColorSliderMode.Hue:
                        _hue = (float)Math.Round(((double)((newPos.Y + 3)) / 255) * 359, MidpointRounding.ToEven); //_currentColor.Hue;
                        break;
                }
            }

            this.Invalidate();

            if (this.ColorChanged != null)
                this.ColorChanged(this, new ColorChangedEventArgs(_previusColor, _currentColor));
        }
Ejemplo n.º 28
0
        private void SetValue(float value)
        {
            if (_orientation == ColorSliderOrientation.Vertical)
            {
                float y = -3;
                switch (_colorMode)
                {
                default:
                case ColorSliderMode.Hue:
                    value %= 360;
                    y      = 255 - (((value / 359) * 255) + 3);
                    _hue   = value;
                    break;

                case ColorSliderMode.Saturation:
                    if (value < 0 || value > 1)
                    {
                        throw new ArgumentOutOfRangeException("value");
                    }
                    y           = (((1 - value) * 255)) - 3;
                    _saturation = value;
                    break;

                case ColorSliderMode.Luminance:
                    if (value < 0 || value > 1)
                    {
                        throw new ArgumentOutOfRangeException("value");
                    }
                    y          = ((1 - value) * 255) - 3;
                    _luminance = value;
                    break;
                }
                _cursorRect.Y = (int)y;
                _currentColor = GetColorAt(1, _cursorRect.Y + 3);
            }
            else
            {
                float x = -3;
                switch (_colorMode)
                {
                default:
                case ColorSliderMode.Hue:
                    value %= 360;
                    x      = (((value / 359) * 255) - 3);
                    _hue   = value;
                    break;

                case ColorSliderMode.Saturation:
                    if (value < 0 || value > 1)
                    {
                        throw new ArgumentOutOfRangeException("value");
                    }
                    x           = (value * 255) - 3;
                    _saturation = value;
                    break;

                case ColorSliderMode.Luminance:
                    if (value < 0 || value > 1)
                    {
                        throw new ArgumentOutOfRangeException("value");
                    }
                    x          = (value * 255) - 3;
                    _luminance = value;
                    break;
                }
                _cursorRect.X = (int)x;
                _currentColor = GetColorAt(_cursorRect.X + 3, 1);
            }

            this.Invalidate();
        }
Ejemplo n.º 29
0
 private void ChangeBaseColor(ColorHLS color)
 {
     FillBuffer();
     this.Invalidate();
 }
Ejemplo n.º 30
0
 private void ChangeCurrentColor(ColorHLS color)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 31
0
        public ColorHLS Clone()
        {
            ColorHLS c = new ColorHLS(this);

            return(c);
        }
Ejemplo n.º 32
0
 private void ChangeCurrentColor(ColorHLS color)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 33
0
 private void ChangeBaseColor(ColorHLS color)
 {
     FillBuffer();
     this.Invalidate();
 }
Ejemplo n.º 34
0
 public ColorHLS Clone()
 {
     ColorHLS c = new ColorHLS(this);
     return c;
 }
 public void End()
 {
     this._edSvc = null;
     this._value = null;
 }
Ejemplo n.º 36
0
 public ColorChangedEventArgs(ColorHLS oldColor, ColorHLS newColor)
 {
     OldColor = oldColor;
     NewColor = newColor;
 }
Ejemplo n.º 37
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]);
                }
            }
        }
Ejemplo n.º 38
0
 public void End()
 {
     this._edSvc = null;
     this._value = null;
 }
Ejemplo n.º 39
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]);
                }
            }
        }
Ejemplo n.º 40
0
 public ColorChangedEventArgs(ColorHLS oldColor, ColorHLS newColor)
 {
     OldColor = oldColor;
     NewColor = newColor;
 }
Ejemplo n.º 41
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            _previusColor = _currentColor.Clone();
            MouseEvent(e);
            _onDrag = true;
        }