Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

Plot::ColorLookupTable< PixelType, Scale > Class Template Reference

#include <colorlookup.h>

Inheritance diagram for Plot::ColorLookupTable< PixelType, Scale >:

Inheritance graph
[legend]
Collaboration diagram for Plot::ColorLookupTable< PixelType, Scale >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<class PixelType = Plot::RGBPixel<>, class Scale = Scale::Linear<double>>
class Plot::ColorLookupTable< PixelType, Scale >

Base class for a finite array of possible colors that can be returned when given a magnitude.

At present a new lookup table is constructed again every time an object of a derived type is created, which is undesirable. Some form of caching should be implemented.

Currently requires an RGB pixel type.

Definition at line 213 of file colorlookup.h.

Public Methods

 ColorLookupTable (size_t numcolors, const Scale &scale=default_scale)
 ColorLookupTable (const string &spec_="", size_t numcolors=0, const Scale &scale=default_scale)
 Constructor accepting a string specification whose characters each stand for colors between which to interpolate.

bool is_valid ()
 Returns true if no errors were found during construction.


Protected Types

typedef std::vector< PixelType > Table

Protected Methods

void interpolate (const size_t start, const size_t finish, const PixelType &startcolor, const PixelType &finishcolor)
 Fill the lookup table (or a portion of it) with linear interpolations between two colors.

PixelType color (const char c)
 Returns a color given a one-character name.


Protected Attributes

Table colors
bool valid


Constructor & Destructor Documentation

template<class PixelType = Plot::RGBPixel<>, class Scale = Scale::Linear<double>>
Plot::ColorLookupTable< PixelType, Scale >::ColorLookupTable const string &    spec_ = "",
size_t    numcolors = 0,
const Scale &    scale = default_scale
[inline]
 

Constructor accepting a string specification whose characters each stand for colors between which to interpolate.

See the color() routine below for the supported colors and characters. Inspired by Yoonsuck Choe's Java colormap class.

Might consider making the numcolors odd and adding a special entry for the top of the range to make the range inclusive. This might be more intuitive and would make plotting inversely-scaled items (with a reversed color order) match regularly-scaled ones.

Definition at line 234 of file colorlookup.h.

References Plot::ColorLookupTable< PixelType, Scale >::color(), and Plot::ColorLookupTable< PixelType, Scale >::interpolate().


Member Function Documentation

template<class PixelType = Plot::RGBPixel<>, class Scale = Scale::Linear<double>>
PixelType Plot::ColorLookupTable< PixelType, Scale >::color const char    c [inline, protected]
 

Returns a color given a one-character name.

Uppercase is full-strength, lowercase is half-strength.

Definition at line 286 of file colorlookup.h.

Referenced by Plot::ColorLookupTable< PixelType, Scale >::ColorLookupTable().

template<class PixelType = Plot::RGBPixel<>, class Scale = Scale::Linear<double>>
void Plot::ColorLookupTable< PixelType, Scale >::interpolate const size_t    start,
const size_t    finish,
const PixelType &    startcolor,
const PixelType &    finishcolor
[inline, protected]
 

Fill the lookup table (or a portion of it) with linear interpolations between two colors.

The upper array index and finishcolor are exclusive.

Definition at line 264 of file colorlookup.h.

Referenced by Plot::ColorLookupTable< PixelType, Scale >::ColorLookupTable().


The documentation for this class was generated from the following file:
Generated on Mon Jan 20 02:37:39 2003 for RF-LISSOM by doxygen1.3-rc2