Exemplo n.º 1
0
        private void EhOpacitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            if (_notUserInitiated)
            {
                return;
            }

            var   c = _newColor;
            float a = (float)e.NewValue;

            _newColor = AxoColor.FromScRgb(a, c.ScR, c.ScG, c.ScB);
            UpdateControlVisuals();
            CurrentColorChanged?.Invoke(_newColor);
        }
Exemplo n.º 2
0
        public void GetColorVariations(AxoColor baseColor, AxoColor[] variations)
        {
            var blue = baseColor.ScB;
            var red  = baseColor.ScR;

            // make warmer = more red

            int numberOfItems = variations.Length;

            variations[0] = baseColor;
            for (int i = 1; i < numberOfItems; ++i)
            {
                var newBlue = (blue + (1 - blue) * (i / (float)numberOfItems));
                var newRed  = (red * (1 - i / (float)numberOfItems));
                variations[i] = AxoColor.FromScRgb(baseColor.ScA, newRed, baseColor.ScG, newBlue);
            }
        }
Exemplo n.º 3
0
        private void EhBrightnessSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            if (_notUserInitiated)
            {
                return;
            }

            Color nc = colorComb.SelectedColor;
            float f  = (float)e.NewValue;

            float a, r, g, b;

            a = (float)opacitySlider.Value;
            r = f * nc.ScR;
            g = f * nc.ScG;
            b = f * nc.ScB;

            _newColor = AxoColor.FromScRgb(a, r, g, b);
            UpdateControlVisuals();
            CurrentColorChanged?.Invoke(_newColor);
        }
Exemplo n.º 4
0
        //
        // Event Handlers

        private void EhColorCombControl_ColorSelected(object sender, ColorEventArgs e)
        {
            if (_notUserInitiated)
            {
                return;
            }

            float a, f, r, g, b;

            a = (float)opacitySlider.Value;
            f = (float)brightnessSlider.Value;

            Color nc = e.Color;

            r = f * nc.ScR;
            g = f * nc.ScG;
            b = f * nc.ScB;

            _newColor = AxoColor.FromScRgb(a, r, g, b);
            UpdateControlVisuals();
            CurrentColorChanged?.Invoke(_newColor);
        }
Exemplo n.º 5
0
 public AxoColor GetColorFromComponents(double[] components)
 {
     return(AxoColor.FromScRgb(1, (float)components[0], (float)components[1], (float)components[2]));
 }