Exemplo n.º 1
0
        /// <summary>
        /// Takes the value to use and update the slider with it.
        /// </summary>
        /// <param name="valueToUse">The value to use.</param>
        private void TakeValue(float valueToUse)
        {
            switch (this.drawStyle)
            {
            case DrawStyle.Hue:
                this.HSL.H = valueToUse;
                this.RGBA  = AdobeColors.HSLToRGB(HSL);
                break;

            case DrawStyle.Saturation:
                this.HSL.S = valueToUse;
                this.RGBA  = AdobeColors.HSLToRGB(HSL);
                break;

            case DrawStyle.Brightness:
                this.HSL.L = valueToUse;
                this.RGBA  = AdobeColors.HSLToRGB(HSL);
                break;

            case DrawStyle.Red:
                this.RGBA.UpdateR((byte)valueToUse);
                this.HSL = AdobeColors.RGBToHSL(this.RGBA);
                break;

            case DrawStyle.Green:
                this.RGBA.UpdateG((byte)valueToUse);
                this.HSL = AdobeColors.RGBToHSL(this.RGBA);
                break;

            case DrawStyle.Blue:
                this.RGBA.UpdateB((byte)valueToUse);
                this.HSL = AdobeColors.RGBToHSL(this.RGBA);
                break;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Takes the value that came from the relative position of the mouse , to update color.
        /// </summary>
        /// <param name="newValue">The new value.</param>
        private void TakeValue(DVector2 newValue)
        {
            switch (this.drawStyle)
            {
            case DrawStyle.Hue:
                HSL.S     = newValue.X;
                HSL.L     = 1 - newValue.Y;
                this.RGBA = AdobeColors.HSLToRGB(HSL);
                break;

            case DrawStyle.Saturation:
                HSL.H     = newValue.X;
                HSL.L     = 1 - newValue.Y;
                this.RGBA = AdobeColors.HSLToRGB(HSL);
                break;

            case DrawStyle.Brightness:
                HSL.H     = newValue.X;
                HSL.S     = 1 - newValue.Y;
                this.RGBA = AdobeColors.HSLToRGB(HSL);
                break;

            case DrawStyle.Red:
                this.RGBA.UpdateG((byte)(1 - newValue.Y));
                this.RGBA.UpdateB((byte)newValue.X);
                HSL = AdobeColors.RGBToHSL(this.RGBA);
                break;

            case DrawStyle.Green:
                this.RGBA.UpdateB((byte)newValue.X);
                this.RGBA.UpdateR((byte)(1 - newValue.Y));
                HSL = AdobeColors.RGBToHSL(this.RGBA);
                break;

            case DrawStyle.Blue:
                this.RGBA.UpdateR((byte)newValue.X);
                this.RGBA.UpdateG((byte)(1 - newValue.Y));
                HSL = AdobeColors.RGBToHSL(this.RGBA);
                break;
            }
        }