示例#1
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;
 }
示例#2
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;
 }
示例#3
0
 public ColorHsv ToColorHsv()
 {
     return(ColorRgb.FromColor(this).ToColorHsv());
 }
示例#4
0
 public ColorRgb ToColorRgb()
 {
     return(ColorRgb.FromColor(this));
 }
示例#5
0
 public bool Equals(Color other)
 {
     return(ToColorRgb() == ColorRgb.FromColor(other));
 }
示例#6
0
 public static ColorHsl FromColor(Color color)
 {
     return(ColorRgb.FromColor(color).ToColorHsl());
 }