HSB (, , ) RGB..Net RGB- HSB ( Color.GetHue,.GetSaturation .GetBrightness), . , HSB RGB:
http://splinter.com.au/blog/?p=29
( "V" "B", , "" "" ).
HSB , Hue 0 360 , 360 0. , 1.0 ( ), .
( Rubens) int32 :
int i = 4837429;
Color color = Color.FromArgb(i);
, , int32 ( MinValue MaxValue), - , , .
: - , :
private const double ONE_SIXTH =
0.16666666666666666666666666666667;
private const double ONE_THIRD =
0.33333333333333333333333333333333;
private const double TWO_THIRDS =
0.66666666666666666666666666666667;
private const double FIVE_SIXTHS =
0.83333333333333333333333333333333;
public Color WheelColor(double d)
{
if ((d < 0.0) || (d > 1.0))
{
throw new ArgumentOutOfRangeException("d",
d, "d must be between 0.0 and 1.0, inclusive");
}
double R = 1;
double G = 1;
double B = 1;
if (d < ONE_SIXTH)
{
G = d / ONE_SIXTH;
B = 0;
}
else if (d < ONE_THIRD)
{
R = 1 - ((d - ONE_SIXTH) / ONE_SIXTH);
B = 0;
}
else if (d < 0.5)
{
R = 0;
B = (d - ONE_THIRD) / ONE_SIXTH;
}
else if (d < TWO_THIRDS)
{
R = 0;
G = 1 - ((d - 0.5) / ONE_SIXTH);
}
else if (d < FIVE_SIXTHS)
{
R = (d - TWO_THIRDS) / ONE_SIXTH;
G = 0;
}
else
{
B = 1 - ((d - FIVE_SIXTHS) / ONE_SIXTH);
G = 0;
}
return Color.FromArgb((int)(R * 255),
(int)(G * 255), (int)(B * 255));
}
d WheelColor 0.0 1.0 (), , d = 0.0, , d = 1.0.