Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | Namespace Members | Class Members | Related Pages

Color Class Template Reference
[XEngineCore Library]

List of all members.

Detailed Description

template<wxUint32 RedShift, wxUint32 GreenShift, wxUint32 BlueShift, wxUint32 AlphaShift>
class XEngine::Core::Color< RedShift, GreenShift, BlueShift, AlphaShift >

A little helper template for handling ARGB colors as a 32-bit integer value. The four template parameters specify the shift of the 4 components of a color. So this class can be used to express any 32-bit ARGB color. The only allowed shift values are 0, 8, 16 and 24.

The byte order of the components is always in native endian format. So on a little endian CPU, the ColorARGB class stores the four components in the order B, G, R, A in the 32-bit word.

Warning:
This class must always have the size sizeof(wxUint32) and no virtual functions.


Public Member Functions

 Color (wxUint32 color=0xffffffff)
 Constructs a color from the given dword value.
 Color (wxByte byRed, wxByte byGreen, wxByte byBlue, wxByte byAlpha=0xff)
 Constructs a color from the 4 given bytes.
 Color (const ColorReal &color)
 Constructs a color from the given ColorReal.
void Set (wxByte byRed, wxByte byGreen, wxByte byBlue, wxByte byAlpha=0xff)
 Sets this color using the 4 given bytes.
void SetAlpha (wxByte byAlpha)
 Sets the alpha component of this color.
void SetRed (wxByte byRed)
 Sets the red component of this color.
void SetGreen (wxByte byGreen)
 Sets the green component of this color.
void SetBlue (wxByte byBlue)
 Sets the blue component of this color.
wxByte GetAlpha () const
 Returns the alpha component of this color.
wxByte GetRed () const
 Returns the red component of this color.
wxByte GetGreen () const
 Returns the green component of this color.
wxByte GetBlue () const
 Returns the blue component of this color.
 operator wxUint32 () const
 Cast operator to wxUint32.
 operator wxUint32 * ()
 Cast operator to a pointer to wxUint32.
 operator const wxUint32 * () const
 Cast operator to a const-pointer to wxUint32.
Coloroperator= (const ColorReal &color)
 Assignment operator for a ColorReal.
bool operator== (const Color< RedShift, GreenShift, BlueShift, AlphaShift > &color) const
 Equality operator.
bool operator!= (const Color< RedShift, GreenShift, BlueShift, AlphaShift > &color) const
 Inequality operator.

Public Attributes

wxUint32 m_color
 The color as 32-bit value.


Constructor & Destructor Documentation

Color wxUint32  color = 0xffffffff  ) 
 

Constructs a Color object from the given 32-bit value.

Color wxByte  byRed,
wxByte  byGreen,
wxByte  byBlue,
wxByte  byAlpha = 0xff
 

Constructs a Color object from the 4 given bytes.

Color const ColorReal color  ) 
 

Constructs a Color object from the given ColorReal object.


Member Function Documentation

wxByte GetAlpha  )  const
 

Returns the alpha component of this color.

wxByte GetBlue  )  const
 

Returns the blue component of this color.

wxByte GetGreen  )  const
 

Returns the green component of this color.

wxByte GetRed  )  const
 

Returns the red component of this color.

operator const wxUint32 *  )  const
 

Casts this Color object to a wxUint32 const-pointer. Basically returns a pointer to m_color.

operator wxUint32  )  const
 

Casts this Color object to a wxUint32 32-bit value.

operator wxUint32 *  ) 
 

Casts this Color object to a wxUint32 pointer. Basically returns a pointer to m_color.

bool operator!= const Color< RedShift, GreenShift, BlueShift, AlphaShift > &  color  )  const
 

Inequality operator. Overridden to get rid of some ambiguities.

Color< RedShift, GreenShift, BlueShift, AlphaShift > & operator= const ColorReal color  ) 
 

Converts the given ColorReal object to a Color object and assigns it to this object.

bool operator== const Color< RedShift, GreenShift, BlueShift, AlphaShift > &  color  )  const
 

Equality operator. Overridden to get rid of some ambiguities.

void Set wxByte  byRed,
wxByte  byGreen,
wxByte  byBlue,
wxByte  byAlpha = 0xff
 

Sets this Color object using the 4 given bytes.

void SetAlpha wxByte  byAlpha  ) 
 

Sets the alpha component of this color.

void SetBlue wxByte  byBlue  ) 
 

Sets the blue component of this color.

void SetGreen wxByte  byGreen  ) 
 

Sets the green component of this color.

void SetRed wxByte  byRed  ) 
 

Sets the red component of this color.


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