Tileson 1.4.0
A helpful json parser for Tiled maps
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
tson::Color< T > Class Template Reference

#include <Color.hpp>

Public Member Functions

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

Public Attributes

r
 
g
 
b
 
a
 

Constructor & Destructor Documentation

◆ Color() [1/3]

template<typename T >
tson::Color< T >::Color ( const std::string &  color)
inlineexplicit

◆ Color() [2/3]

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

◆ Color() [3/3]

template<typename T >
tson::Color< T >::Color ( )
inline

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.

◆ operator!=()

template<typename T >
bool tson::Color< T >::operator!= ( const Color< T > &  rhs) const
inline

◆ operator==() [1/2]

template<typename T >
bool tson::Color< T >::operator== ( const Color< T > &  rhs) const
inline

◆ operator==() [2/2]

template<typename T >
bool tson::Color< T >::operator== ( const std::string &  rhs) const
inline

Member Data 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: