|
HyperspaceExplorer 0.7.1
|
A class to represent a color value by its RGBA components. More...
#include <Color.h>
Public Member Functions | |
| Color (float, float, float, float=1.) | |
| construct a Color from its R, G, B and alpha values | |
| Color (const VecMath::Vector< 4 > &) | |
| construct a Color from a Vector containing its R, G, B and alpha values | |
| Color (const QColor &) | |
| construct a Color from a QColor | |
| float & | r () |
| the red component of the color | |
| float | r () const |
| the red component of the color | |
| float & | g () |
| the green component of the color | |
| float | g () const |
| the green component of the color | |
| float & | b () |
| the blue component of the color | |
| float | b () const |
| the blue component of the color | |
| float & | a () |
| the alpha component of the color | |
| float | a () const |
| the alpha component of the color | |
| operator float * () | |
| direct access to the array of components, needed by OpenGL functions | |
| operator const float * () const | |
| direct access to the array of components, needed by OpenGL functions | |
| Color | operator*= (float) |
| scale the color by a float, keeping the RGB components between 0.0 and 1.0 | |
| Color | operator*= (const Color &) |
| Multiply two colors, component by component. | |
| Color | operator* (float) |
| scale the color by a float, keeping the RGB components between 0.0 and 1.0 | |
| Color | operator* (const Color &) |
| Multiply two colors, component by component. | |
| Color | operator+= (float) |
| add a float to the color, keeping the RGB components between 0.0 and 1.0 | |
| Color | operator+ (float) |
| add a float to the color, keeping the RGB components between 0.0 and 1.0 | |
| Color | operator+= (const Color &) |
| add a float to the color, keeping the RGB components between 0.0 and 1.0 | |
| Color | operator+ (const Color &) |
| add a float to the color, keeping the RGB components between 0.0 and 1.0 | |
| void | setComponentLowerLimit (float) |
| make sure that none of the color components is less than the provided limit | |
| void | setComponentUpperLimit (float) |
| make sure that none of the color components is more than the provided limit | |
| operator std::string () const | |
| converts the color's RGB values to a string | |
Private Attributes | |
| float | RGBA [4] |
| the components stored as an array of floats | |
A class to represent a color value by its RGBA components.
This class provides a single-stop interface to handle a color. It also provides some utility functions to work with colors.
The color's components are stored as an array of floats. Access to the raw array is provided, because the OpenGL functions I use to set a color need an array of floats as parameter.
| Color::Color | ( | float | _r, |
| float | _g, | ||
| float | _b, | ||
| float | _a = 1. |
||
| ) | [inline] |
| Color::Color | ( | const VecMath::Vector< 4 > & | x | ) | [inline] |
| Color::Color | ( | const QColor & | col | ) | [inline] |
| Color Color::operator* | ( | float | x | ) | [inline] |
scale the color by a float, keeping the RGB components between 0.0 and 1.0
| x | scaling factor |
Multiply two colors, component by component.
| x | scaling factor |
| Color Color::operator*= | ( | float | x | ) | [inline] |
scale the color by a float, keeping the RGB components between 0.0 and 1.0
| x | scaling factor |
References RGBA.
| Color Color::operator+ | ( | float | x | ) | [inline] |
add a float to the color, keeping the RGB components between 0.0 and 1.0
| x | added term |
add a float to the color, keeping the RGB components between 0.0 and 1.0
| x | added term |
| Color Color::operator+= | ( | float | x | ) | [inline] |
add a float to the color, keeping the RGB components between 0.0 and 1.0
| x | added term |
References RGBA.
add a float to the color, keeping the RGB components between 0.0 and 1.0
| x | added term |
References RGBA.
| void Color::setComponentLowerLimit | ( | float | l | ) | [inline] |
make sure that none of the color components is less than the provided limit
| l | the lower limit for all color components |
References RGBA.
Referenced by ColorManager::setRGB().

| void Color::setComponentUpperLimit | ( | float | u | ) | [inline] |
make sure that none of the color components is more than the provided limit
| u | the upper limit for all color components |
References RGBA.
1.7.4
-
Hosted by