Exemplo n.º 1
0
 public string[] GetComponentsForColor(AxoColor color, IFormatProvider formatProvider)
 {
     var(a, h, s, b) = color.ToAhsb();
     return(new string[]
     {
         h.ToString("F3", formatProvider),
         s.ToString("F3", formatProvider),
         b.ToString("F3", formatProvider)
     });
 }
Exemplo n.º 2
0
        public void GetColorVariations(AxoColor baseColor, AxoColor[] variations)
        {
            var(alpha, hue, saturation, brightness) = baseColor.ToAhsb();

            // make darker, but still the last item should have a rest of color left (i.e. it should not be completely black)

            int numberOfItems = variations.Length;

            variations[0] = baseColor;
            for (int i = 1; i < numberOfItems; ++i)
            {
                var newBrightness = brightness * (1 - i / (float)numberOfItems);
                variations[i] = AxoColor.FromAhsb(alpha, hue, saturation, newBrightness);
            }
        }
Exemplo n.º 3
0
        public void GetColorVariations(AxoColor baseColor, AxoColor[] variations)
        {
            var(alpha, hue, saturation, brightness) = baseColor.ToAhsb();

            // desaturate, but still the last item should have a rest of saturation left

            int numberOfItems = variations.Length;

            variations[0] = baseColor;
            for (int i = 1; i < numberOfItems; ++i)
            {
                var newSaturation = saturation * (1 - i / (float)numberOfItems);
                variations[i] = AxoColor.FromAhsb(alpha, hue, newSaturation, brightness);
            }
        }
Exemplo n.º 4
0
 public (double position1D, PointD2D position2D) GetRelativePositionsFor1Dand2DColorSurfaceFromColor(AxoColor color)
 {
     var(alpha, hue, saturation, brightness) = color.ToAhsb();
     return(hue, new PointD2D(saturation, brightness));
 }
Exemplo n.º 5
0
 public double[] GetComponentsForColor(AxoColor color)
 {
     var(alpha, hue, saturation, brightness) = color.ToAhsb();
     return(new double[] { hue, saturation, brightness });
 }