A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color. More...
#include <RGBAColor.h>
Public Member Functions | |
Initializer Methods | |
Methods related to instantiation and destruction. | |
RGBAColor () | |
Default constructor of a new color. More... | |
RGBAColor (int rgba) | |
It initializes a new color with the given value. More... | |
RGBAColor (int r, int g, int b, int a) | |
It initializes a new color. More... | |
RGBAColor (const std::string &hexColor) | |
It initializes a new color from a given hex RGB-encoded string. More... | |
~RGBAColor () | |
Destructor. More... | |
Accessor methods | |
Methods used to get or set properties. | |
te::color::RGBAColor & | operator= (const RGBAColor &color) |
Assigns a copy of a color to this color, and returns a reference to it. More... | |
te::color::RGBAColor & | operator= (const int &rgba) |
Assigns a copy of a color to this color. More... | |
bool | operator== (const RGBAColor &color) const |
It compares the colors are iqual. More... | |
bool | operator!= (const RGBAColor &color) const |
It compares the colors are different. More... | |
int | getRed () const |
It returns the red component color value (a value from 0 to 255). More... | |
int | getGreen () const |
It returns the green component color value (a value from 0 to 255). More... | |
int | getBlue () const |
It returns the blue component color value (a value from 0 to 255). More... | |
int | getAlpha () const |
It returns the alpha component color value (a value from 0 to 255). More... | |
void | getRgba (int *r, int *g, int *b, int *a=0) const |
It gets the color value. More... | |
int | getRgba () const |
It returns the color value (0xAARRGGBB). More... | |
void | setColor (const std::string &hexColor) |
It sets the color using a two hexadecimal RGB-encoded color. More... | |
std::string | getColor () const |
It gets the color encoded using two hexadecimal digits per primary-color component, in the order Red, Green, Blue, prefixed with a hash (#) sign. More... | |
void | setColor (int r, int g, int b, int a=255) |
It sets the color. More... | |
void | setColor (int rgba) |
It sets the color. More... | |
Private Attributes | |
int | m_rgba |
It returns the internal representation as a 32-bits RGBA color. More... | |
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Internally the color is represented by an integer of 32-bits as the following:
Definition at line 57 of file RGBAColor.h.
|
inline |
Default constructor of a new color.
Definition at line 243 of file RGBAColor.h.
|
inline |
It initializes a new color with the given value.
rgba | The color encoded as an integer. |
Definition at line 248 of file RGBAColor.h.
|
inline |
It initializes a new color.
r | Red component (range from 0 to 255). |
g | Green component (range from 0 to 255). |
b | Blue component (range from 0 to 255). |
a | Alpha component. A range from 0 to 255 (see the macro TE_OPAQUE and TE_TRANSPARENT for the values of totally transparent and totally opaque). |
Definition at line 253 of file RGBAColor.h.
|
inline |
It initializes a new color from a given hex RGB-encoded string.
hexColor | The color value is RGB-encoded using two hexadecimal digits per primary-color component, in the order Red, Green, Blue, prefixed with a hash (#) sign. The hexadecimal digits between A and F may be in uppercase or lowercase. |
Definition at line 262 of file RGBAColor.h.
References setColor().
|
inline |
Destructor.
Definition at line 267 of file RGBAColor.h.
|
inline |
It returns the alpha component color value (a value from 0 to 255).
Definition at line 310 of file RGBAColor.h.
References m_rgba.
|
inline |
It returns the blue component color value (a value from 0 to 255).
Definition at line 305 of file RGBAColor.h.
References m_rgba.
Referenced by getColor().
|
inline |
It gets the color encoded using two hexadecimal digits per primary-color component, in the order Red, Green, Blue, prefixed with a hash (#) sign.
Definition at line 349 of file RGBAColor.h.
References getBlue(), getGreen(), and getRed().
|
inline |
It returns the green component color value (a value from 0 to 255).
Definition at line 300 of file RGBAColor.h.
References m_rgba.
Referenced by getColor().
|
inline |
It returns the red component color value (a value from 0 to 255).
Definition at line 295 of file RGBAColor.h.
References m_rgba.
Referenced by getColor().
|
inline |
It gets the color value.
r | Red component. |
g | Green component. |
b | Blue component. |
a | Alpha component. |
Definition at line 315 of file RGBAColor.h.
References m_rgba.
|
inline |
It returns the color value (0xAARRGGBB).
Definition at line 324 of file RGBAColor.h.
References m_rgba.
|
inline |
It compares the colors are different.
color | The rgba color to be compared. |
Definition at line 290 of file RGBAColor.h.
References operator==().
|
inline |
Assigns a copy of a color to this color, and returns a reference to it.
color | The rgba color to be copied. |
Definition at line 271 of file RGBAColor.h.
References m_rgba.
|
inline |
Assigns a copy of a color to this color.
rgba | the 32-bit RGBA (Red-Green-Blue-Alpha channel) color to be copied. |
Definition at line 277 of file RGBAColor.h.
References m_rgba.
|
inline |
It compares the colors are iqual.
color | The rgba color to be compared. |
Definition at line 283 of file RGBAColor.h.
References m_rgba.
Referenced by operator!=().
|
inline |
It sets the color using a two hexadecimal RGB-encoded color.
hexColor | The color value is RGB-encoded using two hexadecimal digits per primary-color component, in the order Red, Green, Blue, prefixed with a hash (#) sign. The hexadecimal digits between A and F may be in either uppercase or lowercase. |
Definition at line 329 of file RGBAColor.h.
References te::common::GetDecimalFromHexNotCS(), and TE_OPAQUE.
Referenced by RGBAColor().
|
inline |
It sets the color.
r | Red component (range from 0 to 255). |
g | Green component (range from 0 to 255). |
b | Blue component (range from 0 to 255). |
a | Alpha component. A range from 0 to 255 (see the macro TE_OPAQUE and TE_TRANSPARENT for the values of totally transparent and totally opaque). |
Definition at line 357 of file RGBAColor.h.
References m_rgba.
|
inline |
It sets the color.
rgba | The color represented by a number of 4 bytes, where the values ??are in the following order: alpha, red, green and blue. The alpha is the most significant byte. |
Definition at line 362 of file RGBAColor.h.
References m_rgba.
|
private |
It returns the internal representation as a 32-bits RGBA color.
Definition at line 240 of file RGBAColor.h.
Referenced by getAlpha(), getBlue(), getGreen(), getRed(), getRgba(), operator=(), operator==(), and setColor().