cgv
cgv::media::color< T, cm, am > Class Template Reference

#include <color.h>

Public Types

typedef T component_type
 type of color components
 

Public Member Functions

 color ()
 standard constructor does not initialize components
 
 color (const T &c)
 set all components to given value
 
 color (const T &c0, const T &c1)
 set first two components to given values
 
 color (const T &c0, const T &c1, const T &c2)
 set first three components to given values
 
 color (const T &c0, const T &c1, const T &c2, const T &c3)
 set all four components to given values
 
template<typename T2 , ColorModel cm2, AlphaModel am2>
 color (const color< T2, cm2, am2 > &c2)
 copy constructor uses color conversion if necessary
 
template<typename T2 , ColorModel cm2, AlphaModel am2>
color< T, cm, am > & operator= (const color< T2, cm2, am2 > &c2)
 assign to color with potential color conversion
 
color< T, cm, am > & operator= (const T &c)
 assign to color component
 
color< T, cm > & drop_alpha ()
 drop the alpha component if any by a cast operator
 
template<typename T2 , ColorModel cm2, AlphaModel am2>
color< T, cm, am > & operator*= (const color< T2, cm2, am2 > &c2)
 multiply with color
 
template<typename T2 , ColorModel cm2, AlphaModel am2>
color< T, cm, am > operator* (const color< T2, cm2, am2 > &c2)
 post multiply with color
 
color< T, cm, am > & operator*= (const T &c)
 multiply with constant
 
template<typename T2 >
color< typename type::func::promote< T, T2 >::type, cm, am > operator* (const T2 &c) const
 post multiply with constant
 
template<typename T2 , ColorModel cm2, AlphaModel am2>
color< T, cm, am > & operator+= (const color< T2, cm2, am2 > &c2)
 add color
 
template<typename T2 , ColorModel cm2, AlphaModel am2>
color< T, cm, am > operator+ (const color< T2, cm2, am2 > &c2)
 add color
 
color< T, cm, am > & operator+= (const T &c)
 add constant
 
color< T, cm, am > operator+ (const T &c)
 add constant
 
void clamp (const T &mn=0, const T &mx=color_one< T >::value(), bool skip_alpha=false)
 clamp to the given range, which defaults to [0,1] of the component type
 
T & operator[] (unsigned int i)
 access to components
 
const T & operator[] (unsigned int i) const
 const access to components
 
T & alpha ()
 return alpha component
 
const T & alpha () const
 return alpha component
 

Static Public Attributes

static const ColorModel clr_mod = cm
 static and const access to color model
 
static const AlphaModel alp_mod = am
 static and const access to alpha model
 
static const unsigned int nr_color_components = color_model_traits<cm>::nr_components
 static and const access to number of color components
 
static const unsigned int nr_alpha_components = alpha_model_traits<am>::nr_components
 static and const access to number of alpha components
 
static const unsigned int nr_components = nr_color_components+nr_alpha_components
 static and const access to total number of components
 

Detailed Description

template<typename T, ColorModel cm, AlphaModel am>
class cgv::media::color< T, cm, am >

represent a color with components of given type and color and alpha model as specified.


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