All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
List of all members | Public Member Functions
Palette Class Reference

Detailed Description

This map assigns one of the predefined Colors to each int. It is possible to change the colors as well as their number. The integer range is cyclically mapped to the provided set of colors.

This is a true reference map, so you can also change the actual colors.

#include <lemon/color.h>

+ Inheritance diagram for Palette:

Public Member Functions

 Palette (bool have_white=false, int num=-1)
 Constructor.
 
Coloroperator[] (int i)
 
 
const Coloroperator[] (int i) const
 
 
void set (int i, const Color &c)
 
 
void add (const Color &c)
 Adds a new color to the end of the color list.
 
void resize (int s)
 Sets the number of the existing colors.
 
int size () const
 Returns the number of the existing colors.
 

Additional Inherited Members

- Public Types inherited from MapBase< int, Color >
typedef int Key
 The key type of the map.
 
typedef Color Value
 The value type of the map. (The type of objects associated with the keys).
 

Constructor & Destructor Documentation

Palette ( bool  have_white = false,
int  num = -1 
)
inline

Constructor.

Parameters
have_whiteIndicates whether white is among the provided initial colors (true) or not (false). If it is true, white will be assigned to 0.
numThe number of the allocated colors. If it is -1, the default color configuration is set up (26 color plus optionaly the white). If num is less then 26/27 then the default color list is cut. Otherwise the color list is filled repeatedly with the default color list. (The colors can be changed later on.)