class is used to represent a given color with 4 values, with each value representing a separate red, green, blue, and alpha color component (RGBA).
|
Public Types |
| enum | ColorPackScheme { cpsARGB = 0,
cpsRGB,
cpsABGR,
cpsBGR
} |
| | this enum defines the way color is stored when compressed into a 32/64 bit integer value. More...
|
| enum | ColorType {
ctRGB = 0,
ctHSL,
ctHSV,
ctHWB,
ctYUV,
ctLab,
ctCMY
} |
| | An enum that indicates the color type of three double values. More...
|
| enum | MaxFactor { xFF = 0xFF,
xFFFF = 0xFFFF
} |
| | the factor used when ranging the color components with integers. More...
|
Public Member Functions |
| | Color () |
| | default ctor
|
| | Color (const Color &color) |
| | the copy ctor
|
| | Color (const double &val1, const double &val2, const double &val3, ColorType type=ctRGB) |
| | Initializes a color based on the double values (type: double) of its three components in a specified color coordinates sytem.
|
| | Color (const double &val1, const double &val2, const double &val3, const double &a, ColorType type=ctRGB) |
| | Color (const uint8 &val1, const uint8 &val2, const uint8 &val3, ColorType type=ctRGB) |
| | Initializes a color based on the integer values (called range values) of its three components in a specified color coordinates sytem.
|
| | Color (const uint8 &val1, const uint8 &val2, const uint8 &val3, const uint8 &a, ColorType type=ctRGB) |
| | Color (const uint16 &val1, const uint16 &val2, const uint16 &val3, ColorType type=ctRGB) |
| | Initializes a color based on the values (type: unsigned short) of its three components in a specified color coordinates sytem.
|
| | Color (const uint16 &val1, const uint16 &val2, const uint16 &val3, const uint16 &a, ColorType type=ctRGB) |
| | Color (const uint32 &color, const ColorPackScheme &cps=cpsRGB) |
| | this is a constructor helping us in the conversion from an uint32 ( as in COLORREF ) into which the color components have been packed (4 x 8bits).
|
| | Color (const unsigned long &color, const ColorPackScheme &cps=cpsRGB) |
| | this is a constructor helping us in the conversion from an unsigned long ( as in COLORREF ) into which the color components have been packed (4 x 8bits).
|
| | Color (const uint64 &color, const ColorPackScheme &cps=cpsRGB) |
| | this is a constructor halping us in the conversion from an uint64 ( similarly as in COLORREF) into which the color components have been packed (4 x 16bits).
|
| | Color (const String &colorName) |
| | extract a color from its color name.
|
| virtual | ~Color () |
| double | getRed () const |
| double | getGreen () const |
| double | getBlue () const |
| double | getAlpha () const |
| void | setRed (const double &red) |
| void | setGreen (const double &green) |
| void | setBlue (const double &blue) |
| void | setAlpha (const double &alpha) |
| void | getRGB (double &r, double &g, double &b) const |
| | gets the color components of a color.
|
| void | getRGBA (double &r, double &g, double &b, double &a) const |
| void | getRGB8 (uint8 &r, uint8 &g, uint8 &b) const |
| void | getRGBA8 (uint8 &r, uint8 &g, uint8 &b, uint8 &a) const |
| void | getRGB16 (uint16 &r, uint16 &g, uint16 &b) const |
| void | getRGBA16 (uint16 &r, uint16 &g, uint16 &b, uint16 &a) const |
| uint32 | getRGBPack8 (const ColorPackScheme &cps=cpsRGB) const |
| | packs into a uint32 integer the color components using 8bits for each component.
|
| uint64 | getRGBPack16 (const ColorPackScheme &cps=cpsRGB) const |
| | packs into a uint64 integer the color components using 16bits for each component.
|
| uint32 | getColorRef32 () const |
| | same as getRGBPack8, but with the parameter cpsABGR specified.
|
| uint64 | getColorRef64 () const |
| | same as getRGBPack16, but with the parameter cpsABGR specified.
|
| void | setRGB (const double &r, const double &g, const double &b) |
| | sets the color starting from the known color components.
|
| void | setRGBA (const double &r, const double &g, const double &b, const double &a) |
| void | setRGB8 (const uint8 &r, const uint8 &g, const uint8 &b) |
| void | setRGBA8 (const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) |
| void | setRGB16 (const uint16 &r, const uint16 &g, const uint16 &b) |
| void | setRGBA16 (const uint16 &r, const uint16 &g, const uint16 &b, const uint16 &a) |
| Color & | setRGBPack8 (const uint32 &rgb, const ColorPackScheme &cps=cpsRGB) |
| | sets the color starting from the known color components that have been packed into a single uint32 integer (4 x 8bits).
|
| Color & | setRGBPack16 (const uint64 &rgb, const ColorPackScheme &cps=cpsRGB) |
| | sets the color starting from the known color components that have been packed into a single uint64 integer (4 x 16bits).
|
| Color & | setColorRef32 (const uint32 &rgb) |
| | same as setRGBPack8, but with the parameter cpsABGR specified.
|
| Color & | setColorRef64 (const uint64 &rgb) |
| | same as setRGBPack16, but with the parameter cpsABGR specified.
|
| void | getHSV (double &h, double &s, double &v) const |
| void | setHSV (const double &h, const double &s, const double &v) |
| void | getHSL (double &h, double &l, double &s) const |
| void | setHSL (const double &h, const double &l, const double &s) |
| void | getCMYK (double &c, double &m, double &y, double &k) const |
| void | setCMYK (const double &c, const double &m, const double &y, const double &k) |
| void | getLab () const |
| void | setLab () |
| void | getYUV () const |
| void | setYUV () |
| virtual void | copyColor (const Color *source) |
| virtual void | copyColor (const Color &source) |
| virtual void | copy (Object *source) |
| | Copies the data from source to this object.
|
| Color & | operator= (const Color *clr) |
| Color & | operator= (const Color &clr) |
| bool | operator== (const Color &clr) const |
| bool | operator!= (const Color &clr) const |
| bool | operator< (const Color &clr) const |
| bool | operator<= (const Color &clr) const |
| bool | operator> (const Color &clr) const |
| bool | operator>= (const Color &clr) const |
| virtual bool | isEqual (const Color *color) const |
| virtual String | toString () const |
| | overrides the Object's base class member function.
|
| virtual void | setFromString (const String &val) |
| | provides a simple to initialize the object from a string.
|
| String | toHexCode8 (const ColorPackScheme &cps=cpsRGB, const ColorType &ct=ctRGB) |
| | generates a String with the internal representation of the color in hexadecimal format with 8bits per component.
|
| String | toHexCode16 (const ColorPackScheme &cps=cpsRGB, const ColorType &ct=ctRGB) |
| void | changeHSV (const double &percentH, const double &percentS, const double &percentV) |
| void | changeHSL (const double &percentH, const double &percentS, const double &percentL) |
| void | changeHWB (const double &percentH, const double &percentW, const double &percentB) |
| void | changeHue (const double &deltaH) |
| int | getLuminosity () const |
| | compute the luminosity as an RGB color.
|
| void | setLuminosity (const int &luminosity) |
| | set the luminosity of a color.
|
| Color & | invert () |
| | change the color to its complement (inverted)
|
| Color | getInverted () const |
| | compute the complement of the color
|
| void | getInvertedRGB (double &r, double &g, double &b) const |
| | compute the inverted color of a color, given its components.
|
| void | getInvertedRGB8 (uint8 &r, uint8 &g, uint8 &b) const |
| | compute the inverted components of a color, given its components in 8 bit.
|
| void | getInvertedRGB16 (uint16 &r, uint16 &g, uint16 &b) const |
| | compute the inverted components of a color, given its components in 16 bit.
|
| Color & | brighter () |
| | makes the color brighter
|
| Color & | darker () |
| | makes the color brighter
|
| virtual Object * | clone (bool deep) |
Static Public Member Functions |
| static Color * | getColor (const int &gray) |
| | gets a gray color from the map of internet colors.
|
| static Color * | getColor (const String &colorName) |
| | gets a color from the map of internet colors.
|
| static Color * | getColorMatch (const Color &color) |
| | gets a color from the map with the closest match a given color.
|
| static const String | getColorNameFromMap (const Color &color) |
| | gets the name of the color from the map with the closest match a given color.
|
| static void | createColorMap () |
| | creates the map of internet colors.
|
| static Color | getColorContrast (const Color &color, double deltaL=0.3) |
| | computes a color with increased contrast.
|
Friends |
| class | ColorSpace |
class is used to represent a given color with 4 values, with each value representing a separate red, green, blue, and alpha color component (RGBA).
Each value is stored as a double with a valid range of 0.0 to 1.0. A variety of functions a provided to convert the color to and from other color representations, such as CMY(K), HSL, and HSV.