Esempio n. 1
0
        /// <summary>
        /// Called When slider 0 updates (L or B)
        /// </summary>
        /// <param name="value"></param>
        private void UpdateColorFromSlider2(ChangeEvent <float> value)
        {
            UpdatePrevColor();
            switch (_mode)
            {
            case SliderMode.HSL:
                // calculate color
                _currentColor = ColorUtility.HSL(_prevHue, _prevSat, (int)value.newValue, _currentColor.a);

                // update other sliders
                UpdateSaturationSlider(GetHue(), GetSat(), GetLum());
                break;

            case SliderMode.RGB:
                // calculate color
                _currentColor = ColorUtility.RGB((int)(_currentColor.r * 255), (int)(_currentColor.g * 255), (int)value.newValue, (int)(_currentColor.a * 255));

                // update other sliders
                UpdateRedSlider();
                UpdateGreenSlider();
                break;
            }

            DoCommonUpdateFromSliders();
        }
Esempio n. 2
0
        /// <summary>
        /// Called When slider 0 updates (H or R)
        /// </summary>
        /// <param name="value"></param>
        private void UpdateColorFromSlider0(ChangeEvent <float> value)
        {
            UpdatePrevColor();
            switch (_mode)
            {
            case SliderMode.HSL:
                // calculate color
                _currentColor = ColorUtility.HSL((int)value.newValue, _prevSat, _prevLum, _currentColor.a);

                // update other sliders
                int hue = GetHue();
                int sat = GetSat();
                int lum = GetLum();
                UpdateSaturationSlider(hue, sat, lum);
                UpdateLuminanceSlider(hue, sat, lum);
                break;

            case SliderMode.RGB:
                // calculate color
                _currentColor = ColorUtility.RGB((int)value.newValue, (int)(_currentColor.g * 255), (int)(_currentColor.b * 255), (int)(_currentColor.a * 255));

                // update other sliders
                UpdateGreenSlider();
                UpdateBlueSlider();
                break;
            }

            DoCommonUpdateFromSliders();
        }