Uranus  1.0.1.0
Uranus is a GameEngine written in C++
Loading...
Searching...
No Matches
tson::Color< T > Class Template Reference
Collaboration diagram for tson::Color< T >:
[legend]

Public Member Functions

 Color (const std::string &color)
 
 Color (T red, T green, T blue, T alpha)
 
Color< float > asFloat ()
 
Color< uint8_t > asInt ()
 
bool operator!= (const Color &rhs) const
 
bool operator== (const Color &rhs) const
 
bool operator== (const std::string &rhs) const
 

Data Fields

a
 
b
 
g
 
r
 

Private Member Functions

void parseHexString (const std::string &color)
 

Constructor & Destructor Documentation

◆ Color()

template<typename T >
tson::Color< T >::Color ( red,
green,
blue,
alpha 
)
inline

Create a new color in rgba (red, green, blue, alpha) format

Template Parameters
Tthe template type for each channel. Usually uint8_t (8-bit int) or float.
Parameters
redRed channel
greenGreen channel
blueBlue channel
alphaAlpha channel

Member Function Documentation

◆ asFloat()

template<typename T >
tson::Colorf tson::Color< T >::asFloat
inline

Gets the Color as a float. Only useful if the template related to the current color is NOT float

Template Parameters
TThe template type
Returns
If the T type is float, the value will be returned as a copy of itself. Else: All values will be divided by 255 before returning.

◆ asInt()

template<typename T >
tson::Colori tson::Color< T >::asInt
inline

Gets the Color as an 32-bit variable, where each channel is 8-bit. Only useful if the template related to the current color is NOT already 8-bit int

Template Parameters
TThe template type
Returns
If the T type is float, the value of each channel will be multiplied by 255. Else: The value will be returned as a copy of itself.

Field Documentation

◆ a

template<typename T >
T tson::Color< T >::a

Alpha

◆ b

template<typename T >
T tson::Color< T >::b

Blue

◆ g

template<typename T >
T tson::Color< T >::g

Green

◆ r

template<typename T >
T tson::Color< T >::r

Red


The documentation for this class was generated from the following file: