A class for managing all the color transformations between different color spaces.
|
Public Types |
| enum | { RGBMax = 0xFF,
HSLMax = 0xF0,
RGBMax16 = 0xFFFF,
HSLMax16 = 0xF0F0
} |
| enum | { hue_undefined = HUE_UNDEFINED
} |
Static Public Member Functions |
| static int | getLuminosity (const Color &color) |
| | compute the luminosity for an RGB color.
|
| static void | setLuminosity (Color &color, const int &luminosity) |
| | set the luminosity of a color.
|
| static double | HueToColorValue (const double Hue, const double M1, const double M2) |
| | helper function
|
| static HSVtype | RGBToHSV (const RGBtype &RGB) |
| static RGBtype | HSVToRGB (const HSVtype &HSV) |
| static RGBtype | HSLToRGB (const HSLtype &hsl) |
| static HSLtype | RGBToHSL (const RGBtype &rgb) |
| static HWBtype | RGBToHWB (const RGBtype &rgb) |
| static RGBtype | HWBToRGB (const HWBtype &HWB) |
| static HSLtype | HSLRangeToHSL (const HSLrangetype &hslRange) |
| static HSLrangetype | HSLToHSLRange (const HSLtype &hsl) |
| static uint32 | RGBToColorLong (const RGBtype &rgb) |
| static RGBtype | ColorLongToRGB (const uint32 color) |
| static uint32 | HSLToColorLong (const HSLtype &hsl) |
| static HSLtype | ColorLongToHSL (const uint32 color) |
| static RGBrangetype | RGBToRGBRange (const RGBtype &rgb) |
| static RGBtype | RGBRangeToRGB (const RGBrangetype &rgbRange) |
| static RGBtype | HSLRangeToRGB (const HSLrangetype &hslRange) |
| static HSLrangetype | RGBToHSLRange (const RGBtype &rgb) |
| static uint32 | HSLRangeToColorLong (const HSLrangetype &hsl) |
| static HSLrangetype | ColorLongToHSLRange (const uint32 color) |
| static Color | RGBToColor (const RGBtype &rgb) |
| | inline implementation for ColorSpace class
|
| static RGBtype | ColorToRGB (const Color &color) |
| static uint32 | ColorToColorLong (const Color &color) |
| static Color | HSVToColor (const HSVtype &hsl) |
| static HSVtype | ColorToHSV (const Color &rgb) |
| static Color | HSLToColor (const HSLtype &hsl) |
| static HSLtype | ColorToHSL (const Color &rgb) |
| static Color | HWBToColor (const HWBtype &hsl) |
| static HWBtype | ColorToHWB (const Color &rgb) |
| static double | getChanged (const double &initialVal, const double &percent) |
| static void | changeHSV (HSVtype &hsv, const double &percentH, const double &percentS, const double &percentV) |
| | It is suggested to call this function with colors: 0.0/ 0.0 / 0.71428571428571.
|
| static void | changeHSL (HSLtype &hsl, const double &percentH, const double &percentS, const double &percentL) |
| | It is suggested to call this function with colors: 0.0/ 0.0 / -0.71428571428571.
|
| static void | changeHWB (HWBtype &hsl, const double &percentH, const double &percentW, const double &percentB) |
| | It is suggested to call this function with colors: 0.0/ 0.0 / 0.71428571428571.
|
| static HSVtype | changeHSV (const HSVtype &hsv, const double &percentH, const double &percentS, const double &percentV) |
| static HSLtype | changeHSL (const HSLtype &hsl, const double &percentH, const double &percentS, const double &percentL) |
| static HWBtype | changeHWB (const HWBtype &hwb, const double &percentH, const double &percentW, const double &percentB) |
| static Color | changeHSV (const Color &color, const double &percentH, const double &percentS, const double &percentV) |
| | Example: To draw the Titlebars of a window with a color gradient do the following:.
|
| static Color | changeHSL (const Color &color, const double &percentH, const double &percentS, const double &percentL) |
| static Color | changeHWB (const Color &color, const double &percentH, const double &percentW, const double &percentB) |
| static void | changeHue (HSLtype &hsl, const double &deltaH) |
| static HSLtype | changeHue (const HSLtype &hsl, const double &deltaH) |
| static Color | changeHue (const Color &color, const double &deltaH) |
| static RGBtype | changeHue (const RGBtype &color, const double &deltaH) |
| static uint32 | changeHue (const uint32 &color, const double &deltaH) |
Static Public Attributes |
| static const double | HueCriticalMax |
| | HueCriticalMax is assigned ( 1.0 - 1.0 / 6.0 ) Hue > HueCriticalMax => rgb.R > 1;.
|
Classes |
| struct | HSLrangetype |
| struct | HSLtype |
| struct | HSVtype |
| struct | HWBtype |
| struct | RGBrangetype |
| struct | RGBtype |
A class for managing all the color transformations between different color spaces.
Abstract: The two most common color selector models, other than RGB (Red-Green-Blue), are the hue-based HSV (Hue-Saturation-Value) and HSL (Hue-Saturation-Lightness) color models. It is shown that both of these models are flawed. A closely related model, HWB (Hue-Whiteness-Blackness), is introduced that avoids the flaws, is slightly faster to compute, and is very easy to teach to new users: Choose a hue. Lighten it with white. Darken it with black. We explain that lightening is not the opposite of darkening.