Rocket::Core::Colour< ColourType, AlphaDefault > Class Template Reference

#include <Colour.h>

Collaboration diagram for Rocket::Core::Colour< ColourType, AlphaDefault >:

Public Member Functions

 Colour ()
 Lightweight, non-initialising constructor.
 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)

Data Fields

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 ( ColourType  red,
ColourType  green,
ColourType  blue,
ColourType  alpha = AlphaDefault 
) [inline]

Initialising constructor.

Parameters:
[in] red Initial red value of the colour.
[in] green Initial green value of the colour.
[in] blue Initial blue value of the colour.
[in] alpha Initial alpha value of the colour.


Member Function Documentation

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] rhs The colour to add this to.
Returns:
The sum of the two colours.

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] rhs The colour to subtract from this colour.
Returns:
The result of the subtraction.

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] rhs The 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] rhs The scalar value to multiply by.
Returns:
The result of the scale.

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] rhs The scalar value to divide by.
Returns:
The result of the scale.

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] rhs The colour to add.

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] rhs The colour to subtract.

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] rhs The 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] rhs The value to scale this colours's components by.

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] rhs The 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] rhs The colour to compare this against.
Returns:
True if the two colours are equal, false otherwise.

template<typename ColourType, int AlphaDefault>
bool Rocket::Core::Colour< ColourType, AlphaDefault >::operator!= ( const Colour< ColourType, AlphaDefault > &  rhs  )  [inline]

Inequality operator.

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

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>
Rocket::Core::Colour< ColourType, AlphaDefault >::operator ColourType * (  )  [inline]

Constant auto-cast operator.

Returns:
A constant pointer to the first value.


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