#include <Palette.h>
Collaboration diagram for Palette:
Public Member Functions | |
void | writeLegend (ofstream &ost, NameList &classNames, bool vertical=true) |
Writes a legend based on the colors in the Palette to the passed output file stream. | |
void | save (ofstream &ost) |
Saves the color definitions to the passed output file stream. | |
void | load (ifstream &ist) |
Loads new color definitions into the system Palette. | |
int | getRGB (int classIdx, int idx) |
Returns the color value (R, G, or B) associated with a specified class. | |
int | getMaxColor () |
Accessor method. | |
Static Public Member Functions | |
static Palette * | Instance () |
Returns a reference to the Palette singleton. | |
Protected Member Functions | |
Palette () | |
Initializes the default Palette with thirty colors, with RGB values ranging from 0 to 3. |
It is implemented as a singleton pattern, ensuring that there is only a single, global instance of the Palette in Classer.
|
Initializes the default Palette with thirty colors, with RGB values ranging from 0 to 3.
|
|
Accessor method.
|
|
Returns the color value (R, G, or B) associated with a specified class.
|
|
Returns a reference to the Palette singleton. This is the method to use to get access to the Classer Palette. |
|
Loads new color definitions into the system Palette. The format is identical to that generated by the Palette::save() method. The easiest approach to modifying the color values is to write them out using the save() method, modify the file, and then load them back in with this method.
|
|
Saves the color definitions to the passed output file stream. The format consists of:
|
|
Writes a legend based on the colors in the Palette to the passed output file stream. The file is written as a portable pixmap, and so should have the extension '.ppm'. The number of colors that are written is based on the number of string in the classNames NameList. The legend consists of a set of colored rectangles, i.e., adding the class name strings must be done separately.
|