Ogre::ColourValue Class Reference
Core » General

Class representing colour. More...

`#include <OgreColourValue.h>`

## Public Member Functions

| ColourValue (float red=1.0f, float green=1.0f, float blue=1.0f, float alpha=1.0f)
ABGR | getAsABGR (void) const
| Retrieves colours as ABGR. More...
ARGB | getAsARGB (void) const
| Retrieves colour as ARGB. More...
BGRA | getAsBGRA (void) const
| Retrieves colour as BGRA. More...
RGBA | getAsRGBA (void) const
| Retrieves colour as RGBA. More...
void | getHSB (Real *hue, Real *saturation, Real *brightness) const
| Convert the current colour to Hue, Saturation and Brightness values. More...
bool | operator!= (const ColourValue &rhs) const
ColourValue | operator* (const float fScalar) const
ColourValue | operator* (const ColourValue &rhs) const
ColourValue & | operator*= (const float fScalar)
ColourValue | operator+ (const ColourValue &rkVector) const
ColourValue & | operator+= (const ColourValue &rkVector)
ColourValue | operator- (const ColourValue &rkVector) const
ColourValue & | operator-= (const ColourValue &rkVector)
ColourValue | operator/ (const ColourValue &rhs) const
ColourValue | operator/ (const float fScalar) const
ColourValue & | operator/= (const float fScalar)
bool | operator== (const ColourValue &rhs) const
float | operator[] (const size_t i) const
| Array accessor operator. More...
float & | operator[] (const size_t i)
| Array accessor operator. More...
float * | ptr ()
| Pointer accessor for direct copying. More...
const float * | ptr () const
| Pointer accessor for direct copying. More...
void | saturate (void)
| Clamps colour value to the range [0, 1]. More...
ColourValue | saturateCopy (void) const
| As saturate, except that this colour value is unaffected and the saturated colour value is returned as a copy. More...
void | setAsABGR (const ABGR val)
| Sets colour as ABGR. More...
void | setAsARGB (const ARGB val)
| Sets colour as ARGB. More...
void | setAsBGRA (const BGRA val)
| Sets colour as BGRA. More...
void | setAsRGBA (const RGBA val)
| Sets colour as RGBA. More...
void | setHSB (Real hue, Real saturation, Real brightness)
| Set a colour value from Hue, Saturation and Brightness. More...

## Public Attributes

float | a
float | b
float | g
float | r

## Static Public Attributes

static const ColourValue | Black
static const ColourValue | Blue
static const ColourValue | Green
static const ColourValue | Red
static const ColourValue | White
static const ColourValue | ZERO

## 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. More...

## 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 57 of file OgreColourValue.h.

## Constructor & Destructor Documentation

## ColourValue()

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

explicit

Definition at line 67 of file OgreColourValue.h.

References Ogre::operator!=(), and Ogre::operator==().

## Member Function Documentation

## getAsABGR()

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

Retrieves colours as ABGR.

## getAsARGB()

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

Retrieves colour as ARGB.

## getAsBGRA()

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

Retrieves colour as BGRA.

## getAsRGBA()

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

Retrieves colour as RGBA.

## getHSB()

void Ogre::ColourValue::getHSB | ( | Real * | hue,
|  | Real * | saturation,
|  | Real * | brightness
| ) |  | const

Convert the current colour to Hue, Saturation and Brightness values.

Parameters

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

## operator!=()

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

## operator*() [1/2]

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

Definition at line 196 of file OgreColourValue.h.

References a, b, g, and r.

## operator*() [2/2]

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

Definition at line 208 of file OgreColourValue.h.

References a, b, g, and r.

## operator*=()

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

Definition at line 280 of file OgreColourValue.h.

## operator+()

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

Definition at line 172 of file OgreColourValue.h.

References a, b, g, and r.

## operator+=()

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

Definition at line 260 of file OgreColourValue.h.

References a, b, g, and r.

## operator-()

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

Definition at line 184 of file OgreColourValue.h.

References a, b, g, and r.

## operator-=()

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

Definition at line 270 of file OgreColourValue.h.

References a, b, g, and r.

## operator/() [1/2]

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

Definition at line 220 of file OgreColourValue.h.

References a, b, g, and r.

## operator/() [2/2]

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

Definition at line 232 of file OgreColourValue.h.

References a, b, g, and r.

## operator/=()

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

Definition at line 289 of file OgreColourValue.h.

References _OgreExport.

## operator==()

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

## operator[]() [1/2]

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

Array accessor operator.

Definition at line 144 of file OgreColourValue.h.

## operator[]() [2/2]

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

Array accessor operator.

Definition at line 152 of file OgreColourValue.h.

## ptr() [1/2]

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

Pointer accessor for direct copying.

Definition at line 160 of file OgreColourValue.h.

## ptr() [2/2]

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

Pointer accessor for direct copying.

Definition at line 165 of file OgreColourValue.h.

## saturate()

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

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

Definition at line 111 of file OgreColourValue.h.

Referenced by saturateCopy().

## 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 136 of file OgreColourValue.h.

References saturate().

## setAsABGR()

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

Sets colour as ABGR.

## setAsARGB()

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

Sets colour as ARGB.

## setAsBGRA()

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

Sets colour as BGRA.

## setAsRGBA()

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

Sets colour as RGBA.

## setHSB()

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

## operator*

ColourValue operator* | ( | const float | fScalar,
|  | const ColourValue & | rkVector
| ) |  |

friend

Definition at line 247 of file OgreColourValue.h.

## operator<<

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

friend

Function for writing to a stream.

Definition at line 322 of file OgreColourValue.h.

## Member Data Documentation

## a

float Ogre::ColourValue::a

Definition at line 76 of file OgreColourValue.h.

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

## b

float Ogre::ColourValue::b

Definition at line 76 of file OgreColourValue.h.

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

## Black

const ColourValue Ogre::ColourValue::Black

static

Definition at line 61 of file OgreColourValue.h.

Referenced by Ogre::RenderSystem::getNativeShadingLanguageVersion(), Ogre::StringConverter::parseAngle(), and Ogre::Viewport::Listener::viewportDestroyed().

## Blue

const ColourValue Ogre::ColourValue::Blue

static

Definition at line 65 of file OgreColourValue.h.

## g

float Ogre::ColourValue::g

Definition at line 76 of file OgreColourValue.h.

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

## Green

const ColourValue Ogre::ColourValue::Green

static

Definition at line 64 of file OgreColourValue.h.

## r

float Ogre::ColourValue::r

Definition at line 76 of file OgreColourValue.h.

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

## Red

const ColourValue Ogre::ColourValue::Red

static

Definition at line 63 of file OgreColourValue.h.

## White

const ColourValue Ogre::ColourValue::White

static

Definition at line 62 of file OgreColourValue.h.

Referenced by Ogre::Technique::getParent(), Ogre::Pass::getPolygonModeOverrideable(), Ogre::SceneManager::getSkyDomeGenParameters(), Ogre::Material::getUnsupportedTechniquesExplanation(), and Ogre::TextureUnitState::setGamma().

## ZERO

const ColourValue Ogre::ColourValue::ZERO

static

Definition at line 60 of file OgreColourValue.h.

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

- OgreColourValue.h

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.