CVD::Rgb< T > Class Template Reference
[Image storage and manipulation]

#include <rgb.h>

List of all members.


Detailed Description

template<class T>
class CVD::Rgb< T >

A colour consisting of red, green and blue components.

Often used to store 24-bit colour information, i.e. CVD::Rgb<CVD::byte>

Parameters:
T The datatype of each component

Definition at line 46 of file rgb.h.


Public Member Functions

 Rgb ()
 Rgb (T r, T g, T b)
template<class S>
 Rgb (const Rgb< S > &rgb)
Rgb< T > & operator= (const Rgb< T > &c)
bool operator== (const Rgb< T > &c) const
bool operator!= (const Rgb< T > &c) const
template<class T2>
Rgb< T > & operator= (const Rgb< T2 > &c)

Public Attributes

red
green
blue

Related Functions

(Note that these are not member functions.)

template<class T>
std::ostream & operator<< (std::ostream &os, const Rgb< T > &x)
std::ostream & operator<< (std::ostream &os, const Rgb< char > &x)
std::ostream & operator<< (std::ostream &os, const Rgb< byte > &x)

Constructor & Destructor Documentation

template<class T>
CVD::Rgb< T >::Rgb (  )  [inline]

Default constructor. Does nothing.

Definition at line 50 of file rgb.h.

template<class T>
CVD::Rgb< T >::Rgb ( r,
g,
b 
) [inline]

Constructs a colour as specified.

Parameters:
r The red component
g The green component
b The blue component

Definition at line 55 of file rgb.h.


Member Function Documentation

template<class T>
Rgb<T>& CVD::Rgb< T >::operator= ( const Rgb< T > &  c  )  [inline]

Assignment operator.

Parameters:
c The colour to copy from

Definition at line 64 of file rgb.h.

template<class T>
bool CVD::Rgb< T >::operator== ( const Rgb< T > &  c  )  const [inline]

Logical equals operator.

Returns true if each component is the same.

Parameters:
c Rgb to compare with

Definition at line 69 of file rgb.h.

template<class T>
bool CVD::Rgb< T >::operator!= ( const Rgb< T > &  c  )  const [inline]

Logical not-equals operator.

Returns true unless each component is the same.

Parameters:
c Rgb to compare with

Definition at line 74 of file rgb.h.

template<class T>
template<class T2>
Rgb<T>& CVD::Rgb< T >::operator= ( const Rgb< T2 > &  c  )  [inline]

Assignment operator between two different storage types, using the standard casts as necessary.

Parameters:
c The colour to copy from

Definition at line 80 of file rgb.h.


Friends And Related Function Documentation

template<class T>
std::ostream & operator<< ( std::ostream &  os,
const Rgb< T > &  x 
) [related]

Write the colour to a stream in the format "(red,green,blue)".

Parameters:
os The stream
x The colour object

Definition at line 90 of file rgb.h.

template<class T>
std::ostream & operator<< ( std::ostream &  os,
const Rgb< char > &  x 
) [related]

Read a colour from a stream, interpreting three numbers as chars.

Parameters:
os The stream
x The colour object

Definition at line 100 of file rgb.h.

template<class T>
std::ostream & operator<< ( std::ostream &  os,
const Rgb< byte > &  x 
) [related]

Read a colour from a stream, interpreting three numbers as bytes.

Parameters:
os The stream
x The colour object

Definition at line 111 of file rgb.h.


Member Data Documentation

template<class T>
T CVD::Rgb< T >::red

The red component.

Definition at line 58 of file rgb.h.

Referenced by CVD::glColor(), CVD::Rgb< unsigned char >::operator!=(), CVD::Rgb< unsigned char >::operator=(), and CVD::Rgb< unsigned char >::operator==().

template<class T>
T CVD::Rgb< T >::green

The green component.

Definition at line 59 of file rgb.h.

Referenced by CVD::glColor(), CVD::Rgb< unsigned char >::operator!=(), CVD::Rgb< unsigned char >::operator=(), and CVD::Rgb< unsigned char >::operator==().

template<class T>
T CVD::Rgb< T >::blue

The blue component.

Definition at line 60 of file rgb.h.

Referenced by CVD::glColor(), CVD::Rgb< unsigned char >::operator!=(), CVD::Rgb< unsigned char >::operator=(), and CVD::Rgb< unsigned char >::operator==().


The documentation for this class was generated from the following file:
Generated on Wed Feb 18 10:23:07 2009 for CVD by  doxygen 1.5.3