Thea

A color with three floatingpoint channels: red, green and blue, each in [0, 1]. More...
#include <ColorRgb.hpp>
Public Types  
typedef Real  value_type 
The numerical type of each channel. More...  
Public Member Functions  
Real  b () const 
The value of the blue channel. More...  
Real &  b () 
A reference to the blue channel. More...  
ColorRgb  bgr () const 
Swap the red and blue channels. More...  
ColorRgb ()  
Default constructor. More...  
ColorRgb (Real r_, Real g_, Real b_)  
Construct from red, green and blue components. More...  
ColorRgb (Real v)  
Initialize all channels to the same value. More...  
ColorRgb (Vector3 const &v)  
Construct a color from a 3vector. More...  
ColorRgb (Real const *v)  
Construct a color from three components in an array. More...  
ColorRgb (ColorRgba const &other)  
Initialize from a 32bit RGBA color. More...  
ColorRgb (ColorRgb8 const &src)  
Construct from a color with byte channels, with automatic scaling from [0, 255] to [0, 1]. More...  
Real const *  data () const 
Get the address of the array storing color channel values in RGB order. More...  
Real *  data () 
Get the address of the array storing color channel values in RGB order. More...  
void  fill (Real v) 
Set all channels to the same value. More...  
bool  fuzzyEq (ColorRgb const &other) const 
Check if two colors are approximately equal. More...  
bool  fuzzyNe (ColorRgb const &other) const 
Check if two colors are not approximately equal. More...  
Real  g () const 
The value of the green channel. More...  
Real &  g () 
A reference to the green channel. More...  
ColorRgb  max (ColorRgb const &rhs) const 
Get the percomponent maximum of two colors. More...  
Real  max () const 
Get the largest component. More...  
ColorRgb  min (ColorRgb const &rhs) const 
Get the percomponent minimum of two colors. More...  
Real  min () const 
Get the smallest component. More...  
Real  norm () const 
Get the magnitude of the color. More...  
void  normalize () 
Scale the color to unit magnitude. More...  
ColorRgb  normalized () const 
Get a unit magnitude color by dividing by the magnitude. More...  
ColorRgb  operator* (Real s) const 
Multiplication by a scalar. More...  
ColorRgb  operator* (ColorRgb const &rhs) const 
Componentwise multiplication by another color. More...  
ColorRgb &  operator*= (ColorRgb const &rhs) 
Multiply componentwise and assign. More...  
ColorRgb &  operator*= (Real s) 
Multiply by a scalar and assign. More...  
ColorRgb  operator+ (ColorRgb const &rhs) const 
Addition. More...  
ColorRgb &  operator+= (ColorRgb const &rhs) 
Add and assign. More...  
ColorRgb  operator (ColorRgb const &rhs) const 
Subtraction. More...  
ColorRgb  operator () const 
Negation of the color. More...  
ColorRgb &  operator= (ColorRgb const &rhs) 
Subtract and assign. More...  
ColorRgb  operator/ (Real s) const 
Division by a scalar. More...  
ColorRgb  operator/ (ColorRgb const &rhs) const 
Componentwise division by another color. More...  
ColorRgb &  operator/= (ColorRgb const &rhs) 
Divide componentwise and assign. More...  
ColorRgb &  operator/= (Real s) 
Divide by a scalar and assign. More...  
template<typename IntegerT >  
Real const &  operator[] (IntegerT channel) const 
Arraystyle channel access. More...  
template<typename IntegerT >  
Real &  operator[] (IntegerT channel) 
Arraystyle channel access. More...  
ColorRgb  pow (ColorRgb const &rhs) const 
Raise the components to powers specified as another color. More...  
ColorRgb  pow (Real s) const 
Raise the components to a power. More...  
Real  r () const 
The value of the red channel. More...  
Real &  r () 
A reference to the red channel. More...  
void  set (Real r_, Real g_, Real b_) 
Set all channels simultaneously. More...  
Real  squaredNorm () const 
Get the square of the magnitude of the color. More...  
Vector3  toHSV () const 
Convert from RGB to HSV. More...  
std::string  toString () const 
Get a string representation of the color. More...  
Static Public Member Functions  
static ColorRgb  ansiMap (int i) 
Generate colors according to the ANSI color set, mod 16. More...  
static ColorRgb const &  black () 
Black color. More...  
static ColorRgb const &  blue () 
Blue color. More...  
static ColorRgb const &  brown () 
Brown color. More...  
static ColorRgb const &  cyan () 
Cyan color. More...  
static ColorRgb  fromARGB (uint32 argb) 
Initialize from an HTMLstyle color (e.g. More...  
static ColorRgb  fromHSV (Vector3 const &hsv) 
Convert from HSV to RGB. More...  
static ColorRgb const &  gray () 
Gray color. More...  
static ColorRgb const &  green () 
Green color. More...  
static ColorRgb  jetColorMap (Real val) 
Duplicates the Matlab jet colormap map [0, 1] –> (r, g, b) where blue is close to 0 and red is close to 1. More...  
static ColorRgb const &  orange () 
Orange color. More...  
static ColorRgb  pastelMap (int i) 
Generate colors using a hash such that adjacent values are unlikely to have similar colors. More...  
static ColorRgb const &  purple () 
Purple color. More...  
static ColorRgb  rainbowColorMap (Real hue) 
Get a color with a specified hue, and maximum saturation and value. More...  
static ColorRgb  random () 
Random color with unit magnitude. More...  
static ColorRgb const &  red () 
Red color. More...  
static ColorRgb const &  wheelRandom () 
Returns one of the color wheel colors (such as red, green, cyan). More...  
static ColorRgb const &  white () 
White color. More...  
static ColorRgb const &  yellow () 
Yellow color. More...  
static ColorRgb const &  zero () 
Color with all channels zero (black). More...  
A color with three floatingpoint channels: red, green and blue, each in [0, 1].
Derived from the G3D library: http://g3d.sourceforge.net
Definition at line 51 of file ColorRgb.hpp.
typedef Real value_type 
The numerical type of each channel.
Definition at line 57 of file ColorRgb.hpp.
ColorRgb  (  ) 
ColorRgb  (  Real  r_, 
Real  g_,  
Real  b_  
) 
Construct from red, green and blue components.
Definition at line 63 of file ColorRgb.hpp.

explicit 
Initialize all channels to the same value.
Definition at line 66 of file ColorRgb.hpp.

explicit 
Construct a color from a 3vector.
Definition at line 69 of file ColorRgb.hpp.

explicit 
Construct a color from three components in an array.
Definition at line 72 of file ColorRgb.hpp.
Initialize from a 32bit RGBA color.
For conversion from a consistent source type.
Definition at line 169 of file ColorRgb.cpp.
Construct from a color with byte channels, with automatic scaling from [0, 255] to [0, 1].
Definition at line 174 of file ColorRgb.cpp.

static 
Generate colors according to the ANSI color set, mod 16.
Definition at line 36 of file ColorRgb.cpp.
Real b  (  )  const 
The value of the blue channel.
Definition at line 117 of file ColorRgb.hpp.
Real& b  (  ) 
A reference to the blue channel.
Definition at line 120 of file ColorRgb.hpp.
ColorRgb bgr  (  )  const 
Swap the red and blue channels.
Definition at line 320 of file ColorRgb.hpp.

static 
Black color.
Definition at line 130 of file ColorRgb.cpp.

static 
Blue color.
Definition at line 88 of file ColorRgb.cpp.

static 
Brown color.
Definition at line 116 of file ColorRgb.cpp.

static 
Cyan color.
Definition at line 102 of file ColorRgb.cpp.
Real const* data  (  )  const 
Get the address of the array storing color channel values in RGB order.
Definition at line 123 of file ColorRgb.hpp.
Real* data  (  ) 
Get the address of the array storing color channel values in RGB order.
Definition at line 126 of file ColorRgb.hpp.
void fill  (  Real  v  ) 
Set all channels to the same value.
Definition at line 151 of file ColorRgb.hpp.

static 
Initialize from an HTMLstyle color (e.g.
0xFF0000 == RED)
Definition at line 182 of file ColorRgb.cpp.

static 
Convert from HSV to RGB.
Definition at line 193 of file ColorRgb.cpp.
bool fuzzyEq  (  ColorRgb const &  other  )  const 
Check if two colors are approximately equal.
Definition at line 272 of file ColorRgb.hpp.
bool fuzzyNe  (  ColorRgb const &  other  )  const 
Check if two colors are not approximately equal.
Definition at line 278 of file ColorRgb.hpp.
Real g  (  )  const 
The value of the green channel.
Definition at line 111 of file ColorRgb.hpp.
Real& g  (  ) 
A reference to the green channel.
Definition at line 114 of file ColorRgb.hpp.

static 
Gray color.
Definition at line 137 of file ColorRgb.cpp.

static 
Green color.
Definition at line 81 of file ColorRgb.cpp.

static 
Duplicates the Matlab jet colormap map [0, 1] –> (r, g, b) where blue is close to 0 and red is close to 1.
Definition at line 285 of file ColorRgb.cpp.
Get the percomponent maximum of two colors.
Definition at line 296 of file ColorRgb.hpp.
Real max  (  )  const 
Get the largest component.
Definition at line 308 of file ColorRgb.hpp.
Get the percomponent minimum of two colors.
Definition at line 302 of file ColorRgb.hpp.
Real min  (  )  const 
Get the smallest component.
Definition at line 314 of file ColorRgb.hpp.
Real norm  (  )  const 
Get the magnitude of the color.
Definition at line 253 of file ColorRgb.hpp.
void normalize  (  ) 
Scale the color to unit magnitude.
Definition at line 256 of file ColorRgb.hpp.
ColorRgb normalized  (  )  const 
Get a unit magnitude color by dividing by the magnitude.
Definition at line 262 of file ColorRgb.hpp.
ColorRgb operator*  (  Real  s  )  const 
Multiplication by a scalar.
Definition at line 166 of file ColorRgb.hpp.
Componentwise multiplication by another color.
Definition at line 172 of file ColorRgb.hpp.
Multiply componentwise and assign.
Definition at line 214 of file ColorRgb.hpp.
ColorRgb& operator*=  (  Real  s  ) 
Multiply by a scalar and assign.
Definition at line 232 of file ColorRgb.hpp.
Addition.
Definition at line 154 of file ColorRgb.hpp.
Add and assign.
Definition at line 196 of file ColorRgb.hpp.
Subtraction.
Definition at line 160 of file ColorRgb.hpp.
ColorRgb operator  (  )  const 
Negation of the color.
Definition at line 190 of file ColorRgb.hpp.
Subtract and assign.
Definition at line 205 of file ColorRgb.hpp.
ColorRgb operator/  (  Real  s  )  const 
Division by a scalar.
Definition at line 178 of file ColorRgb.hpp.
Componentwise division by another color.
Definition at line 184 of file ColorRgb.hpp.
Divide componentwise and assign.
Definition at line 223 of file ColorRgb.hpp.
ColorRgb& operator/=  (  Real  s  ) 
Divide by a scalar and assign.
Definition at line 241 of file ColorRgb.hpp.
Real const& operator[]  (  IntegerT  channel  )  const 
Arraystyle channel access.
Definition at line 129 of file ColorRgb.hpp.
Real& operator[]  (  IntegerT  channel  ) 
Arraystyle channel access.
Definition at line 136 of file ColorRgb.hpp.

static 
Orange color.
Definition at line 123 of file ColorRgb.cpp.

static 
Generate colors using a hash such that adjacent values are unlikely to have similar colors.
Useful for rendering with stable but arbitrary colors, e.g., when debugging a mesh algorithm.
Definition at line 62 of file ColorRgb.cpp.
Raise the components to powers specified as another color.
Definition at line 284 of file ColorRgb.hpp.
ColorRgb pow  (  Real  s  )  const 
Raise the components to a power.
Definition at line 290 of file ColorRgb.hpp.

static 
Purple color.
Definition at line 95 of file ColorRgb.cpp.
Real r  (  )  const 
The value of the red channel.
Definition at line 105 of file ColorRgb.hpp.
Real& r  (  ) 
A reference to the red channel.
Definition at line 108 of file ColorRgb.hpp.

static 
Get a color with a specified hue, and maximum saturation and value.
hue  The target hue. Must be in [0, 1]. 
Definition at line 300 of file ColorRgb.cpp.

static 
Random color with unit magnitude.
Definition at line 187 of file ColorRgb.cpp.

static 
Red color.
Definition at line 74 of file ColorRgb.cpp.
void set  (  Real  r_, 
Real  g_,  
Real  b_  
) 
Set all channels simultaneously.
Definition at line 143 of file ColorRgb.hpp.
Real squaredNorm  (  )  const 
Get the square of the magnitude of the color.
Definition at line 250 of file ColorRgb.hpp.
Vector3 toHSV  (  )  const 
std::string toString  (  )  const 
Get a string representation of the color.
Definition at line 294 of file ColorRgb.cpp.

static 
Returns one of the color wheel colors (such as red, green, cyan).
Does not include white, black, or gray.
Definition at line 157 of file ColorRgb.cpp.

static 
White color.
Definition at line 144 of file ColorRgb.cpp.

static 
Yellow color.
Definition at line 109 of file ColorRgb.cpp.

static 
Color with all channels zero (black).
Definition at line 151 of file ColorRgb.cpp.