Beispiel #1
0
        Color(HsvColor color, double alpha)
        {
            if (alpha < 0 || alpha > 1)
            {
                throw new ArgumentOutOfRangeException("alpha");
            }

            this.rgbColor = RgbColor.FromHsv(color);
            this.hsvColor = color;
            this.alpha    = alpha;
        }
Beispiel #2
0
        public static RgbColor Interpolate(RgbColor color1, RgbColor color2, Interpolation <double> interpolate, double fraction)
        {
            if (interpolate == null)
            {
                throw new ArgumentNullException("interpolate");
            }
            if (fraction < 0 || fraction > 1)
            {
                throw new ArgumentOutOfRangeException("fraction");
            }

            return(new RgbColor
                   (
                       interpolate(color1.red, color2.red, fraction),
                       interpolate(color1.green, color2.green, fraction),
                       interpolate(color1.blue, color2.blue, fraction)
                   ));
        }
Beispiel #3
0
 Color(RgbColor color) : this(color, 1)
 {
 }
Beispiel #4
0
 Color(RgbColor rgbColor, HsvColor hsvColor, double alpha)
 {
     this.rgbColor = rgbColor;
     this.hsvColor = hsvColor;
     this.alpha    = alpha;
 }
Beispiel #5
0
 public static Color InterpolateRgb(Color color1, Color color2, Interpolation <double> interpolate, double fraction)
 {
     return(new Color(RgbColor.Interpolate(color1.rgbColor, color2.rgbColor, interpolate, fraction), interpolate(color1.alpha, color2.alpha, fraction)));
 }
Beispiel #6
0
 public static double DistanceRgb(Color color1, Color color2)
 {
     return(RgbColor.Distance(color1.rgbColor, color2.rgbColor));
 }