Emergency 20 Dokumentation  4.1.0
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
qsf::Color3 Class Reference

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

#include <Color3.h>

Collaboration diagram for qsf::Color3:
Collaboration graph
[legend]

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.

Constructor & Destructor Documentation

qsf::Color3::Color3 ( )
inline

Default constructor (all components are set to 0.0)

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)
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)
qsf::Color3::Color3 ( const float  rgb[])
inline

Constructor.

Parameters
[in]rgbFloat array holding the color, must have 3 elements! (0.0-1.0)
qsf::Color3::Color3 ( const uint8  rgb[])
inline

Constructor.

Parameters
[in]rgbuint8 array holding the color, must have 3 elements! (0-255)
qsf::Color3::Color3 ( float  luminance)
inline

Constructor.

Parameters
[in]luminanceValue for all three color components (0.0-1.0)
qsf::Color3::Color3 ( uint8  luminance)
inline

Constructor.

Parameters
[in]luminanceValue for all three color components (0-255)
qsf::Color3::Color3 ( const Color3 source)
inlineexplicit

Copy constructor.

Parameters
[in]sourceSource color
qsf::Color3::~Color3 ( )
inline

Destructor.

Note
  • Not virtual by intent

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
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)
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)
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)
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)
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
qsf::Color3::operator const float * ( ) const
inline
qsf::Color3::operator float * ( )
inline
bool qsf::Color3::operator!= ( const Color3 otherColor) const
inline
bool qsf::Color3::operator!= ( float  value) const
inline
Color3 qsf::Color3::operator* ( const Color3 otherColor) const
inline
Color3 qsf::Color3::operator* ( float  value) const
inline
Color3 & qsf::Color3::operator*= ( const Color3 otherColor)
inline
Color3 & qsf::Color3::operator*= ( float  value)
inline
Color3 qsf::Color3::operator+ ( const Color3 otherColor) const
inline
Color3 qsf::Color3::operator+ ( float  value) const
inline
Color3 & qsf::Color3::operator+= ( const Color3 otherColor)
inline
Color3 & qsf::Color3::operator+= ( float  value)
inline
Color3 qsf::Color3::operator- ( ) const
inline
Color3 qsf::Color3::operator- ( const Color3 otherColor) const
inline
Color3 qsf::Color3::operator- ( float  value) const
inline
Color3 & qsf::Color3::operator-= ( const Color3 otherColor)
inline
Color3 & qsf::Color3::operator-= ( float  value)
inline
Color3 qsf::Color3::operator/ ( const Color3 otherColor) const
inline
Color3 qsf::Color3::operator/ ( float  value) const
inline
Color3 & qsf::Color3::operator/= ( const Color3 otherColor)
inline
Color3 & qsf::Color3::operator/= ( float  value)
inline
Color3 & qsf::Color3::operator= ( const Color3 otherColor)
inline
Color3 & qsf::Color3::operator= ( const float  rgb[])
inline
Color3 & qsf::Color3::operator= ( float  value)
inline
bool qsf::Color3::operator== ( const Color3 otherColor) const
inline
bool qsf::Color3::operator== ( float  value) const
inline
float & qsf::Color3::operator[] ( int  index)
inline
void qsf::Color3::saturate ( )
inline

Clamps the color values between 0.0 and 1.0.

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)
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)
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)
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)
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)
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)
uint32 qsf::Color3::toBGRUInt32 ( ) const
inline
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
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

Member Data Documentation

union { ... }
float qsf::Color3::b
const Color3 qsf::Color3::BLACK
static

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

const Color3 qsf::Color3::BLUE
static

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

float qsf::Color3::color[3]
const Color3 qsf::Color3::CYAN
static

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

const Color3 qsf::Color3::FUCHSIA
static

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

float qsf::Color3::g
const Color3 qsf::Color3::GRAY
static

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

const Color3 qsf::Color3::GREEN
static

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

const Color3 qsf::Color3::LIME
static

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

const Color3 qsf::Color3::MAROON
static

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

const Color3 qsf::Color3::NAVY
static

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

const Color3 qsf::Color3::OLIVE
static

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

const Color3 qsf::Color3::ORANGE
static

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

const Color3 qsf::Color3::PINK
static

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

const Color3 qsf::Color3::PURPLE
static

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

float qsf::Color3::r
const Color3 qsf::Color3::RED
static

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

const Color3 qsf::Color3::SILVER
static

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

const Color3 qsf::Color3::TEAL
static

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

const Color3 qsf::Color3::TRANSPARENT
static

0.0, 0.0, 0.0

const Color3 qsf::Color3::WHITE
static

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

const Color3 qsf::Color3::YELLOW
static

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


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