#include <Color.hpp>
Public Member Functions | |
Color () | |
Color (MY_TYPE _r, MY_TYPE _g, MY_TYPE _b, MY_TYPE _a) | |
Color (MY_TYPE _r, MY_TYPE _g, MY_TYPE _b) | |
Color (MY_TYPE _r, MY_TYPE _g) | |
Color (MY_TYPE _r) | |
template<typename MY_TYPE_2 , int MY_TYPE_SIZE_2> | |
Color (const etk::Color< MY_TYPE_2, MY_TYPE_SIZE_2 > &_obj) | |
Color (const std::string &_input) | |
Color< MY_TYPE, MY_TYPE_SIZE > & | operator= (const etk::Color< MY_TYPE, MY_TYPE_SIZE > &_input) |
bool | operator!= (const etk::Color< MY_TYPE, MY_TYPE_SIZE > &_obj) const |
bool | operator== (const etk::Color< MY_TYPE, MY_TYPE_SIZE > &_obj) const |
uint32_t | get () const |
void | set (MY_TYPE _r, MY_TYPE _g, MY_TYPE _b, MY_TYPE _a) |
void | set (MY_TYPE _r, MY_TYPE _g, MY_TYPE _b) |
void | set (MY_TYPE _r, MY_TYPE _g) |
void | set (MY_TYPE _r) |
std::string | getHexString () const |
std::string | getString () const |
MY_TYPE | r () const |
MY_TYPE | g () const |
MY_TYPE | b () const |
MY_TYPE | a () const |
void | setR (MY_TYPE _r) |
void | setG (MY_TYPE _g) |
void | setB (MY_TYPE _b) |
void | setA (MY_TYPE _a) |
const etk::Color< MY_TYPE, MY_TYPE_SIZE > & | operator+= (const etk::Color< MY_TYPE, MY_TYPE_SIZE > &_obj) |
etk::Color< MY_TYPE, MY_TYPE_SIZE > | operator+ (const etk::Color< MY_TYPE, MY_TYPE_SIZE > &_obj) const |
etk::Color< MY_TYPE, MY_TYPE_SIZE > & | operator*= (const etk::Color< MY_TYPE, MY_TYPE_SIZE > &_obj) |
etk::Color< MY_TYPE, MY_TYPE_SIZE > & | operator*= (const MY_TYPE _val) |
etk::Color< MY_TYPE, MY_TYPE_SIZE > | operator* (const etk::Color< MY_TYPE, MY_TYPE_SIZE > &_obj) const |
etk::Color< MY_TYPE, MY_TYPE_SIZE > | operator* (const MY_TYPE _val) const |
template<> | |
uint32_t | get () const |
Static Public Attributes | |
static const Color< MY_TYPE, MY_TYPE_SIZE > | emptyColor |
static const MY_TYPE | defaultAlpha |
Detailed Description
template<typename MY_TYPE = uint8_t, int MY_TYPE_SIZE = 4>
class etk::Color< MY_TYPE, MY_TYPE_SIZE >
The color class is a template to abstract the color implementation choice.
It is important to note that the color choice denpznd on the level of developent. For example :
- Graphic application use:
- Image in 3/4 bytes for rgb(a)
- Color description in char : '#F6780FFF' or the equivalent number:0xF6780FFF
- middleware will mainely use a the 4 separate value with 1 byte for each.
- graphic interface (openGL) store image in 1/2/3/4 bytes color and interpolate it in 'n' float. And note that the user color is sored in float.
Then with this class we abstract the transformation format and set an easy same way to use the color independing of the developpement level.
Some of the basic color is defined in the namespace: etk::color.
- Parameters
-
[in] MY_TYPE Type of the internal template value. The generic value is uint8_t and float [in] MY_TYPE_SIZE Number of value in the color
Constructor & Destructor Documentation
§ Color() [1/7]
|
inline |
Constructor. It does not initialise element of class.
§ Color() [2/7]
|
inline |
Contructor with request initialisation.
- Parameters
-
[in] _r Red color. [in] _g Green color. [in] _b Blue color. [in] _a Alpha blending.
§ Color() [3/7]
|
inline |
Contructor with request initialisation.
- Parameters
-
[in] _r Red color. [in] _g Green color. [in] _b Blue color.
§ Color() [4/7]
|
inline |
Contructor with request initialisation.
- Parameters
-
[in] _r Red color. [in] _g Green color.
§ Color() [5/7]
|
inline |
Contructor with request initialisation.
- Parameters
-
[in] _r Red color.
§ Color() [6/7]
etk::Color< MY_TYPE, MY_TYPE_SIZE >::Color | ( | const etk::Color< MY_TYPE_2, MY_TYPE_SIZE_2 > & | _obj | ) |
Copy contructor or convert contructor.
- Parameters
-
[in] _obj Element to copy in this new color class.
§ Color() [7/7]
etk::Color< MY_TYPE, MY_TYPE_SIZE >::Color | ( | const std::string & | _input | ) |
String extractor constructor.
- Parameters
-
[in] _input Color string to parse. it can be : "#rrggbb", "rgb", "rrggbbaa", "rgba", "blueviolet" ...
Member Function Documentation
§ a()
|
inline |
Get alpha blending.
- Returns
- The alpha blending.
§ b()
|
inline |
Get blue color.
- Returns
- The blue color.
§ g()
|
inline |
Get green color.
- Returns
- The green color.
§ get() [1/2]
uint32_t etk::Color< MY_TYPE, MY_TYPE_SIZE >::get | ( | ) | const |
Get the Generic uint32_t value of the color.
- Returns
- Color in unsigned integer
§ get() [2/2]
uint32_t etk::Color< uint8_t, 4 >::get | ( | ) | const |
Specify that the Get intance is specialized for uint8_t/4 template.
- Returns
- unsignad iterger containing the color value in RGBA
§ getHexString()
|
inline |
Convert the color in an hexedecimal string ("0xFEDCBA98")
- Returns
- The formated string
§ getString()
|
inline |
Convert the color in an generic string value ("#FEDCBA98")
- Returns
- The formated string
§ operator!=()
|
inline |
Different comparaison operator.
- Parameters
-
[in] _obj Color object to compare.
- Returns
- true This is not the same color
- false This is the same color.
§ operator*() [1/2]
|
inline |
Operator*= Multiply 2 color together.
- Parameters
-
[in] _obj Reference on the external object
- Returns
- New vector containing the value
§ operator*() [2/2]
|
inline |
Operator*= Multiply the color With a specific value.
- Parameters
-
[in] _val Value to multiply the color
- Returns
- New vector containing the value
§ operator*=() [1/2]
|
inline |
Operator*= Multiply 2 color together.
- Parameters
-
[in] _obj Reference on the external object
- Returns
- Local reference of the vector
§ operator*=() [2/2]
|
inline |
Operator*= Multiply the color With a specific value.
- Parameters
-
[in] _val Value to multiply the color
- Returns
- Local reference of the vector
§ operator+()
|
inline |
Operator+ Addition an other etk::color with this one.
- Parameters
-
[in] _obj Reference on the external object
- Returns
- New vector containing the value
§ operator+=()
|
inline |
Operator+= Addition an other etk::color with this one.
- Parameters
-
[in] _obj Reference on the external object
- Returns
- Local reference of the vector additionned
§ operator=()
|
inline |
Asignemement operator.
- Parameters
-
[in] _input Color object to set in this class.
- Returns
- reference on this element.
§ operator==()
|
inline |
Equality comparaison operator.
- Parameters
-
[in] _obj Color object to compare.
- Returns
- true This is the same color.
- false The color are different.
§ r()
|
inline |
Get red color.
- Returns
- The red color.
§ set() [1/4]
|
inline |
Set the specified color elements.
- Parameters
-
[in] _r Red color. [in] _g Green color. [in] _b Blue color. [in] _a Alpha blending.
§ set() [2/4]
|
inline |
Set the specified color elements.
- Parameters
-
[in] _r Red color. [in] _g Green color. [in] _b Blue color.
§ set() [3/4]
|
inline |
Set the specified color elements.
- Parameters
-
[in] _r Red color. [in] _g Green color.
§ set() [4/4]
|
inline |
Set the specified color elements.
- Parameters
-
[in] _r Red color.
§ setA()
|
inline |
Set alpha blending.
- Parameters
-
[in] _a The alpha blending to set.
§ setB()
|
inline |
Set blue color.
- Parameters
-
[in] _b The blue color to set.
§ setG()
|
inline |
Set green color.
- Parameters
-
[in] _g The green color to set.
§ setR()
|
inline |
Set red color.
- Parameters
-
[in] _r The red color to set.
Member Data Documentation
§ defaultAlpha
|
static |
Default alpha value.
§ emptyColor
|
static |
To auto fill with no data in all case.
The documentation for this class was generated from the following file:
- framework/atria-soft/etk/etk/Color.hpp