Beispiel #1
0
 /// <summary>Initializes a new instance of the <see cref="T:LukeSw.Drawing.ColorHsv"/> structure
 /// from the specified double values.</summary>
 /// <param name="alpha">The alpha component value. Valid values are 0 through 1.</param>
 /// <param name="hue">The hue component value. Valid values are 0 through 360.</param>
 /// <param name="saturation">The saturation component value. Valid values are 0 through 1.</param>
 /// <param name="value">The value component value. Valid values are 0 through 1.</param>
 public ColorHsv(double alpha, double hue, double saturation, double value)
 {
     ColorRgb.Checkdouble(alpha, "alpha");
     ColorRgb.Checkdouble(hue, "hue", 0.0, 360.0);
     if (hue == 360.0)
     {
         hue = 0.0;
     }
     ColorRgb.Checkdouble(saturation, "saturation");
     ColorRgb.Checkdouble(value, "value");
     this.A = alpha;
     this.H = hue;
     this.S = saturation;
     this.V = value;
 }
Beispiel #2
0
 /// <summary>Initializes a new instance of the <see cref="T:LukeSw.Drawing.ColorHsl"/> structure
 /// from the specified double values.</summary>
 /// <param name="alpha">The alpha component value. Valid values are 0 through 1.</param>
 /// <param name="hue">The hue component value. Valid values are 0 through 360.</param>
 /// <param name="saturation">The saturation component value. Valid values are 0 through 1.</param>
 /// <param name="lightness">The lightness component value. Valid values are 0 through 1.</param>
 public ColorHsl(double alpha, double hue, double saturation, double lightness)
 {
     ColorRgb.Checkdouble(alpha, "alpha");
     ColorRgb.Checkdouble(hue, "hue", 0.0, 360.0);
     if (hue == 360.0)
     {
         hue = 0.0;
     }
     ColorRgb.Checkdouble(saturation, "saturation");
     ColorRgb.Checkdouble(lightness, "lightness");
     this.A = alpha;
     this.H = hue;
     this.S = saturation;
     this.L = lightness;
 }
Beispiel #3
0
 public ColorHsl ToColorHsl()
 {
     return(ColorRgb.FromColor(this).ToColorHsl());
 }
Beispiel #4
0
 public ColorRgb ToColorRgb()
 {
     return(ColorRgb.FromColor(this));
 }
Beispiel #5
0
 public bool Equals(Color other)
 {
     return(ToColorRgb() == ColorRgb.FromColor(other));
 }
Beispiel #6
0
 public static ColorHsv FromColor(Color color)
 {
     return(ColorRgb.FromColor(color).ToColorHsv());
 }