Emergency 2017 Dokumentation  v3.0.1
qsf::Color3 Class Reference

Color class with red, green and blue component. More...

#include <Color3.h>

Public Member Functions

 Color3 ()
 Default constructor (all components are set to 0.0) More...
 
 Color3 (float r, float g, float b)
 Constructor. More...
 
 Color3 (uint8 r, uint8 g, uint8 b)
 Constructor. More...
 
 Color3 (const float rgb[])
 Constructor. More...
 
 Color3 (const uint8 rgb[])
 Constructor. More...
 
 Color3 (float luminance)
 Constructor. More...
 
 Color3 (uint8 luminance)
 Constructor. More...
 
 Color3 (const Color3 &source)
 Copy constructor. More...
 
 ~Color3 ()
 Destructor. More...
 
uint32 toUInt32 () const
 Maps this RGB floating point channels (0.0f to 1.0f range) to uint32. More...
 
uint32 toRGBUInt32 () const
 
uint32 toBGRUInt32 () const
 
std::string toHexColor (float alpha=1.0f) const
 Get a hex color string representation (including '#' at the beginning) from a "qsf::Color3". More...
 
void fromUInt32 (uint32 encodedColor)
 Maps from a uint32 to RGB floating point channels (0.0f to 1.0f range) More...
 
void getRGB (float &r, float &g, float &b) const
 Get the color component as float values. More...
 
void getRGB (uint8 &r, uint8 &g, uint8 &b) const
 Get the color component as integer values. More...
 
void setRGB (float r, float g, float b)
 Set the color components by using float values. More...
 
void setRGB (uint8 r, uint8 g, uint8 b)
 Set the color components by using integer values. More...
 
void getRGB (float rgb[]) const
 Get the color component as array of float values. More...
 
void getRGB (uint8 rgb[]) const
 Get the color component as array of integer values. More...
 
void setRGB (const float rgb[])
 Set the color components by using a reference to float values. More...
 
void setRGB (const uint8 rgb[])
 Set the color components by using a reference to integer values. More...
 
void setRGB (float value)
 Set all color component to the same float value. More...
 
void setRGB (uint8 value)
 Set all color component to the same integer value. More...
 
void saturate ()
 Clamps the color values between 0.0 and 1.0. More...
 
Color3operator= (const Color3 &otherColor)
 
Color3operator= (const float rgb[])
 
Color3operator= (float value)
 
 operator float * ()
 
 operator const float * () const
 
bool operator== (const Color3 &otherColor) const
 
bool operator!= (const Color3 &otherColor) const
 
bool operator== (float value) const
 
bool operator!= (float value) const
 
Color3 operator+ (const Color3 &otherColor) const
 
Color3 operator+ (float value) const
 
Color3operator+= (const Color3 &otherColor)
 
Color3operator+= (float value)
 
Color3 operator- () const
 
Color3 operator- (const Color3 &otherColor) const
 
Color3 operator- (float value) const
 
Color3operator-= (const Color3 &otherColor)
 
Color3operator-= (float value)
 
Color3 operator* (const Color3 &otherColor) const
 
Color3 operator* (float value) const
 
Color3operator*= (const Color3 &otherColor)
 
Color3operator*= (float value)
 
Color3 operator/ (const Color3 &otherColor) const
 
Color3 operator/ (float value) const
 
Color3operator/= (const Color3 &otherColor)
 
Color3operator/= (float value)
 
float & operator[] (int index)
 

Static Public Member Functions

static Color3 fromKelvin (float kelvin)
 Return a RGB color by using a given Kelvin value. More...
 
static Color3 interpolate (const Color3 &color1, const Color3 &color2, float factor)
 Interpolate between two RGB colors. More...
 

Public Attributes

union {
   float   color [3]
 
   struct {
      float   r
 
      float   g
 
      float   b
 
   } 
 
}; 
 

Static Public Attributes

static const Color3 TRANSPARENT
 0.0, 0.0, 0.0 More...
 
static const Color3 BLACK
 Black (sRGB="0 0 0", Hex="#000000") More...
 
static const Color3 WHITE
 White (sRGB="255 255 255", Hex="#FFFFFF") More...
 
static const Color3 RED
 Red (sRGB="255 0 0", Hex="#FF0000") More...
 
static const Color3 YELLOW
 Yellow (sRGB="255 255 0", Hex="#FFFF00") More...
 
static const Color3 GREEN
 Green (sRGB="0 255 0", Hex="#00FF00") More...
 
static const Color3 CYAN
 Cyan (sRGB="0 255 255", Hex="#00FFFF") More...
 
static const Color3 BLUE
 Blue (sRGB="0 0 255", Hex="#0000FF") More...
 
static const Color3 PINK
 Pink (sRGB="255 0 255", Hex="#FF00FF") More...
 
static const Color3 ORANGE
 Orange(sRGB="255 127 0", Hex="#FF7F00") More...
 
static const Color3 FUCHSIA
 Fuchsia, also called full magenta, bright pink or vivid pink (sRGB="255 0 255", Hex="#FF00FF") More...
 
static const Color3 MAROON
 Maroon, dark brownish-red color (sRGB="128 0 0", Hex="#800000") More...
 
static const Color3 OLIVE
 Olive, dark green/brown color (sRGB="128 128 0", Hex="#808000") More...
 
static const Color3 NAVY
 Navy, also called navy blue, very dark shade of the color blue (sRGB="0 0 128", Hex="#000080") More...
 
static const Color3 PURPLE
 Purple, color intermediate to red and blue (sRGB="128 0 128", Hex="#800080") More...
 
static const Color3 TEAL
 Teal, also called teal blue, greenish dark-blue color (sRGB="0 128 128", Hex="#008080") More...
 
static const Color3 GRAY
 Gray (sRGB="128 128 128", Hex="#808080") More...
 
static const Color3 SILVER
 Silver (sRGB="192 192 192", Hex="#C0C0C0") More...
 
static const Color3 LIME
 Lime, actually corresponds to the green primary of an RGB display (sRGB="0 255 0", Hex="#00FF00") More...
 

Detailed Description

Color class with red, green and blue component.

Definition at line 30 of file Color3.h.

Constructor & Destructor Documentation

qsf::Color3::Color3 ( )
inline

Default constructor (all components are set to 0.0)

Definition at line 32 of file Color3-inl.h.

qsf::Color3::Color3 ( float  r,
float  g,
float  b 
)
inline

Constructor.

Parameters
[in]rRed color component (0.0-1.0)
[in]gGreen color component (0.0-1.0)
[in]bBlue color component (0.0-1.0)

Definition at line 40 of file Color3-inl.h.

qsf::Color3::Color3 ( uint8  r,
uint8  g,
uint8  b 
)
inline

Constructor.

Parameters
[in]rRed color component (0-255)
[in]gGreen color component (0-255)
[in]bBlue color component (0-255)

Definition at line 48 of file Color3-inl.h.

qsf::Color3::Color3 ( const float  rgb[])
inline

Constructor.

Parameters
[in]rgbFloat array holding the color, must have 3 elements! (0.0-1.0)

Definition at line 56 of file Color3-inl.h.

qsf::Color3::Color3 ( const uint8  rgb[])
inline

Constructor.

Parameters
[in]rgbuint8 array holding the color, must have 3 elements! (0-255)

Definition at line 64 of file Color3-inl.h.

qsf::Color3::Color3 ( float  luminance)
inline

Constructor.

Parameters
[in]luminanceValue for all three color components (0.0-1.0)

Definition at line 72 of file Color3-inl.h.

qsf::Color3::Color3 ( uint8  luminance)
inline

Constructor.

Parameters
[in]luminanceValue for all three color components (0-255)

Definition at line 80 of file Color3-inl.h.

qsf::Color3::Color3 ( const Color3 source)
inlineexplicit

Copy constructor.

Parameters
[in]sourceSource color

Definition at line 88 of file Color3-inl.h.

qsf::Color3::~Color3 ( )
inline

Destructor.

Note
  • Not virtual by intent

Definition at line 96 of file Color3-inl.h.

Member Function Documentation

static Color3 qsf::Color3::fromKelvin ( float  kelvin)
static

Return a RGB color by using a given Kelvin value.

Parameters
[in]kelvinKelvin value to return as RGB color
Returns
RGB color from the given Kelvin value
Note
void qsf::Color3::fromUInt32 ( uint32  encodedColor)
inline

Maps from a uint32 to RGB floating point channels (0.0f to 1.0f range)

Parameters
[in]colorColor3 as uint32

Definition at line 125 of file Color3-inl.h.

void qsf::Color3::getRGB ( float &  r,
float &  g,
float &  b 
) const
inline

Get the color component as float values.

Parameters
[out]rWill receive the red color component (0.0-1.0)
[out]gWill receive the green color component (0.0-1.0)
[out]bWill receive the blue color component (0.0-1.0)

Definition at line 132 of file Color3-inl.h.

void qsf::Color3::getRGB ( uint8 r,
uint8 g,
uint8 b 
) const
inline

Get the color component as integer values.

Parameters
[out]rWill receive the red color component (0-255)
[out]gWill receive the green color component (0-255)
[out]bWill receive the blue color component (0-255)

Definition at line 139 of file Color3-inl.h.

void qsf::Color3::getRGB ( float  rgb[]) const
inline

Get the color component as array of float values.

Parameters
[out]colorReference to float array receiving the color values, must have 3 elements! (0.0-1.0)

Definition at line 160 of file Color3-inl.h.

void qsf::Color3::getRGB ( uint8  rgb[]) const
inline

Get the color component as array of integer values.

Parameters
[out]colorReference to uint8 array receiving the color values, must have 3 elements! (0-255)

Definition at line 167 of file Color3-inl.h.

Color3 qsf::Color3::interpolate ( const Color3 color1,
const Color3 color2,
float  factor 
)
inlinestatic

Interpolate between two RGB colors.

Parameters
[in]color1First color; this is returned with interpolation factor 0.0f
[in]color2Second color; this is returned with interpolation factor 1.0f
[in]factorInterpolation factor between 0.0f and 1.0f
Returns
Interpolated RGB color

Definition at line 23 of file Color3-inl.h.

qsf::Color3::operator const float * ( ) const
inline

Definition at line 252 of file Color3-inl.h.

qsf::Color3::operator float * ( )
inline

Definition at line 247 of file Color3-inl.h.

bool qsf::Color3::operator!= ( const Color3 otherColor) const
inline

Definition at line 266 of file Color3-inl.h.

bool qsf::Color3::operator!= ( float  value) const
inline

Definition at line 276 of file Color3-inl.h.

Color3 qsf::Color3::operator* ( const Color3 otherColor) const
inline

Definition at line 346 of file Color3-inl.h.

Color3 qsf::Color3::operator* ( float  value) const
inline

Definition at line 351 of file Color3-inl.h.

Color3 & qsf::Color3::operator*= ( const Color3 otherColor)
inline

Definition at line 356 of file Color3-inl.h.

Color3 & qsf::Color3::operator*= ( float  value)
inline

Definition at line 365 of file Color3-inl.h.

Color3 qsf::Color3::operator+ ( const Color3 otherColor) const
inline

Definition at line 285 of file Color3-inl.h.

Color3 qsf::Color3::operator+ ( float  value) const
inline

Definition at line 290 of file Color3-inl.h.

Color3 & qsf::Color3::operator+= ( const Color3 otherColor)
inline

Definition at line 295 of file Color3-inl.h.

Color3 & qsf::Color3::operator+= ( float  value)
inline

Definition at line 304 of file Color3-inl.h.

Color3 qsf::Color3::operator- ( ) const
inline

Definition at line 313 of file Color3-inl.h.

Color3 qsf::Color3::operator- ( const Color3 otherColor) const
inline

Definition at line 318 of file Color3-inl.h.

Color3 qsf::Color3::operator- ( float  value) const
inline

Definition at line 323 of file Color3-inl.h.

Color3 & qsf::Color3::operator-= ( const Color3 otherColor)
inline

Definition at line 328 of file Color3-inl.h.

Color3 & qsf::Color3::operator-= ( float  value)
inline

Definition at line 337 of file Color3-inl.h.

Color3 qsf::Color3::operator/ ( const Color3 otherColor) const
inline

Definition at line 374 of file Color3-inl.h.

Color3 qsf::Color3::operator/ ( float  value) const
inline

Definition at line 379 of file Color3-inl.h.

Color3 & qsf::Color3::operator/= ( const Color3 otherColor)
inline

Definition at line 384 of file Color3-inl.h.

Color3 & qsf::Color3::operator/= ( float  value)
inline

Definition at line 393 of file Color3-inl.h.

Color3 & qsf::Color3::operator= ( const Color3 otherColor)
inline

Definition at line 222 of file Color3-inl.h.

Color3 & qsf::Color3::operator= ( const float  rgb[])
inline

Definition at line 231 of file Color3-inl.h.

Color3 & qsf::Color3::operator= ( float  value)
inline

Definition at line 240 of file Color3-inl.h.

bool qsf::Color3::operator== ( const Color3 otherColor) const
inline

Definition at line 261 of file Color3-inl.h.

bool qsf::Color3::operator== ( float  value) const
inline

Definition at line 271 of file Color3-inl.h.

float & qsf::Color3::operator[] ( int  index)
inline

Definition at line 402 of file Color3-inl.h.

void qsf::Color3::saturate ( )
inline

Clamps the color values between 0.0 and 1.0.

Definition at line 202 of file Color3-inl.h.

void qsf::Color3::setRGB ( float  r,
float  g,
float  b 
)
inline

Set the color components by using float values.

Parameters
[in]rRed color component (0.0-1.0)
[in]gGreen color component (0.0-1.0)
[in]bBlue color component (0.0-1.0)

Definition at line 146 of file Color3-inl.h.

void qsf::Color3::setRGB ( uint8  r,
uint8  g,
uint8  b 
)
inline

Set the color components by using integer values.

Parameters
[in]rRed color component (0-255)
[in]gGreen color component (0-255)
[in]bBlue color component (0-255)

Definition at line 153 of file Color3-inl.h.

void qsf::Color3::setRGB ( const float  rgb[])
inline

Set the color components by using a reference to float values.

Parameters
[in]colorReference to float array containing the color value, must have 3 elements! (0.0-1.0)

Definition at line 174 of file Color3-inl.h.

void qsf::Color3::setRGB ( const uint8  rgb[])
inline

Set the color components by using a reference to integer values.

Parameters
[in]colorReference to uint8 array containing the color value, must have 3 elements! (0-255)

Definition at line 181 of file Color3-inl.h.

void qsf::Color3::setRGB ( float  value)
inline

Set all color component to the same float value.

Parameters
[in]valueValue for all three color component (0.0-1.0)

Definition at line 188 of file Color3-inl.h.

void qsf::Color3::setRGB ( uint8  value)
inline

Set all color component to the same integer value.

Parameters
[in]valueValue for all three color component (0-255)

Definition at line 195 of file Color3-inl.h.

uint32 qsf::Color3::toBGRUInt32 ( ) const
inline

Definition at line 116 of file Color3-inl.h.

std::string qsf::Color3::toHexColor ( float  alpha = 1.0f) const

Get a hex color string representation (including '#' at the beginning) from a "qsf::Color3".

uint32 qsf::Color3::toRGBUInt32 ( ) const
inline

Definition at line 107 of file Color3-inl.h.

uint32 qsf::Color3::toUInt32 ( ) const
inline

Maps this RGB floating point channels (0.0f to 1.0f range) to uint32.

Returns
This color as uint32

Definition at line 101 of file Color3-inl.h.

Member Data Documentation

union { ... }
float qsf::Color3::b

Definition at line 71 of file Color3.h.

const Color3 qsf::Color3::BLACK
static

Black (sRGB="0 0 0", Hex="#000000")

Definition at line 40 of file Color3.h.

const Color3 qsf::Color3::BLUE
static

Blue (sRGB="0 0 255", Hex="#0000FF")

Definition at line 46 of file Color3.h.

float qsf::Color3::color[3]

Definition at line 68 of file Color3.h.

const Color3 qsf::Color3::CYAN
static

Cyan (sRGB="0 255 255", Hex="#00FFFF")

Definition at line 45 of file Color3.h.

const Color3 qsf::Color3::FUCHSIA
static

Fuchsia, also called full magenta, bright pink or vivid pink (sRGB="255 0 255", Hex="#FF00FF")

Definition at line 51 of file Color3.h.

float qsf::Color3::g

Definition at line 71 of file Color3.h.

const Color3 qsf::Color3::GRAY
static

Gray (sRGB="128 128 128", Hex="#808080")

Definition at line 57 of file Color3.h.

const Color3 qsf::Color3::GREEN
static

Green (sRGB="0 255 0", Hex="#00FF00")

Definition at line 44 of file Color3.h.

const Color3 qsf::Color3::LIME
static

Lime, actually corresponds to the green primary of an RGB display (sRGB="0 255 0", Hex="#00FF00")

Definition at line 59 of file Color3.h.

const Color3 qsf::Color3::MAROON
static

Maroon, dark brownish-red color (sRGB="128 0 0", Hex="#800000")

Definition at line 52 of file Color3.h.

const Color3 qsf::Color3::NAVY
static

Navy, also called navy blue, very dark shade of the color blue (sRGB="0 0 128", Hex="#000080")

Definition at line 54 of file Color3.h.

const Color3 qsf::Color3::OLIVE
static

Olive, dark green/brown color (sRGB="128 128 0", Hex="#808000")

Definition at line 53 of file Color3.h.

const Color3 qsf::Color3::ORANGE
static

Orange(sRGB="255 127 0", Hex="#FF7F00")

Definition at line 48 of file Color3.h.

const Color3 qsf::Color3::PINK
static

Pink (sRGB="255 0 255", Hex="#FF00FF")

Definition at line 47 of file Color3.h.

const Color3 qsf::Color3::PURPLE
static

Purple, color intermediate to red and blue (sRGB="128 0 128", Hex="#800080")

Definition at line 55 of file Color3.h.

float qsf::Color3::r

Definition at line 71 of file Color3.h.

const Color3 qsf::Color3::RED
static

Red (sRGB="255 0 0", Hex="#FF0000")

Definition at line 42 of file Color3.h.

const Color3 qsf::Color3::SILVER
static

Silver (sRGB="192 192 192", Hex="#C0C0C0")

Definition at line 58 of file Color3.h.

const Color3 qsf::Color3::TEAL
static

Teal, also called teal blue, greenish dark-blue color (sRGB="0 128 128", Hex="#008080")

Definition at line 56 of file Color3.h.

const Color3 qsf::Color3::TRANSPARENT
static

0.0, 0.0, 0.0

Definition at line 39 of file Color3.h.

const Color3 qsf::Color3::WHITE
static

White (sRGB="255 255 255", Hex="#FFFFFF")

Definition at line 41 of file Color3.h.

const Color3 qsf::Color3::YELLOW
static

Yellow (sRGB="255 255 0", Hex="#FFFF00")

Definition at line 43 of file Color3.h.


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