4 Component Color. More...
#include <decColor.h>
Public Member Functions | |
Constructors and Destructors | |
| decColor () | |
| Creates a new color initialized to ( 0,0,0,1 ). | |
| decColor (float nr, float ng, float nb) | |
| Creates a new color with the given values. | |
| decColor (float nr, float ng, float nb, float na) | |
| Creates a new color with the given values. | |
| decColor (const decColor &c) | |
| Creates a new color with the values of another color. | |
Management | |
| void | Normalize () |
| Normalizes the color. | |
| void | SetZero () |
| Sets the red, green and blue components to 0 and the alpha component to 1. | |
| void | Set (float nr, float ng, float nb) |
| Sets the components to the given values. | |
| void | Set (float nr, float ng, float nb, float na) |
| Sets the components to the given values. | |
| bool | IsEqualTo (const decColor &c, float threshold=0.0001) const |
| Determines if the components of this vector are equal to another one with respect to a threshold. | |
Operators | |
| decColor & | operator= (const decColor &c) |
| Sets the components of this color to the values of another one. | |
| decColor & | operator+= (const decColor &c) |
| Adds the components of another color to this one. | |
| decColor & | operator-= (const decColor &c) |
| Subtracts the components of another color from this color. | |
| decColor & | operator*= (float k) |
| Multiplies the components of this color with a value k. | |
| decColor & | operator/= (float k) |
| Divides the components of this color by a value k. | |
| decColor | operator+ (const decColor &c) const |
| Retrieves a new color with the sum of this color with another one. | |
| decColor | operator- (const decColor &c) const |
| Retrieves a new color with the difference of this color to another one. | |
| decColor | operator* (float k) const |
| Retrieves a new color with this color scaled by k. | |
| decColor | operator* (const decColor &c) const |
| Retrieves a new color with this color multiplied component wise with another one. | |
| decColor | operator/ (float k) const |
| Retrieves a new color with this color divided by k. | |
Static Public Member Functions | |
Predefined Colors | |
| static decColor | CreateColor (const char *name) |
| Retrieves one of the predefined colors indicated by name. | |
Public Attributes | |
| float | a |
| Alpha Component of color. | |
| float | b |
| Blue Component of color. | |
| float | g |
| Green Component of color. | |
| float | r |
| Red Component of color. | |
4 Component Color.
Describes an RGBA style color in decimal range. The value of 0 indicates no luminance in that color and 1 indicates full luminance. The color also contains an alpha component where 0 indicates completly transparent and 1 indicates completly opaque.
| decColor::decColor | ( | ) | [inline] |
Creates a new color initialized to ( 0,0,0,1 ).
Referenced by operator*(), operator+(), operator-(), and operator/().
| decColor::decColor | ( | float | nr, |
| float | ng, | ||
| float | nb | ||
| ) | [inline] |
| decColor::decColor | ( | float | nr, |
| float | ng, | ||
| float | nb, | ||
| float | na | ||
| ) | [inline] |
| decColor::decColor | ( | const decColor & | c ) | [inline] |
| static decColor decColor::CreateColor | ( | const char * | name ) | [static] |
Retrieves one of the predefined colors indicated by name.
Possible values for name are 'black', 'white', 'gray', 'light_gray', 'dark_gray', 'red', 'dark_red', 'green', 'dark_green', 'blue', 'dark_blue'. In the case of a name not part of this list black is assumed.
| bool decColor::IsEqualTo | ( | const decColor & | c, |
| float | threshold = 0.0001 |
||
| ) | const |
Determines if the components of this vector are equal to another one with respect to a threshold.
| void decColor::Normalize | ( | ) |
Normalizes the color.
Each component is clamped to the range of 0 to 1.
| decColor decColor::operator* | ( | float | k ) | const [inline] |
Retrieves a new color with this color scaled by k.
References a, b, decColor(), g, and r.
Retrieves a new color with this color multiplied component wise with another one.
References a, b, decColor(), g, and r.
| decColor& decColor::operator*= | ( | float | k ) | [inline] |
Retrieves a new color with the sum of this color with another one.
References a, b, decColor(), g, and r.
Retrieves a new color with the difference of this color to another one.
References a, b, decColor(), g, and r.
| decColor decColor::operator/ | ( | float | k ) | const [inline] |
| decColor& decColor::operator/= | ( | float | k ) | [inline] |
| void decColor::Set | ( | float | nr, |
| float | ng, | ||
| float | nb, | ||
| float | na | ||
| ) | [inline] |
| void decColor::Set | ( | float | nr, |
| float | ng, | ||
| float | nb | ||
| ) | [inline] |
| void decColor::SetZero | ( | ) | [inline] |
| float decColor::a |
Alpha Component of color.
Referenced by decColor(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator=(), Set(), decColorMatrix::SetAlphaBase(), decColorMatrix::SetBlueBase(), decColorMatrix::SetGreenBase(), decColorMatrix::SetRedBase(), decColorMatrix::SetTranslationBase(), and SetZero().
| float decColor::b |
Blue Component of color.
Referenced by decColor(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator=(), Set(), decColorMatrix::SetAlphaBase(), decColorMatrix3::SetBlueBase(), decColorMatrix::SetBlueBase(), decColorMatrix3::SetGreenBase(), decColorMatrix::SetGreenBase(), decColorMatrix3::SetRedBase(), decColorMatrix::SetRedBase(), decColorMatrix3::SetTranslationBase(), decColorMatrix::SetTranslationBase(), and SetZero().
| float decColor::g |
Green Component of color.
Referenced by decColor(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator=(), Set(), decColorMatrix::SetAlphaBase(), decColorMatrix3::SetBlueBase(), decColorMatrix::SetBlueBase(), decColorMatrix3::SetGreenBase(), decColorMatrix::SetGreenBase(), decColorMatrix3::SetRedBase(), decColorMatrix::SetRedBase(), decColorMatrix3::SetTranslationBase(), decColorMatrix::SetTranslationBase(), and SetZero().
| float decColor::r |
Red Component of color.
Referenced by decColor(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator=(), Set(), decColorMatrix::SetAlphaBase(), decColorMatrix3::SetBlueBase(), decColorMatrix::SetBlueBase(), decColorMatrix3::SetGreenBase(), decColorMatrix::SetGreenBase(), decColorMatrix3::SetRedBase(), decColorMatrix::SetRedBase(), decColorMatrix3::SetTranslationBase(), decColorMatrix::SetTranslationBase(), and SetZero().
1.7.2