Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

prapi::RGBColor< T > Class Template Reference

#include <Color.h>

Inheritance diagram for prapi::RGBColor< T >:

prapi::Color< T, 3 > List of all members.

Detailed Description

template<class T = int>
class prapi::RGBColor< T >

A convenience class for the RGB color space.

RGB colors are represented as three component values. In fact, RGBColor can be used in with any three-dimensional color space. The default component class is int.


Public Methods

 RGBColor (T clr=0)
 Create a new RGB color with all channels set to clr.

 RGBColor (T r, T g, T b)
 Create a new RGB color with color channels set as indicated.

template<class U>  RGBColor (const Color< U, 3 > &other)
 Create a copy of an RGB color of any type.

 RGBColor (const Color< T, 3 > &other)
 The copy constructor.

 RGBColor (const HSVColor< T > &other)
 Transform a color in the HSV color space to the RGB color space.

getRed () const
 Get the value of the red color channel.

getGreen () const
 Get the value of the green color channel.

getBlue () const
 Get the value of the blue color channel.

void setRed (T value)
 Set the red color channel.

void setGreen (T value)
 Set the green color channel.

void setBlue (T value)
 Set the blue color channel.

 operator int () const
 Convert an RGB color to an integer.

 operator float () const
 Convert an RGB color to a float.

 operator double () const
 Convert an RGB color to a double.

 operator HSVColor () const
 Convert an RGB color to HSV.

template<class U> RGBColor & operator= (const Color< U, 3 > &other)
 Copy a color of any content type.

RGBColor & operator= (const Color< T, 3 > &other)
 Copy a color.

RGBColor & operator= (T value)
 Set all color channels to value.

RGBColor< double > getNormalizedColor (void) const
 Get a normalized version of this color.


Friends

class HSVColor< T >


Member Function Documentation

template<class T>
RGBColor< double > prapi::RGBColor< T >::getNormalizedColor void    const
 

Get a normalized version of this color.

Each color channel is divided by the sum of all channels.

template<class T = int>
prapi::RGBColor< T >::operator double   const [inline]
 

Convert an RGB color to a double.

The result is the intensity of this color, i.e. the average of R, G, and B.

template<class T = int>
prapi::RGBColor< T >::operator float   const [inline]
 

Convert an RGB color to a float.

The result is the intensity of this color, i.e. the average of R, G, and B.

template<class T = int>
prapi::RGBColor< T >::operator HSVColor   const [inline]
 

Convert an RGB color to HSV.

This method works correctly only when float or double is used as the content type and RGB color values are in the range [0,1], or when the content type is int, and coordinates are in the range [0,255].

template<class T = int>
prapi::RGBColor< T >::operator int   const [inline]
 

Convert an RGB color to an integer.

The result is the intensity of this color, i.e. the average of R, G, and B.


The documentation for this class was generated from the following file:
Documentation generated on 11.09.2003 with Doxygen.
The documentation is copyrighted material.
Copyright © Topi Mäenpää 2003. All rights reserved.