libRocket
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Public Attributes | List of all members
Rocket::Core::Colour< ColourType, AlphaDefault > Class Template Reference

#include <Colour.h>

Public Member Functions

 Colour ()
 Lightweight, non-initialising constructor. More...
 
 Colour (ColourType red, ColourType green, ColourType blue, ColourType alpha=AlphaDefault)
 
Colour operator+ (const Colour &rhs) const
 
Colour operator- (const Colour &rhs) const
 
Colour operator* (const Colour &rhs) const
 
Colour operator* (float rhs) const
 
Colour operator/ (float rhs) const
 
void operator+= (const Colour &rhs)
 
void operator-= (const Colour &rhs)
 
void operator*= (const Colour &rhs)
 
void operator*= (float rhs)
 
void operator/= (float rhs)
 
bool operator== (const Colour &rhs)
 
bool operator!= (const Colour &rhs)
 
 operator const ColourType * () const
 
 operator ColourType * ()
 
template<>
Colour< float, 1 > ROCKETCORE_API operator* (const Colour< float, 1 > &rhs) const
 
template<>
Colour< byte, 255 > ROCKETCORE_API operator* (const Colour< byte, 255 > &rhs) const
 
template<>
void ROCKETCORE_API operator*= (const Colour &rhs)
 
template<>
void ROCKETCORE_API operator*= (const Colour &rhs)
 

Public Attributes

ColourType red
 
ColourType green
 
ColourType blue
 
ColourType alpha
 

Detailed Description

template<typename ColourType, int AlphaDefault>
class Rocket::Core::Colour< ColourType, AlphaDefault >

Templated class for a four-component RGBA colour.

Author
Peter Curry

Constructor & Destructor Documentation

template<typename ColourType , int AlphaDefault>
Rocket::Core::Colour< ColourType, AlphaDefault >::Colour ( )
inline

Lightweight, non-initialising constructor.

template<typename ColourType, int AlphaDefault>
Rocket::Core::Colour< ColourType, AlphaDefault >::Colour ( ColourType  red,
ColourType  green,
ColourType  blue,
ColourType  alpha = AlphaDefault 
)
inline

Initialising constructor.

Parameters
[in]redInitial red value of the colour.
[in]greenInitial green value of the colour.
[in]blueInitial blue value of the colour.
[in]alphaInitial alpha value of the colour.

Member Function Documentation

template<typename ColourType, int AlphaDefault>
Rocket::Core::Colour< ColourType, AlphaDefault >::operator ColourType * ( )
inline

Constant auto-cast operator.

Returns
A constant pointer to the first value.
template<typename ColourType, int AlphaDefault>
Rocket::Core::Colour< ColourType, AlphaDefault >::operator const ColourType * ( ) const
inline

Auto-cast operator.

Returns
A pointer to the first value.
template<typename ColourType, int AlphaDefault>
bool Rocket::Core::Colour< ColourType, AlphaDefault >::operator!= ( const Colour< ColourType, AlphaDefault > &  rhs)
inline

Inequality operator.

Parameters
[in]rhsThe colour to compare this against.
Returns
True if the two colours are not equal, false otherwise.
template<typename ColourType, int AlphaDefault>
Colour Rocket::Core::Colour< ColourType, AlphaDefault >::operator* ( const Colour< ColourType, AlphaDefault > &  rhs) const

Returns the result of multiplying this colour by another.

Parameters
[in]rhsThe colour to multiply by.
Returns
The result of the multiplication.
template<typename ColourType , int AlphaDefault>
Colour< ColourType, AlphaDefault > Rocket::Core::Colour< ColourType, AlphaDefault >::operator* ( float  rhs) const
inline

Returns the result of multiplying this colour component-wise by a scalar.

Parameters
[in]rhsThe scalar value to multiply by.
Returns
The result of the scale.
template<>
Colour< float, 1 > ROCKETCORE_API Rocket::Core::Colour< float, 1 >::operator* ( const Colour< float, 1 > &  rhs) const
template<>
Colour< byte, 255 > ROCKETCORE_API Rocket::Core::Colour< byte, 255 >::operator* ( const Colour< byte, 255 > &  rhs) const
template<typename ColourType, int AlphaDefault>
void Rocket::Core::Colour< ColourType, AlphaDefault >::operator*= ( const Colour< ColourType, AlphaDefault > &  rhs)

Multiplies this colour component-wise with another in-place.

Parameters
[in]rhsThe colour to multiply by.
Returns
This colour, post-operation.
template<typename ColourType , int AlphaDefault>
void Rocket::Core::Colour< ColourType, AlphaDefault >::operator*= ( float  rhs)
inline

Scales this colour component-wise in-place.

Parameters
[in]rhsThe value to scale this colours's components by.
template<>
void ROCKETCORE_API Rocket::Core::Colour< float, 1 >::operator*= ( const Colour< ColourType, AlphaDefault > &  rhs)
template<>
void ROCKETCORE_API Rocket::Core::Colour< byte, 255 >::operator*= ( const Colour< ColourType, AlphaDefault > &  rhs)
template<typename ColourType , int AlphaDefault>
Colour< ColourType, AlphaDefault > Rocket::Core::Colour< ColourType, AlphaDefault >::operator+ ( const Colour< ColourType, AlphaDefault > &  rhs) const
inline

Returns the sum of this colour and another. This does not saturate the channels.

Parameters
[in]rhsThe colour to add this to.
Returns
The sum of the two colours.
template<typename ColourType , int AlphaDefault>
void Rocket::Core::Colour< ColourType, AlphaDefault >::operator+= ( const Colour< ColourType, AlphaDefault > &  rhs)
inline

Adds another colour to this in-place. This does not saturate the channels.

Parameters
[in]rhsThe colour to add.
template<typename ColourType , int AlphaDefault>
Colour< ColourType, AlphaDefault > Rocket::Core::Colour< ColourType, AlphaDefault >::operator- ( const Colour< ColourType, AlphaDefault > &  rhs) const
inline

Returns the result of subtracting another colour from this colour.

Parameters
[in]rhsThe colour to subtract from this colour.
Returns
The result of the subtraction.
template<typename ColourType , int AlphaDefault>
void Rocket::Core::Colour< ColourType, AlphaDefault >::operator-= ( const Colour< ColourType, AlphaDefault > &  rhs)
inline

Subtracts another colour from this in-place.

Parameters
[in]rhsThe colour to subtract.
template<typename ColourType , int AlphaDefault>
Colour< ColourType, AlphaDefault > Rocket::Core::Colour< ColourType, AlphaDefault >::operator/ ( float  rhs) const
inline

Returns the result of dividing this colour component-wise by a scalar.

Parameters
[in]rhsThe scalar value to divide by.
Returns
The result of the scale.
template<typename ColourType , int AlphaDefault>
void Rocket::Core::Colour< ColourType, AlphaDefault >::operator/= ( float  rhs)
inline

Scales this colour component-wise in-place by the inverse of a value.

Parameters
[in]rhsThe value to divide this colour's components by.
template<typename ColourType, int AlphaDefault>
bool Rocket::Core::Colour< ColourType, AlphaDefault >::operator== ( const Colour< ColourType, AlphaDefault > &  rhs)
inline

Equality operator.

Parameters
[in]rhsThe colour to compare this against.
Returns
True if the two colours are equal, false otherwise.

Member Data Documentation

template<typename ColourType, int AlphaDefault>
ColourType Rocket::Core::Colour< ColourType, AlphaDefault >::alpha
template<typename ColourType, int AlphaDefault>
ColourType Rocket::Core::Colour< ColourType, AlphaDefault >::blue
template<typename ColourType, int AlphaDefault>
ColourType Rocket::Core::Colour< ColourType, AlphaDefault >::green
template<typename ColourType, int AlphaDefault>
ColourType Rocket::Core::Colour< ColourType, AlphaDefault >::red

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