version 3.3

VRS::Color Class Reference

#include <vrs/color.h>

Inheritance diagram for VRS::Color:

VRS::VertexData< 4, float >

List of all members.

Public Member Functions

 Color (float grey=0.0f)
 Color (double grey)
 Sets the r, g and b components to the given grey value and the alpha component to one.
 Color (float red, float green, float blue, float alpha=1.0f)
 Color (double red, double green, double blue, double alpha=1.0)
 Constructs a color with the given component values.
bool operator== (const Color &other) const
 Returns whether two colors match in all four components.
bool operator!= (const Color &other) const
 Returns whether two colors differ in one of the four components.
bool operator< (const Color &other) const
 Returns whether this color is lexicographically smaller than the "other" color.
float & operator[] (unsigned int i)
 Returns one of the components, indexed by R=[0], G=[1], B=[2], and A=[3].
float operator[] (unsigned int i) const
 Returns one of the components, indexed by R=[0], G=[1], B=[2], and A=[3].
Coloroperator+= (const Color &col)
 Adds the r, g and b components of a color.
Coloroperator-= (const Color &col)
 Subtracts the r, g and b components of a color.
Coloroperator*= (float coef)
Coloroperator*= (double coef)
 Multiplies the r, g and b components by a value.
Coloroperator/= (float coef)
Coloroperator/= (double coef)
 Divides the r, g and b components by a value.
Color operator+ (const Color &col) const
 The r, g and b components of two colors are added.
Color operator- (const Color &col) const
 The r, g and b components of two colors are subtracted.
Color operator* (float coef) const
Color operator* (double coef) const
 The r, g and b components of a colors are multiplied with a given value.
Color operator/ (float coef) const
Color operator/ (double coef) const
 The r, g and b components of a colors are divided by a given value.
float hue () const
 Returns the hsv hue of a rgb color.
float saturation () const
 Returns the hsv saturation of a rgb color.
float value () const
 Returns the hsv value of a rgb color.
float luminance () const
 Returns the luminance of the color.

Static Public Member Functions

static Color hsv (float hue, float saturation, float value, float alpha=1.0f)
static Color hsv (double hue, double saturation, double value, double alpha=1.0)
 Constructs a rgba color by hsva values.

Static Public Attributes

static const Color aquamarine
static const Color black
static const Color blue
static const Color blue_violet
static const Color brilliant_red
static const Color brown
static const Color cadet_blue
static const Color coral
static const Color cornflower_blue
static const Color cyan
static const Color dk_brown
static const Color dk_gray
static const Color dk_green
static const Color dk_olive_green
static const Color dk_orchid
static const Color dk_plum
static const Color dk_slate_blue
static const Color dk_slate_gray
static const Color dk_tan
static const Color dk_turquoise
static const Color dim_brown
static const Color dim_gray
static const Color firebrick
static const Color forest_green
static const Color gold
static const Color goldenrod
static const Color gray
static const Color green
static const Color green_yellow
static const Color grey
static const Color indian_red
static const Color khaki
static const Color lt_blue
static const Color lt_gray
static const Color lt_sky_blue
static const Color lt_steel_blue
static const Color lime_green
static const Color magenta
static const Color maroon
static const Color med_aquamarine
static const Color med_blue
static const Color med_brown
static const Color med_forest_green
static const Color med_goldenrod
static const Color med_gray
static const Color med_grey
static const Color med_orchid
static const Color med_plum
static const Color med_sea_green
static const Color med_slate_blue
static const Color med_spring_green
static const Color med_turquoise
static const Color med_violet_red
static const Color midnight_blue
static const Color navy
static const Color navy_blue
static const Color orange
static const Color orange_red
static const Color orchid
static const Color pale_green
static const Color pink
static const Color plum
static const Color red
static const Color salmon
static const Color sea_green
static const Color sienna
static const Color silver
static const Color sky_blue
static const Color slate_blue
static const Color slate_gray
static const Color spring_green
static const Color steel_blue
static const Color med_tan
static const Color thistle
static const Color turquoise
static const Color violet
static const Color violet_red
static const Color wheat
static const Color white
static const Color yellow
static const Color yellow_green


Detailed Description

RGBA Color. A color is specified by the red, green, and blue coefficients and the alpha (e.g., transmission) coefficient. All coefficients are clamped to the interval [0.0, 1.0]. Internally the r, g, b and a components are stored as float values.

Constructor & Destructor Documentation

VRS::Color::Color ( float  grey = 0.0f  )  [explicit]

VRS::Color::Color ( double  grey  )  [explicit]

Sets the r, g and b components to the given grey value and the alpha component to one.

VRS::Color::Color ( float  red,
float  green,
float  blue,
float  alpha = 1.0f 
)

VRS::Color::Color ( double  red,
double  green,
double  blue,
double  alpha = 1.0 
)

Constructs a color with the given component values.


Member Function Documentation

bool VRS::Color::operator== ( const Color other  )  const [inline]

Returns whether two colors match in all four components.

bool VRS::Color::operator!= ( const Color other  )  const [inline]

Returns whether two colors differ in one of the four components.

bool VRS::Color::operator< ( const Color other  )  const [inline]

Returns whether this color is lexicographically smaller than the "other" color.

float & VRS::Color::operator[] ( unsigned int  i  )  [inline]

Returns one of the components, indexed by R=[0], G=[1], B=[2], and A=[3].

Reimplemented from VRS::VertexData< 4, float >.

float VRS::Color::operator[] ( unsigned int  i  )  const [inline]

Returns one of the components, indexed by R=[0], G=[1], B=[2], and A=[3].

Reimplemented from VRS::VertexData< 4, float >.

Color& VRS::Color::operator+= ( const Color col  ) 

Adds the r, g and b components of a color.

The alpha value will not be modified. The result of each operation is clamped to [0.0, 1.0].

Color& VRS::Color::operator-= ( const Color col  ) 

Subtracts the r, g and b components of a color.

The alpha value will not be modified. The result of each operation is clamped to [0.0, 1.0].

Color& VRS::Color::operator*= ( float  coef  ) 

Color& VRS::Color::operator*= ( double  coef  ) 

Multiplies the r, g and b components by a value.

The alpha value will not be modified. The result of each operation is clamped to [0.0, 1.0].

Color & VRS::Color::operator/= ( float  coef  )  [inline]

Color & VRS::Color::operator/= ( double  coef  )  [inline]

Divides the r, g and b components by a value.

The alpha value will not be modified. The result of each operation is clamped to [0.0, 1.0].

Color VRS::Color::operator+ ( const Color col  )  const [inline]

The r, g and b components of two colors are added.

The alpha value will be taken from the left color. The result of each operation is clamped to [0.0, 1.0].

Color VRS::Color::operator- ( const Color col  )  const [inline]

The r, g and b components of two colors are subtracted.

The alpha value will be taken from the left color. The result of each operation is clamped to [0.0, 1.0].

Color VRS::Color::operator* ( float  coef  )  const [inline]

Color VRS::Color::operator* ( double  coef  )  const [inline]

The r, g and b components of a colors are multiplied with a given value.

The alpha value will not be multiplied. The result of each operation is clamped to [0.0, 1.0].

Color VRS::Color::operator/ ( float  coef  )  const [inline]

Color VRS::Color::operator/ ( double  coef  )  const [inline]

The r, g and b components of a colors are divided by a given value.

The alpha value will not be multiplied. The result of each operation is clamped to [0.0, 1.0].

static Color VRS::Color::hsv ( float  hue,
float  saturation,
float  value,
float  alpha = 1.0f 
) [static]

static Color VRS::Color::hsv ( double  hue,
double  saturation,
double  value,
double  alpha = 1.0 
) [static]

Constructs a rgba color by hsva values.

Provide the conversion between the GB and HSV color models. hsv can specify achromatic (gray-scale) colors by setting `s' to 0.0 and `v' to the gray coefficient between [0,1]. The hue factor must be specified in degrees in the range [0,360]. Both saturation and value must be in the range [0,1].

float VRS::Color::hue (  )  const

Returns the hsv hue of a rgb color.

float VRS::Color::saturation (  )  const

Returns the hsv saturation of a rgb color.

float VRS::Color::value (  )  const

Returns the hsv value of a rgb color.

float VRS::Color::luminance (  )  const

Returns the luminance of the color.

That is, the weighted sum of the red (30%), green (55%), and blue (15%) coefficients.


Member Data Documentation

const Color VRS::Color::aquamarine [static]

const Color VRS::Color::black [static]

const Color VRS::Color::blue [static]

const Color VRS::Color::brown [static]

const Color VRS::Color::cadet_blue [static]

const Color VRS::Color::coral [static]

const Color VRS::Color::cyan [static]

const Color VRS::Color::dk_brown [static]

const Color VRS::Color::dk_gray [static]

const Color VRS::Color::dk_green [static]

const Color VRS::Color::dk_orchid [static]

const Color VRS::Color::dk_plum [static]

const Color VRS::Color::dk_tan [static]

const Color VRS::Color::dim_brown [static]

const Color VRS::Color::dim_gray [static]

const Color VRS::Color::firebrick [static]

const Color VRS::Color::gold [static]

const Color VRS::Color::goldenrod [static]

const Color VRS::Color::gray [static]

const Color VRS::Color::green [static]

const Color VRS::Color::grey [static]

const Color VRS::Color::indian_red [static]

const Color VRS::Color::khaki [static]

const Color VRS::Color::lt_blue [static]

const Color VRS::Color::lt_gray [static]

const Color VRS::Color::lime_green [static]

const Color VRS::Color::magenta [static]

const Color VRS::Color::maroon [static]

const Color VRS::Color::med_blue [static]

const Color VRS::Color::med_brown [static]

const Color VRS::Color::med_gray [static]

const Color VRS::Color::med_grey [static]

const Color VRS::Color::med_orchid [static]

const Color VRS::Color::med_plum [static]

const Color VRS::Color::navy [static]

const Color VRS::Color::navy_blue [static]

const Color VRS::Color::orange [static]

const Color VRS::Color::orange_red [static]

const Color VRS::Color::orchid [static]

const Color VRS::Color::pale_green [static]

const Color VRS::Color::pink [static]

const Color VRS::Color::plum [static]

const Color VRS::Color::red [static]

const Color VRS::Color::salmon [static]

const Color VRS::Color::sea_green [static]

const Color VRS::Color::sienna [static]

const Color VRS::Color::silver [static]

const Color VRS::Color::sky_blue [static]

const Color VRS::Color::slate_blue [static]

const Color VRS::Color::slate_gray [static]

const Color VRS::Color::steel_blue [static]

const Color VRS::Color::med_tan [static]

const Color VRS::Color::thistle [static]

const Color VRS::Color::turquoise [static]

const Color VRS::Color::violet [static]

const Color VRS::Color::violet_red [static]

const Color VRS::Color::wheat [static]

const Color VRS::Color::white [static]

const Color VRS::Color::yellow [static]


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

Generated on Thu May 23 06:00:23 2013 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact