cpe::color Class Reference

Container class for (r,g,b) color. Each component is an integer in [0,255]. More...

List of all members.

Public Member Functions

 color ()
 empty constructor (0,0,0)
 color (const unsigned char &gray)
 direct constructor with gray value (r,b,g)=(gray,gray,gray)
 color (const unsigned char &r, const unsigned char &g, const unsigned char &b)
 direct constructor with (r,b,g) value
void set (const unsigned char &r, const unsigned char &g, const unsigned char &b)
 set color value
void get (unsigned char *r, unsigned char *g, unsigned char *b) const
 get color values
const unsigned char & r () const
 get red value
unsigned char & r ()
 get red value
const unsigned char & g () const
 get green value
unsigned char & g ()
 get green value
const unsigned char & b () const
 get blue value
unsigned char & b ()
 get blue value
coloroperator+= (const color &c)
 add a color to the current one
coloroperator*= (const double &alpha)
 internal scaling by a scalar

Static Public Member Functions

static color interpolate_linear (const color &c1, const color &c2, double alpha)
 linear interpolation of colors
static color interpolate_linear (const std::vector< color > &v_color, const std::vector< double > &weights)
 linear interpolation of colors

Private Attributes

unsigned char internal_r
 internal red component
unsigned char internal_g
 internal green component
unsigned char internal_b
 internal blue component

Friends

color operator+ (const color &c0, const color &c1)
 sum two colors
color operator* (const double &alpha, const color &c)
 scale color by a scalar value
color operator* (const color &c, const double &alpha)
 scale color by a scalar value
std::ostream & operator<< (std::ostream &stream, const color &c)
 standard output

Detailed Description

Container class for (r,g,b) color. Each component is an integer in [0,255].


Constructor & Destructor Documentation

cpe::color::color (  ) 

empty constructor (0,0,0)

Referenced by interpolate_linear().

cpe::color::color ( const unsigned char &  gray  ) 

direct constructor with gray value (r,b,g)=(gray,gray,gray)

cpe::color::color ( const unsigned char &  r,
const unsigned char &  g,
const unsigned char &  b 
)

direct constructor with (r,b,g) value


Member Function Documentation

unsigned char & cpe::color::b (  ) 

get blue value

References internal_b.

const unsigned char & cpe::color::b (  )  const
unsigned char & cpe::color::g (  ) 

get green value

References internal_g.

const unsigned char & cpe::color::g (  )  const
void cpe::color::get ( unsigned char *  r,
unsigned char *  g,
unsigned char *  b 
) const

get color values

References internal_b, internal_g, and internal_r.

color cpe::color::interpolate_linear ( const std::vector< color > &  v_color,
const std::vector< double > &  weights 
) [static]

linear interpolation of colors

Parameters:
vector<color> v_color: vector of color to interpolate
vector<double> weights: weights used to interpolate colors
Returns:
Sum v_color[k]*weights[k]

References b(), color(), g(), and r().

Here is the call graph for this function:

color cpe::color::interpolate_linear ( const color c1,
const color c2,
double  alpha 
) [static]

linear interpolation of colors

References b(), color(), g(), and r().

Here is the call graph for this function:

color & cpe::color::operator*= ( const double &  alpha  ) 

internal scaling by a scalar

References b(), g(), internal_b, internal_g, internal_r, and r().

Here is the call graph for this function:

color & cpe::color::operator+= ( const color c  ) 

add a color to the current one

References b(), g(), internal_b, internal_g, internal_r, and r().

Here is the call graph for this function:

unsigned char & cpe::color::r (  ) 

get red value

References internal_r.

const unsigned char & cpe::color::r (  )  const
void cpe::color::set ( const unsigned char &  r,
const unsigned char &  g,
const unsigned char &  b 
)

set color value

References internal_b, internal_g, and internal_r.


Friends And Related Function Documentation

color operator* ( const color c,
const double &  alpha 
) [friend]

scale color by a scalar value

color operator* ( const double &  alpha,
const color c 
) [friend]

scale color by a scalar value

color operator+ ( const color c0,
const color c1 
) [friend]

sum two colors

std::ostream& operator<< ( std::ostream &  stream,
const color c 
) [friend]

standard output


Member Data Documentation

unsigned char cpe::color::internal_b [private]

internal blue component

Referenced by b(), get(), operator*=(), operator+=(), and set().

unsigned char cpe::color::internal_g [private]

internal green component

Referenced by g(), get(), operator*=(), operator+=(), and set().

unsigned char cpe::color::internal_r [private]

internal red component

Referenced by get(), operator*=(), operator+=(), r(), and set().


The documentation for this class was generated from the following files:
Generated on Mon Apr 18 16:13:44 2011 by  doxygen 1.6.3