Example #1
0
        private void CW_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            SliderItem si = SelectedSlider;

            if (!blockChangePoint)
            {
                if (si != null)
                {
                    HslSlider slider = (HslSlider)sender;
                    switch (slider.ColorScale)
                    {
                    case SliderScaleEnum.Warm:
                        si.PatternPoint.WarmD        = e.NewValue;
                        si.PatternPoint.InitialWarmD = e.NewValue;

                        if (si.Variant == PointVariant.RangeLeft)
                        {
                            si.PatternPoint.CopyTo(si.Owner[si.Ix + 1].PatternPoint, si.SliderType);
                        }
                        if (si.Variant == PointVariant.RangeRight)
                        {
                            si.PatternPoint.CopyTo(si.Owner[si.Ix - 1].PatternPoint, si.SliderType);
                        }
                        break;

                    case SliderScaleEnum.Cold:
                        si.PatternPoint.ColdD        = e.NewValue;
                        si.PatternPoint.InitialColdD = e.NewValue;

                        if (si.Variant == PointVariant.RangeLeft)
                        {
                            si.PatternPoint.CopyTo(si.Owner[si.Ix + 1].PatternPoint, si.SliderType);
                        }
                        if (si.Variant == PointVariant.RangeRight)
                        {
                            si.PatternPoint.CopyTo(si.Owner[si.Ix - 1].PatternPoint, si.SliderType);
                        }
                        break;
                    }

                    si.UpdatePattern();
                }
            }
            UpdateSlidersInfo(si.PatternPoint);
        }
Example #2
0
        /****************************************************************************/

        #region Mouse Input

        private void colorSelector_MouseDown(object sender, MouseButtonEventArgs e)
        {
            ColorRange cr = (ColorRange)((e.OriginalSource as System.Windows.Shapes.Rectangle).DataContext);

            Console.WriteLine($"HueFrom {cr.HueMinimum}  HueTo {cr.HueMaximum}");
            if (SelectedSlider != null)
            {
                if (SelectedSlider.Variant != PointVariant.Lightness)
                {
                    SliderItem si = SelectedSlider;

                    hueSlider.UpdateScaleGradient(cr);

                    si.PatternPoint.H = cr.HueMiddle;
                    si.PatternPoint.S = si.PatternPoint.S; //= 1.0;
                    si.PatternPoint.L = si.PatternPoint.L; //0.5;
                    si.PatternPoint.SaveLightness();
                    si.PatternPoint.UpdatePoint_RGB();

                    blockChangePoint = true;
                    SetSlidersValues(si);
                    blockChangePoint = false;

                    if (si.Variant == PointVariant.RangeLeft)
                    {
                        si.PatternPoint.CopyTo(si.Owner[si.Ix + 1].PatternPoint, si.SliderType);
                    }
                    if (si.Variant == PointVariant.RangeRight)
                    {
                        si.PatternPoint.CopyTo(si.Owner[si.Ix - 1].PatternPoint, si.SliderType);
                    }

                    si.PatternPoint.SaveLightness();
                    si.PatternPoint.UpdatePoint_RGB();
                    si.UpdatePattern();
                }
                if (SelectedRange != null)
                {
                    SelectedRange.IsSelected = false;
                }
                cr.IsSelected = true;
                SelectedRange = cr;
            }
        }
Example #3
0
        /****************************************************************************/

        #region ValueChanged Handlers

        private void hslSliders_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            SliderItem si = SelectedSlider;

            if (!blockChangePoint)
            {
                HslSlider slider = (HslSlider)sender;
                if (slider.ColorScale == SliderScaleEnum.H)
                {
                    si.PatternPoint.H = e.NewValue;
                }
                if (slider.ColorScale == SliderScaleEnum.S)
                {
                    si.PatternPoint.S = e.NewValue;
                }
                if (slider.ColorScale == SliderScaleEnum.L)
                {
                    si.PatternPoint.L = e.NewValue;
                    si.PatternPoint.SaveLightness();
                }

                si.PatternPoint.UpdatePoint_RGB();

                if (si.Variant == PointVariant.RangeLeft)
                {
                    si.PatternPoint.CopyTo(si.Owner[si.Ix + 1].PatternPoint, si.SliderType);
                }
                if (si.Variant == PointVariant.RangeRight)
                {
                    si.PatternPoint.CopyTo(si.Owner[si.Ix - 1].PatternPoint, si.SliderType);
                }

                si.UpdatePattern();
            }
            UpdateSlidersInfo(si.PatternPoint);
        }