Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

vuColour< S > Class Template Reference

General colour class. More...

#include <vuColour.h>

Inheritance diagram for vuColour< S >:

Inheritance graph
[legend]
Collaboration diagram for vuColour< S >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 vuColour ()
 default constructor Sets all values to zero and alpha to one.
 vuColour (const vuColour< S > &inst)
 copy constructor
 vuColour (const float *f)
 initialize all components (including alpha at N-1) with values from array f
 vuColour (const double *f)
 initialize all components (from double*) (including alpha at N-1) with values from array f
 vuColour (const float f)
 initialize all values (including alpha) with f
 ~vuColour ()
 destructor
float getAlpha (void)
 get alpha value
void setAlpha (const float a)
 set alpha value
floatoperator[] (unsigned int index)
 provides direct random access to the components
float operator[] (unsigned int index) const
 provides direct reading access to the components
floatgetData ()
 returns a pointer to the float array containing the data
float const * getData () const
 const version of getData()
vuColour< S > & operator= (const double *rhs)
 assignment from double* without alpha
vuColour< S > & operator= (double *rhs)
 assignment from double* without alpha
vuColour< S > & operator= (const vuColour< S > &rhs)
 assignment operator
vuColour< S > & operator= (float rhs)
 assignment operator, This will set each compenent to rhs
vuColour< S > & operator= (const float *rhs)
 assignment operator, This will set the ith colour component to be the ith float pointed to by rhs
bool operator== (const vuColour< S > &rhs) const
 operator ==,
vuColour< S > operator+ (const vuColour< S > &rhs) const
 addition operator,
vuColour< S > operator+ (float a) const
 operator, This will add a to the first S-1 components
vuColour< S > operator- (const vuColour< S > &rhs) const
 operator, This will perform a component wise subtraction on the first S-1 components
vuColour< S > operator * (const vuColour< S > &rhs) const
 operator, This will perform a component wise multiplication on the first S-1 components
vuColour< S > operator/ (const vuColour< S > &rhs) const
 operator, This will perform a component wise division on the first S-1 components
vuColour< S > operator * (float rhs) const
 operator multiplication with scalar In comparision to *= this operator creates a copy where the result written to.
vuColour< S > & operator+= (const vuColour< S > &rhs)
 operator for component wise addition
vuColour< S > & operator-= (const vuColour< S > &rhs)
 operator for component wise subtraction
vuColour< S > & operator *= (const vuColour< S > &rhs)
 operator for component wise multiplication
vuColour< S > & operator/= (const vuColour< S > &rhs)
 operator for component wise division
vuColour< S > & operator *= (float rhs)
 operator for multiplication with scalar
vuColour< S > & operator/= (float rhs)
 operator for division by scalar
vuColour< S > & clampTo01 ()
 Set values above one to one and values below zero to zero.
vuColour< S > & clampTo1 ()
 Set values above one to one.
vuColour oneMinus () const
 return a color with all components set to their distance from one
word nComponents () const
 returns the number of components.
float maxComponent () const
 returns value of maximal component This is used for a pretty ineffective version of early ray termination.
float minComponent () const
 returns value of minimal component This is used for a pretty inefficient version of early ray termination.
vuColour< S > & multAlpha ()
 weight components by alpha value alpha value (last component) is set to one
void print () const
 this will write each colour component on the screen, in comma separated format
istream & read (istream &is)
 a friend, read colour from stream
ostream & write (ostream &os) const
 a friend, write colour to stream

Protected Member Functions

template<int T>
vuColour< S > & fromColourN (const vuColour< T > &src, const float *xfmat)
 this will assign colour src to this colour, compensating for any format problems
template<int T>
vuColour< T > & toColourN (vuColour< T > &dstcol, const float *xfmat) const
 This will write this colour to the equivalent value in dstcol's format and write the value there.

Protected Attributes

float m_Data [S]
 these are the colour component values

Friends

vuColour< S > operator * (float lhs, const vuColour< S > &rhs)
 operator for commutative multiplication with a float.
ostream & operator<< (ostream &os, const vuColour< S > &A)
 a friend, write colour to stream
istream & operator>> (istream &is, vuColour< S > &A)
 a friend, read colour from stream

Detailed Description

template<int S>
class vuColour< S >

General colour class.

The argument S to this template class gives the number of components including the alpha value. The indexing via the [] operator starts at 0 with alpha at position S-1. Derived classes like vuColourRGBa, vuColourXYZa, vuColour31a... use the protected From() and To() functions to provide conversions to other colour models.

Definition at line 66 of file vuColour.h.


Constructor & Destructor Documentation

template<int S>
vuColour< S >::vuColour  )  [inline]
 

default constructor Sets all values to zero and alpha to one.

Definition at line 71 of file vuColour.h.

template<int S>
vuColour< S >::vuColour const vuColour< S > &  inst  )  [inline]
 

copy constructor

Definition at line 80 of file vuColour.h.

template<int S>
vuColour< S >::vuColour const float f  )  [inline]
 

initialize all components (including alpha at N-1) with values from array f

Definition at line 89 of file vuColour.h.

template<int S>
vuColour< S >::vuColour const double *  f  )  [inline]
 

initialize all components (from double*) (including alpha at N-1) with values from array f

Definition at line 98 of file vuColour.h.

template<int S>
vuColour< S >::vuColour const float  f  )  [inline]
 

initialize all values (including alpha) with f

Definition at line 106 of file vuColour.h.

template<int S>
vuColour< S >::~vuColour  )  [inline]
 

destructor

Definition at line 114 of file vuColour.h.


Member Function Documentation

template<int S>
vuColour<S>& vuColour< S >::clampTo01  )  [inline]
 

Set values above one to one and values below zero to zero.

Definition at line 328 of file vuColour.h.

Referenced by vu1512112::drawSlice(), vuSpectralImage::get_rgb(), ns_vu1112112::SpectralImage::get_rgb(), vuTFIntensity::getRGBa(), vuSpecPalette::PaintColours(), vuImage::set_xy(), ns_vu1112116::Image::set_xy(), ns_vu1112112::vu1112112::shootRays(), and vu1112113::shootRays().

template<int S>
vuColour<S>& vuColour< S >::clampTo1  )  [inline]
 

Set values above one to one.

Definition at line 337 of file vuColour.h.

Referenced by ns_vu1112112::SpectralImage::get_rgb().

template<int S>
template<int T>
vuColour<S>& vuColour< S >::fromColourN const vuColour< T > &  src,
const float xfmat
[inline, protected]
 

this will assign colour src to this colour, compensating for any format problems

Definition at line 444 of file vuColour.h.

template<int S>
float vuColour< S >::getAlpha void   )  [inline]
 

get alpha value

Definition at line 119 of file vuColour.h.

Referenced by vu1112113::Cast(), and vu1512113::renderImage().

template<int S>
float const* vuColour< S >::getData  )  const [inline, virtual]
 

const version of getData()

Reimplemented from vuColourN.

Definition at line 145 of file vuColour.h.

template<int S>
float* vuColour< S >::getData  )  [inline, virtual]
 

returns a pointer to the float array containing the data

Reimplemented from vuColourN.

Definition at line 143 of file vuColour.h.

Referenced by FrameBuffer< 4 >::addColourWithM1subM2(), FrameBuffer< 4 >::addColourWithMask(), vuTFDesignSpec::generateLight(), vuSpectralImage::get_xy_data(), vuTransferCanvas::render(), vuKeyFrameCanvas::render(), vu1112115::setLightColour(), vuColour< 8 >::toColourN(), and vuTFDesignSpec::updateFromPalette().

template<int S>
float vuColour< S >::maxComponent  )  const [inline]
 

returns value of maximal component This is used for a pretty ineffective version of early ray termination.

Definition at line 362 of file vuColour.h.

Referenced by ns_vu1112112::vu1112112::Cast(), ns_vu1112112::Material::check_absorption(), vuSpectralImage::create_black_mask(), ns_vu1112112::SpectralImage::create_black_mask(), and vuSpecPalette::PaintSpectrum().

template<int S>
float vuColour< S >::minComponent  )  const [inline]
 

returns value of minimal component This is used for a pretty inefficient version of early ray termination.

Definition at line 372 of file vuColour.h.

Referenced by ns_vu1112112::Material::check_absorption(), and vuSpecPalette::PaintSpectrum().

template<int S>
vuColour<S>& vuColour< S >::multAlpha  )  [inline]
 

weight components by alpha value alpha value (last component) is set to one

Definition at line 382 of file vuColour.h.

template<int S>
word vuColour< S >::nComponents  )  const [inline, virtual]
 

returns the number of components.

This depends on the number given during creation of the template.

Reimplemented from vuColourN.

Definition at line 355 of file vuColour.h.

Referenced by ns_vu1112112::vu1112112::vu1112112().

template<int S>
vuColour vuColour< S >::oneMinus  )  const [inline]
 

return a color with all components set to their distance from one

Definition at line 345 of file vuColour.h.

Referenced by ns_vu1112112::vu1112112::Cast().

template<int S>
vuColour<S> vuColour< S >::operator * float  rhs  )  const [inline]
 

operator multiplication with scalar In comparision to *= this operator creates a copy where the result written to.

Definition at line 259 of file vuColour.h.

template<int S>
vuColour<S> vuColour< S >::operator * const vuColour< S > &  rhs  )  const [inline]
 

operator, This will perform a component wise multiplication on the first S-1 components

Definition at line 237 of file vuColour.h.

template<int S>
vuColour<S>& vuColour< S >::operator *= float  rhs  )  [inline]
 

operator for multiplication with scalar

Definition at line 312 of file vuColour.h.

template<int S>
vuColour<S>& vuColour< S >::operator *= const vuColour< S > &  rhs  )  [inline]
 

operator for component wise multiplication

Definition at line 296 of file vuColour.h.

template<int S>
vuColour<S> vuColour< S >::operator+ float  a  )  const [inline]
 

operator, This will add a to the first S-1 components

Definition at line 217 of file vuColour.h.

template<int S>
vuColour<S> vuColour< S >::operator+ const vuColour< S > &  rhs  )  const [inline]
 

addition operator,

This performs a component wise addition of each component of the 2 colours and returns the result.

Definition at line 207 of file vuColour.h.

template<int S>
vuColour<S>& vuColour< S >::operator+= const vuColour< S > &  rhs  )  [inline]
 

operator for component wise addition

Definition at line 280 of file vuColour.h.

template<int S>
vuColour<S> vuColour< S >::operator- const vuColour< S > &  rhs  )  const [inline]
 

operator, This will perform a component wise subtraction on the first S-1 components

Definition at line 227 of file vuColour.h.

template<int S>
vuColour<S>& vuColour< S >::operator-= const vuColour< S > &  rhs  )  [inline]
 

operator for component wise subtraction

Definition at line 288 of file vuColour.h.

template<int S>
vuColour<S> vuColour< S >::operator/ const vuColour< S > &  rhs  )  const [inline]
 

operator, This will perform a component wise division on the first S-1 components

Definition at line 247 of file vuColour.h.

template<int S>
vuColour<S>& vuColour< S >::operator/= float  rhs  )  [inline]
 

operator for division by scalar

Definition at line 320 of file vuColour.h.

template<int S>
vuColour<S>& vuColour< S >::operator/= const vuColour< S > &  rhs  )  [inline]
 

operator for component wise division

Definition at line 304 of file vuColour.h.

template<int S>
vuColour<S>& vuColour< S >::operator= const float rhs  )  [inline]
 

assignment operator, This will set the ith colour component to be the ith float pointed to by rhs

Definition at line 186 of file vuColour.h.

template<int S>
vuColour<S>& vuColour< S >::operator= float  rhs  )  [inline]
 

assignment operator, This will set each compenent to rhs

Definition at line 177 of file vuColour.h.

template<int S>
vuColour<S>& vuColour< S >::operator= const vuColour< S > &  rhs  )  [inline]
 

assignment operator

Definition at line 165 of file vuColour.h.

template<int S>
vuColour<S>& vuColour< S >::operator= double *  rhs  )  [inline]
 

assignment from double* without alpha

Definition at line 156 of file vuColour.h.

template<int S>
vuColour<S>& vuColour< S >::operator= const double *  rhs  )  [inline]
 

assignment from double* without alpha

Definition at line 148 of file vuColour.h.

template<int S>
bool vuColour< S >::operator== const vuColour< S > &  rhs  )  const [inline]
 

operator ==,

This returns true if the two colours are equivalent.

Definition at line 196 of file vuColour.h.

template<int S>
float vuColour< S >::operator[] unsigned int  index  )  const [inline, virtual]
 

provides direct reading access to the components

Reimplemented from vuColourN.

Definition at line 137 of file vuColour.h.

template<int S>
float& vuColour< S >::operator[] unsigned int  index  )  [inline, virtual]
 

provides direct random access to the components

Reimplemented from vuColourN.

Definition at line 131 of file vuColour.h.

template<int S>
void vuColour< S >::print  )  const [inline, virtual]
 

this will write each colour component on the screen, in comma separated format

Reimplemented from vuColourN.

Definition at line 393 of file vuColour.h.

template<int S>
istream& vuColour< S >::read istream &  is  )  [inline]
 

a friend, read colour from stream

Definition at line 423 of file vuColour.h.

template<int S>
void vuColour< S >::setAlpha const float  a  )  [inline]
 

set alpha value

Definition at line 125 of file vuColour.h.

Referenced by vu1112113::Cast(), and vu1512113::renderImage().

template<int S>
template<int T>
vuColour<T>& vuColour< S >::toColourN vuColour< T > &  dstcol,
const float xfmat
const [inline, protected]
 

This will write this colour to the equivalent value in dstcol's format and write the value there.

Definition at line 459 of file vuColour.h.

template<int S>
ostream& vuColour< S >::write ostream &  os  )  const [inline]
 

a friend, write colour to stream

Definition at line 432 of file vuColour.h.


Friends And Related Function Documentation

template<int S>
vuColour<S> operator * float  lhs,
const vuColour< S > &  rhs
[friend]
 

operator for commutative multiplication with a float.

In comparision to *= this operator creates a copy where the result written to.

Definition at line 271 of file vuColour.h.

template<int S>
ostream& operator<< ostream &  os,
const vuColour< S > &  A
[friend]
 

a friend, write colour to stream

Definition at line 403 of file vuColour.h.

template<int S>
istream& operator>> istream &  is,
vuColour< S > &  A
[friend]
 

a friend, read colour from stream

Definition at line 414 of file vuColour.h.


Member Data Documentation

template<int S>
float vuColour< S >::m_Data[S] [protected]
 

these are the colour component values

Definition at line 473 of file vuColour.h.

Referenced by vuColour< 8 >::oneMinus(), vuColour< 8 >::operator *(), vuColour< 8 >::operator *=(), vuColour< 8 >::operator+(), vuColour< 8 >::operator+=(), vuColour< 8 >::operator-(), vuColour< 8 >::operator-=(), vuColour< 8 >::operator/(), vuColour< 8 >::operator/=(), vuColour< 8 >::operator=(), and vuColour< 8 >::vuColour().


The documentation for this class was generated from the following file:
Generated on Wed Dec 15 21:21:13 2004 for vuVolume by  doxygen 1.3.9.1