00001 #pragma ident "$Id: InterpolatedColorMap.hpp 3140 2012-06-18 15:03:02Z susancummins $"
00002
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef VDRAW_INTERPOLATEDCOLORMAP_H
00028 #define VDRAW_INTERPOLATEDCOLORMAP_H
00029
00030 #include "Color.hpp"
00031 #include "Palette.hpp"
00032
00033 namespace vdraw
00034 {
00037
00042 class InterpolatedColorMap
00043 {
00044 public:
00048 InterpolatedColorMap()
00049 {
00050 cols=rows=0;
00051 c=0;
00052 }
00053
00061 InterpolatedColorMap(int icols, int irows, const Palette &pp, double base=0.0);
00062
00064 InterpolatedColorMap(const InterpolatedColorMap &o);
00065
00067 ~InterpolatedColorMap() { reset(); }
00068
00084 InterpolatedColorMap& operator=(InterpolatedColorMap o);
00085
00087 inline void setColor(int row, int col, double f) { c[row][col]=f; }
00088
00090 inline Color get(int row, int col) const { return p.getColor(getIndex(row,col)); }
00091
00093 inline double getIndex(int row, int col) const { return c[row][col]; }
00094
00096 inline int getCols() const { return cols; }
00097
00099 inline int getRows() const { return rows; }
00100
00102 inline const Palette getPalette() const { return p; }
00103
00104 protected:
00106 void init(int icols, int irows);
00107
00109 void reset();
00110
00112 int cols;
00113
00115 int rows;
00116
00118 Palette p;
00119
00121 double **c;
00122 };
00123
00125
00126 }
00127
00128 #endif // VDRAW_INTERPOLATEDCOLORMAP_H
00129