Class for storing an RGBA color. More...
Public Member Functions | |
Color4f () | |
Constructs a default color object. More... | |
Color4f (const Color4f &other) | |
Constructs a color as a copy of other. More... | |
Color4f (float r, float g, float b, float a) | |
Constructs a color using the color components r, g, b, a. More... | |
Color4f & | operator= (const Color4f &rhs) |
Assigns rhs to this color and returns a reference to this color. More... | |
bool | operator== (const Color4f &rhs) const |
Returns true if rhs is equal to this color; otherwise returns false. More... | |
bool | operator!= (const Color4f &rhs) const |
Returns true if rhs is not equal to this color; otherwise returns false. More... | |
const float & | r () const |
Red color component. More... | |
const float & | g () const |
Green color component. More... | |
const float & | b () const |
Blue color component. More... | |
const float & | a () const |
Alpha color component. More... | |
float & | r () |
Red color component. More... | |
float & | g () |
Green color component. More... | |
float & | b () |
Blue color component. More... | |
float & | a () |
Alpha color component. More... | |
bool | isValid () const |
Returns true if the color is valid (all components in the range 0.0 -> 1.0) More... | |
Class for storing an RGBA color.
Each color component is floating point value in the interval [0.0, 1.0].
cee::Color4f::Color4f | ( | ) |
Constructs a default color object.
Initializes RGB color components to 0.0. Alpha is set to 1.0
cee::Color4f::Color4f | ( | const Color4f & | other | ) |
Constructs a color as a copy of other.
cee::Color4f::Color4f | ( | float | r, |
float | g, | ||
float | b, | ||
float | a | ||
) |
Constructs a color using the color components r, g, b, a.
const float & cee::Color4f::a | ( | ) | const |
Alpha color component.
Used for setting or getting the alpha color component of the color, e.g.
color.a = 0.5f;
float alpha = color.a;
float & cee::Color4f::a | ( | ) |
Alpha color component.
Used for setting or getting the alpha color component of the color, e.g.
color.a = 0.5f;
float alpha = color.a;
const float & cee::Color4f::b | ( | ) | const |
Blue color component.
Used for setting or getting the blue color component of the color, e.g.
color.b = 0.5f;
float blue = color.b;
float & cee::Color4f::b | ( | ) |
Blue color component.
Used for setting or getting the blue color component of the color, e.g.
color.b = 0.5f;
float blue = color.b;
const float & cee::Color4f::g | ( | ) | const |
Green color component.
Used for setting or getting the green color component of the color, e.g.
color.g = 0.5f;
float green = color.g;
float & cee::Color4f::g | ( | ) |
Green color component.
Used for setting or getting the green color component of the color, e.g.
color.g = 0.5f;
float green = color.g;
bool cee::Color4f::isValid | ( | ) | const |
Returns true if the color is valid (all components in the range 0.0 -> 1.0)
bool cee::Color4f::operator!= | ( | const Color4f & | rhs | ) | const |
Returns true if rhs is not equal to this color; otherwise returns false.
Assigns rhs to this color and returns a reference to this color.
bool cee::Color4f::operator== | ( | const Color4f & | rhs | ) | const |
Returns true if rhs is equal to this color; otherwise returns false.
const float & cee::Color4f::r | ( | ) | const |
Red color component.
Used for setting or getting the red color component of the color, e.g.
color.r = 0.5f;
float red = color.r;
float & cee::Color4f::r | ( | ) |
Red color component.
Used for setting or getting the red color component of the color, e.g.
color.r = 0.5f;
float red = color.r;