claw::graphic::color_palette< Color > Class Template Reference

A palette of colors, for palettized images. More...

#include <color_palette.hpp>

List of all members.

Public Types

typedef Color color_type
 The type of the colors stored in the palette.

Public Member Functions

 color_palette (unsigned int n)
 Constructor.
unsigned int size () const
 Get the number of colors in the palette.
color_typeoperator[] (unsigned int i)
 Get a color from the palette.
const color_typeoperator[] (unsigned int i) const
 Get the value of a color from the palette.
const color_typeoperator() (unsigned int i) const
 Get the value of a color from the palette.

Private Attributes

std::vector< color_typem_palette
 The colors in the palette.

Detailed Description

template<typename Color>
class claw::graphic::color_palette< Color >

A palette of colors, for palettized images.

Author:
Julien Jorge

Definition at line 42 of file color_palette.hpp.


Member Typedef Documentation

template<typename Color>
typedef Color claw::graphic::color_palette< Color >::color_type

The type of the colors stored in the palette.

Definition at line 46 of file color_palette.hpp.


Constructor & Destructor Documentation

template<typename Color >
claw::graphic::color_palette< Color >::color_palette ( unsigned int  n  )  [inline]

Constructor.

Parameters:
n The size of the palette.

Definition at line 38 of file color_palette.tpp.

00039   : m_palette(n)
00040 {
00041 
00042 } // color_palette::color_palette()


Member Function Documentation

template<typename Color >
const claw::graphic::color_palette< Color >::color_type & claw::graphic::color_palette< Color >::operator() ( unsigned int  i  )  const [inline]

Get the value of a color from the palette.

Parameters:
i The index of the color.
Precondition:
i is a valid color index.

Definition at line 92 of file color_palette.tpp.

References claw::graphic::color_palette< Color >::m_palette.

00093 {
00094   assert( i < m_palette.size() );
00095 
00096   return m_palette[i];
00097 } // color_palette::operator()()

template<typename Color >
const claw::graphic::color_palette< Color >::color_type & claw::graphic::color_palette< Color >::operator[] ( unsigned int  i  )  const [inline]

Get the value of a color from the palette.

Parameters:
i The index of the color.
Precondition:
i is a valid color index.

Definition at line 77 of file color_palette.tpp.

References claw::graphic::color_palette< Color >::m_palette.

00078 {
00079   assert( i < m_palette.size() );
00080 
00081   return m_palette[i];
00082 } // color_palette::operator[]() [const]

template<typename Color >
claw::graphic::color_palette< Color >::color_type & claw::graphic::color_palette< Color >::operator[] ( unsigned int  i  )  [inline]

Get a color from the palette.

Parameters:
i The index of the color.
Precondition:
i is a valid color index.

Definition at line 62 of file color_palette.tpp.

References claw::graphic::color_palette< Color >::m_palette.

00063 {
00064   assert( i < m_palette.size() );
00065 
00066   return m_palette[i];
00067 } // color_palette::operator[]()

template<typename Color >
unsigned int claw::graphic::color_palette< Color >::size (  )  const [inline]

Member Data Documentation

template<typename Color>
std::vector<color_type> claw::graphic::color_palette< Color >::m_palette [private]

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

Generated on 9 Nov 2009 for CLAW Library (a C++ Library Absolutely Wonderful) by  doxygen 1.6.1