- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Exponent::GUI::Basics::CAlphaColour Class Reference

Inheritance diagram for Exponent::GUI::Basics::CAlphaColour:

List of all members.

## Detailed Description

Representation of an RGBA colour.

Date:
  20/09/2004

Author:
  Paul Chana

Version:
  1.0.0 Initial version

Author:
  Paul Chana

Version:
  1.0.1 Added inplace getAsColourFunction

Author:
  Paul Chana

Version:
  1.0.2 Made the equality operator const

Note:
  All contents of this source code are copyright 2005 Exp Digital Uk.
  This source file is covered by the licence conditions of the Infinity API. You should have recieved a copy
  with the source code. If you didnt, please refer to http://www.expdigital.co.uk All content is the Intellectual property of Exp Digital Uk.
  Certain sections of this code may come from other sources. They are credited where applicable.
  If you have comments, suggestions or bug reports please visit http://support.expdigital.co.uk

Id
  CAlphaColour.hpp,v 1.4 2007/02/08 21:07:54 paul Exp

Definition at line 36 of file CAlphaColour.hpp.

## Public Member Functions

- CAlphaColour (const CAlphaColour &colour)
- CAlphaColour ()
- CAlphaColour (const unsigned long red, const unsigned long green, const unsigned long blue, const unsigned long alpha=255)
- void darkenColour ()
- unsigned long getAlpha () const
- void getAsColour (CColour &colour) const
- CColour * getAsColour () const
- virtual void getObjectDescription (char *string, const long size) const
- void lightenColour ()
- CAlphaColour & operator= (const CColour &colour)
- CAlphaColour & operator= (const CAlphaColour &colour)
- bool operator== (const CAlphaColour &colour) const
- void setAlpha (const unsigned long alpha)
- virtual void setColour (const unsigned long red, const unsigned long green, const unsigned long blue, const unsigned long alpha)
- virtual ~CAlphaColour ()

## Static Public Member Functions

- static FORCEINLINE void alphaBlend (CColour &destination, const CColour &background, const CColour &source, const unsigned long alpha)
- static FORCEINLINE void alphaBlend (CColour &destination, const CAlphaColour &background, const CAlphaColour &source)

## Static Public Attributes

- static const CAlphaColour CALPHACOLOUR_BLACK
- static const CAlphaColour CALPHACOLOUR_BLUE
- static const CAlphaColour CALPHACOLOUR_DARK_GREY
- static const CAlphaColour CALPHACOLOUR_GREEN
- static const CAlphaColour CALPHACOLOUR_LIGHT_GREY
- static const CAlphaColour CALPHACOLOUR_ORANGE
- static const CAlphaColour CALPHACOLOUR_PINK
- static const CAlphaColour CALPHACOLOUR_PURPLE
- static const CAlphaColour CALPHACOLOUR_RED
- static const CAlphaColour CALPHACOLOUR_TURQUOISE
- static const CAlphaColour CALPHACOLOUR_WHITE
- static const CAlphaColour CALPHACOLOUR_YELLOW

## Static Protected Member Functions

- static FORCEINLINE unsigned
  long alphaComposite (const unsigned long foreground, const unsigned long background, const unsigned long alpha)

## Protected Attributes

- unsigned long m_alpha

## Constructor & Destructor Documentation

Exponent::GUI::Basics::CAlphaColour::CAlphaColour | ( | const unsigned long | red,
|  | const unsigned long | green,
|  | const unsigned long | blue,
|  | const unsigned long | alpha = `255` |
| ) |  |  |

Construction

Parameters:

  | red | The red component
  | green | The green component
  | blue | The blue component
  | alpha | The alpha component

Exponent::GUI::Basics::CAlphaColour::CAlphaColour | ( |  | ) |

Construction

Exponent::GUI::Basics::CAlphaColour::CAlphaColour | ( | const CAlphaColour & | colour | ) |

Copy construction

Parameters:

  | colour | The colour to copy

virtual Exponent::GUI::Basics::CAlphaColour::~CAlphaColour | ( |  | ) | `[virtual]`

Destruction

## Member Function Documentation

static FORCEINLINE void Exponent::GUI::Basics::CAlphaColour::alphaBlend | ( | CColour & | destination,
|  | const CColour & | background,
|  | const CColour & | source,
|  | const unsigned long | alpha |
| ) |  |  | `[inline, static]`

Alpha blend two colours with a fixed alpha

Parameters:

  | destination | The destination colour, on return this is filled with the alpha blended colour
  | background | The background colour
  | source | The top level colour
  | alpha | The alpha level to process with

Definition at line 180 of file CAlphaColour.hpp.

References alphaComposite(), Exponent::GUI::Basics::CColour::getBlue(), Exponent::GUI::Basics::CColour::getGreen(), Exponent::GUI::Basics::CColour::getRed(), Exponent::GUI::Basics::CColour::setBlue(), Exponent::GUI::Basics::CColour::setGreen(), and Exponent::GUI::Basics::CColour::setRed().

static FORCEINLINE void Exponent::GUI::Basics::CAlphaColour::alphaBlend | ( | CColour & | destination,
|  | const CAlphaColour & | background,
|  | const CAlphaColour & | source |
| ) |  |  | `[inline, static]`

Alpha blend two colours

Parameters:

  | destination | The destination colour, on return this is filled with the alpha blended colour
  | background | The background colour
  | source | The top level colour

Definition at line 166 of file CAlphaColour.hpp.

References alphaComposite(), getAlpha(), Exponent::GUI::Basics::CColour::getBlue(), Exponent::GUI::Basics::CColour::getGreen(), Exponent::GUI::Basics::CColour::getRed(), Exponent::GUI::Basics::CColour::setBlue(), Exponent::GUI::Basics::CColour::setGreen(), and Exponent::GUI::Basics::CColour::setRed().

static FORCEINLINE unsigned long Exponent::GUI::Basics::CAlphaColour::alphaComposite | ( | const unsigned long | foreground,
|  | const unsigned long | background,
|  | const unsigned long | alpha |
| ) |  |  | `[inline, static, protected]`

Alpha composite a single value

Parameters:

  | foreground | The front colour
  | background | The background colour
  | alpha | The alpha value

Definition at line 208 of file CAlphaColour.hpp.

Referenced by alphaBlend().

void Exponent::GUI::Basics::CAlphaColour::darkenColour | ( |  | ) |

Darken the colour

unsigned long Exponent::GUI::Basics::CAlphaColour::getAlpha | ( |  | ) | const`[inline]`

Get the alpha value

Return values:

  | unsigned | long The alpha value

Definition at line 121 of file CAlphaColour.hpp.

References m_alpha.

Referenced by alphaBlend().

void Exponent::GUI::Basics::CAlphaColour::getAsColour | ( | CColour & | colour | ) | const

Get as a colour

Parameters:

  | colour | On return this is filled with the colour

CColour* Exponent::GUI::Basics::CAlphaColour::getAsColour | ( |  | ) | const

Get as a colour

Return values:

  | CColour* | The colour, you must dispose

virtual void Exponent::GUI::Basics::CAlphaColour::getObjectDescription | ( | char * | string,
|  | const long | size |
| ) |  |  | const`[virtual]`

Get a description of the object

Parameters:

  | string | On return is filled with the description
  | size | The size of the stirng

Reimplemented from Exponent::GUI::Basics::CColour.

void Exponent::GUI::Basics::CAlphaColour::lightenColour | ( |  | ) |

Lighten the colour

CAlphaColour& Exponent::GUI::Basics::CAlphaColour::operator= | ( | const CColour & | colour | ) |

Assignment operator

Parameters:

  | colour | The colour to copy with alpha 255

Reimplemented from Exponent::GUI::Basics::CColour.

CAlphaColour& Exponent::GUI::Basics::CAlphaColour::operator= | ( | const CAlphaColour & | colour | ) |

Assignment operator

Parameters:

  | colour | The colour to copy

bool Exponent::GUI::Basics::CAlphaColour::operator== | ( | const CAlphaColour & | colour | ) | const

Equality operator

Parameters:

  | colour | The colour to compare to

Return values:

  | bool | True if colours are the same, false otherwise

void Exponent::GUI::Basics::CAlphaColour::setAlpha | ( | const unsigned long | alpha | ) | `[inline]`

Set the alpha value

Parameters:

  | alpha | The alpha component

Definition at line 115 of file CAlphaColour.hpp.

References m_alpha.

virtual void Exponent::GUI::Basics::CAlphaColour::setColour | ( | const unsigned long | red,
|  | const unsigned long | green,
|  | const unsigned long | blue,
|  | const unsigned long | alpha |
| ) |  |  | `[virtual]`

Set all the values

Parameters:

  | red | The red component
  | green | The green component
  | blue | The blue component
  | alpha | The alpha component

## Member Data Documentation

const CAlphaColour Exponent::GUI::Basics::CAlphaColour::CALPHACOLOUR_BLACK`[static]`

Black

Definition at line 48 of file CAlphaColour.hpp.

const CAlphaColour Exponent::GUI::Basics::CAlphaColour::CALPHACOLOUR_BLUE`[static]`

Blue

Definition at line 52 of file CAlphaColour.hpp.

const CAlphaColour Exponent::GUI::Basics::CAlphaColour::CALPHACOLOUR_DARK_GREY`[static]`

Dark grey

Definition at line 59 of file CAlphaColour.hpp.

const CAlphaColour Exponent::GUI::Basics::CAlphaColour::CALPHACOLOUR_GREEN`[static]`

Green

Definition at line 51 of file CAlphaColour.hpp.

const CAlphaColour Exponent::GUI::Basics::CAlphaColour::CALPHACOLOUR_LIGHT_GREY`[static]`

Light grey

Definition at line 58 of file CAlphaColour.hpp.

const CAlphaColour Exponent::GUI::Basics::CAlphaColour::CALPHACOLOUR_ORANGE`[static]`

Orange

Definition at line 54 of file CAlphaColour.hpp.

const CAlphaColour Exponent::GUI::Basics::CAlphaColour::CALPHACOLOUR_PINK`[static]`

Pink

Definition at line 57 of file CAlphaColour.hpp.

const CAlphaColour Exponent::GUI::Basics::CAlphaColour::CALPHACOLOUR_PURPLE`[static]`

Purple

Definition at line 56 of file CAlphaColour.hpp.

const CAlphaColour Exponent::GUI::Basics::CAlphaColour::CALPHACOLOUR_RED`[static]`

Red

Definition at line 50 of file CAlphaColour.hpp.

const CAlphaColour Exponent::GUI::Basics::CAlphaColour::CALPHACOLOUR_TURQUOISE`[static]`

Turqoise

Definition at line 55 of file CAlphaColour.hpp.

const CAlphaColour Exponent::GUI::Basics::CAlphaColour::CALPHACOLOUR_WHITE`[static]`

White

Definition at line 49 of file CAlphaColour.hpp.

const CAlphaColour Exponent::GUI::Basics::CAlphaColour::CALPHACOLOUR_YELLOW`[static]`

Yellow

Definition at line 53 of file CAlphaColour.hpp.

unsigned long Exponent::GUI::Basics::CAlphaColour::m_alpha`[protected]`

Alpha value (0 - 255)

Definition at line 216 of file CAlphaColour.hpp.

Referenced by getAlpha(), and setAlpha().