#include <colorlookup.h>
Inheritance diagram for Plot::ColorLookupTable< PixelType, Scale >:
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 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(). |
|
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(). |
|
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(). |