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

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

# Ogre::ColourValue Class Reference

Class representing colour. More...

`#include <OgreColourValue.h>`

List of all members.

## Public Member Functions
| ColourValue (float red=1.0f, float green=1.0f, float blue=1.0f, float alpha=1.0f)
bool | operator== (const ColourValue &rhs) const
bool | operator!= (const ColourValue &rhs) const
RGBA | getAsRGBA (void) const
| Retrieves colour as RGBA.
ARGB | getAsARGB (void) const
| Retrieves colour as ARGB.
BGRA | getAsBGRA (void) const
| Retrieves colour as BGRA.
ABGR | getAsABGR (void) const
| Retrieves colours as ABGR.
void | setAsRGBA (const RGBA val)
| Sets colour as RGBA.
void | setAsARGB (const ARGB val)
| Sets colour as ARGB.
void | setAsBGRA (const BGRA val)
| Sets colour as BGRA.
void | setAsABGR (const ABGR val)
| Sets colour as ABGR.
void | saturate (void)
| Clamps colour value to the range [0, 1].
ColourValue | saturateCopy (void) const
| As saturate, except that this colour value is unaffected and the saturated colour value is returned as a copy.
float | operator[] (const size_t i) const
| Array accessor operator.
float & | operator[] (const size_t i)
| Array accessor operator.
float * | ptr ()
| Pointer accessor for direct copying.
const float * | ptr () const
| Pointer accessor for direct copying.
ColourValue | operator+ (const ColourValue &rkVector) const
ColourValue | operator- (const ColourValue &rkVector) const
ColourValue | operator * (const float fScalar) const
ColourValue | operator * (const ColourValue &rhs) const
ColourValue | operator/ (const ColourValue &rhs) const
ColourValue | operator/ (const float fScalar) const
ColourValue & | operator+= (const ColourValue &rkVector)
ColourValue & | operator-= (const ColourValue &rkVector)
ColourValue & | operator *= (const float fScalar)
ColourValue & | operator/= (const float fScalar)
void | setHSB (Real hue, Real saturation, Real brightness)
| Set a colour value from Hue, Saturation and Brightness.
## Public Attributes
float | r
float | g
float | b
float | a
## Static Public Attributes
static const ColourValue | ZERO
static const ColourValue | Black
static const ColourValue | White
static const ColourValue | Red
static const ColourValue | Green
static const ColourValue | Blue
## Friends
ColourValue | operator * (const float fScalar, const ColourValue &rkVector)
_OgreExport friend std::ostream & | operator<< (std::ostream &o, const ColourValue &c)
| Function for writing to a stream.

## Detailed Description

Class representing colour.

Remarks:
  Colour is represented as 4 components, each of which is a floating-point value from 0.0 to 1.0.

  The 3 'normal' colour components are red, green and blue, a higher number indicating greater amounts of that component in the colour. The forth component is the 'alpha' value, which represents transparency. In this case, 0.0 is completely transparent and 1.0 is fully opaque.

Definition at line 52 of file OgreColourValue.h.

## Constructor & Destructor Documentation

Ogre::ColourValue::ColourValue | ( | float | red = `1.0f`,
|  | float | green = `1.0f`,
|  | float | blue = `1.0f`,
|  | float | alpha = `1.0f` |
| ) |  |  | `[explicit]`

Definition at line 62 of file OgreColourValue.h.

## Member Function Documentation

bool Ogre::ColourValue::operator== | ( | const ColourValue & | rhs | ) | const

bool Ogre::ColourValue::operator!= | ( | const ColourValue & | rhs | ) | const

RGBA Ogre::ColourValue::getAsRGBA | ( | void |  | ) | const

Retrieves colour as RGBA.

ARGB Ogre::ColourValue::getAsARGB | ( | void |  | ) | const

Retrieves colour as ARGB.

BGRA Ogre::ColourValue::getAsBGRA | ( | void |  | ) | const

Retrieves colour as BGRA.

ABGR Ogre::ColourValue::getAsABGR | ( | void |  | ) | const

Retrieves colours as ABGR.

void Ogre::ColourValue::setAsRGBA | ( | const RGBA | val | ) |

Sets colour as RGBA.

void Ogre::ColourValue::setAsARGB | ( | const ARGB | val | ) |

Sets colour as ARGB.

void Ogre::ColourValue::setAsBGRA | ( | const BGRA | val | ) |

Sets colour as BGRA.

void Ogre::ColourValue::setAsABGR | ( | const ABGR | val | ) |

Sets colour as ABGR.

void Ogre::ColourValue::saturate | ( | void |  | ) |

Clamps colour value to the range [0, 1].

Definition at line 106 of file OgreColourValue.h.

Referenced by saturateCopy().

ColourValue Ogre::ColourValue::saturateCopy | ( | void |  | ) | const

As saturate, except that this colour value is unaffected and the saturated colour value is returned as a copy.

Definition at line 131 of file OgreColourValue.h.

References saturate().

float Ogre::ColourValue::operator[] | ( | const size_t | i | ) | const

Array accessor operator.

Definition at line 139 of file OgreColourValue.h.

float& Ogre::ColourValue::operator[] | ( | const size_t | i | ) |

Array accessor operator.

Definition at line 147 of file OgreColourValue.h.

float* Ogre::ColourValue::ptr | ( |  | ) |

Pointer accessor for direct copying.

Definition at line 155 of file OgreColourValue.h.

const float* Ogre::ColourValue::ptr | ( |  | ) | const

Pointer accessor for direct copying.

Definition at line 160 of file OgreColourValue.h.

ColourValue Ogre::ColourValue::operator+ | ( | const ColourValue & | rkVector | ) | const

Definition at line 167 of file OgreColourValue.h.

References a, b, g, and r.

ColourValue Ogre::ColourValue::operator- | ( | const ColourValue & | rkVector | ) | const

Definition at line 179 of file OgreColourValue.h.

References a, b, g, and r.

ColourValue Ogre::ColourValue::operator * | ( | const float | fScalar | ) | const

Definition at line 191 of file OgreColourValue.h.

References a, b, g, and r.

ColourValue Ogre::ColourValue::operator * | ( | const ColourValue & | rhs | ) | const

Definition at line 203 of file OgreColourValue.h.

References a, b, g, and r.

ColourValue Ogre::ColourValue::operator/ | ( | const ColourValue & | rhs | ) | const

Definition at line 215 of file OgreColourValue.h.

References a, b, g, and r.

ColourValue Ogre::ColourValue::operator/ | ( | const float | fScalar | ) | const

Definition at line 227 of file OgreColourValue.h.

References a, b, g, and r.

ColourValue& Ogre::ColourValue::operator+= | ( | const ColourValue & | rkVector | ) |

Definition at line 255 of file OgreColourValue.h.

References a, b, g, and r.

ColourValue& Ogre::ColourValue::operator-= | ( | const ColourValue & | rkVector | ) |

Definition at line 265 of file OgreColourValue.h.

References a, b, g, and r.

ColourValue& Ogre::ColourValue::operator *= | ( | const float | fScalar | ) |

Definition at line 275 of file OgreColourValue.h.

ColourValue& Ogre::ColourValue::operator/= | ( | const float | fScalar | ) |

Definition at line 284 of file OgreColourValue.h.

void Ogre::ColourValue::setHSB | ( | Real | hue,
|  | Real | saturation,
|  | Real | brightness |
| ) |  |  |

Set a colour value from Hue, Saturation and Brightness.

Parameters:

  | hue | Hue value, scaled to the [0,1] range as opposed to the 0-360
  | saturation | Saturation level, [0,1]
  | brightness | Brightness level, [0,1]

## Friends And Related Function Documentation

ColourValue operator * | ( | const float | fScalar,
|  | const ColourValue & | rkVector |
| ) |  |  | `[friend]`

Definition at line 242 of file OgreColourValue.h.

_OgreExport friend std::ostream& operator<< | ( | std::ostream & | o,
|  | const ColourValue & | c |
| ) |  |  | `[friend]`

Function for writing to a stream.

Definition at line 309 of file OgreColourValue.h.

## Member Data Documentation

const ColourValue Ogre::ColourValue::ZERO`[static]`

Definition at line 55 of file OgreColourValue.h.

const ColourValue Ogre::ColourValue::Black`[static]`

Definition at line 56 of file OgreColourValue.h.

const ColourValue Ogre::ColourValue::White`[static]`

Definition at line 57 of file OgreColourValue.h.

const ColourValue Ogre::ColourValue::Red`[static]`

Definition at line 58 of file OgreColourValue.h.

const ColourValue Ogre::ColourValue::Green`[static]`

Definition at line 59 of file OgreColourValue.h.

const ColourValue Ogre::ColourValue::Blue`[static]`

Definition at line 60 of file OgreColourValue.h.

float Ogre::ColourValue::r

Definition at line 71 of file OgreColourValue.h.

Referenced by operator *(), operator+(), operator+=(), operator-(), operator-=(), operator/(), and Ogre::AnimableValue::setAsBaseValue().

float Ogre::ColourValue::g

Definition at line 71 of file OgreColourValue.h.

Referenced by operator *(), operator+(), operator+=(), operator-(), operator-=(), operator/(), and Ogre::AnimableValue::setAsBaseValue().

float Ogre::ColourValue::b

Definition at line 71 of file OgreColourValue.h.

Referenced by operator *(), operator+(), operator+=(), operator-(), operator-=(), operator/(), and Ogre::AnimableValue::setAsBaseValue().

float Ogre::ColourValue::a

Definition at line 71 of file OgreColourValue.h.

Referenced by operator *(), operator+(), operator+=(), operator-(), operator-=(), operator/(), and Ogre::AnimableValue::setAsBaseValue().

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

- OgreColourValue.h

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Mon Jun 16 12:49:20 2008