Exemplo n.º 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);
        }
Exemplo n.º 2
0
        private static void OnHueValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Media.Color color, color1;
            Media.LinearGradientBrush lgb;

            HslSlider slider = d as HslSlider;

            if (slider.ColorScale == SliderScaleEnum.S)
            {
                lgb            = new Media.LinearGradientBrush();
                lgb.StartPoint = new Point(0.5, 1.0);
                lgb.EndPoint   = new Point(0.5, 0.0);
                color          = ColorUtilities.Hsl2MediaColor(slider.HueValue, 0.0, 0.5);
                color1         = ColorUtilities.Hsl2MediaColor(slider.HueValue, 1.0, 0.5);

                lgb.GradientStops.Add(new Media.GradientStop(color, 0.0));
                lgb.GradientStops.Add(new Media.GradientStop(color1, 1.0));

                if (slider.scale != null)
                {
                    slider.scale.Background = lgb;
                }
            }
        }
Exemplo n.º 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);
        }