IBSimu 1.0.4
Classes | Public Member Functions
Palette Class Reference

Class for palette definition. More...

#include <palette.hpp>

List of all members.

Classes

struct  Entry
 Palette defining entry. More...

Public Member Functions

 Palette ()
 Default constructor for default black and white palette.
 Palette (const std::vector< Entry > &entries)
 Constructor for defined palette.
Color operator() (double x) const
 Return the interpolated color value from palette.
void clear (void)
 Clear current palette.
void push_back (const Color &color, double val)
 Pushes new entry to palette.
void norm (void)
 Normalize palette entries.
void debug_print (void) const

Detailed Description

Class for palette definition.

Palette is an object that contains a list of colors and corresponding values. The colors are interpolated linearly between the defined points for a smooth color palette. The palette values are normed so that the end points of palette have values 0.0 and 1.0.


Constructor & Destructor Documentation

Palette::Palette ( )

Default constructor for default black and white palette.

Palette::Palette ( const std::vector< Entry > &  entries)

Constructor for defined palette.

The values are normed to range from 0.0 to 1.0.


Member Function Documentation

void Palette::clear ( void  )

Clear current palette.

Leaves palette with no colors. Used with push_back() to build new palettes on-line.

void Palette::debug_print ( void  ) const
void Palette::norm ( void  )

Normalize palette entries.

Normalize palette to range from 0.0 to 1.0.

Color Palette::operator() ( double  x) const

Return the interpolated color value from palette.

Makes and interpolated color value at value x. If palette has no colors, black will be returned. If palette has one color, that color will be returned. With two or more colors the interpolation can be done correctly.

void Palette::push_back ( const Color color,
double  val 
)

Pushes new entry to palette.

Palette entries are automatically sorted. The palette won't be normed in range. This has to be manually done by calling norm() after adding palette entries.


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