Public Methods | |
Color () | |
Color (double r, double g, double b) | |
Color (COLORREF color) | |
void | setColor (double r, double g, double b) |
double & | operator[] (COLOR col) |
double | operator[] (COLOR col) const |
Color & | operator= (const Color &color) |
Color & | operator+= (const Color &color) |
Color & | operator-= (const Color &color) |
Color | operator+ (const Color &color) const |
Color | operator- (const Color &color) const |
Color | operator- () const |
Color & | operator *= (double d) |
Color & | operator/= (double d) |
Color | operator * (double d) const |
Color | operator/ (double d) const |
bool | operator== (const Color &color) const |
double | abs () const |
void | setRandomColor () |
Every component is a double at the range [0.0, 1.0]. After each operation an overflow check is made for every component, and if necessary, the component is updated. For example, if the R component is larger than 1.0, it will be updated to 1.0; if smaller than 0.0, it will be updated to 0.0
|
Default constructor. Initializes the color to black (0, 0, 0). |
|
Constructor. Initializes the color to (r, g, b).
|
|
Constructor. Initializes the color according to the given color.
|
|
Returns the absolute value of the color, i.e. sqrt(r*r+g*g+b*b)
|
|
Multiplies every color component by d, returns a new Color object.
|
|
Multiplies every color component by d.
|
|
Returns the sum of current color and color.
|
|
Adds color to current color.
|
|
Returns the current color multiplied by -1.
|
|
Subtracts color from current color, returns a new Color object.
|
|
Subtracts color to current color.
|
|
Divides every color component by d, returns a new Color object.
|
|
Divides every color component by d.
|
|
Sets the current color according to the given color.
|
|
Compares 2 colors and returns true if they are the same.
|
|
Returns the R/G/B value (depends on col).
|
|
Returns the R/G/B value (depends on col).
|
|
Set the color components.
|
|
Sets a random color.
|