00001 #pragma ident "$Id: IndexedColorMap.hpp 1644 2009-01-27 19:26:14Z ckiesch $"
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_INDEXEDCOLORMAP_H
00028 #define VDRAW_INDEXEDCOLORMAP_H
00029
00030 #include "Color.hpp"
00031 #include "Palette.hpp"
00032
00033 namespace vdraw
00034 {
00037
00042 class IndexedColorMap
00043 {
00044 public:
00048 IndexedColorMap()
00049 {
00050 cols=rows=0;
00051 c=0;
00052 }
00053
00061 IndexedColorMap(int icols, int irows, const Palette &pp, int base=0);
00062
00064 ~IndexedColorMap() { reset(); }
00065
00067 inline void setColor(int row, int col, int f) { c[row][col]=f; }
00068
00070 inline Color get(int row, int col) const { return p.getColor(getIndex(row,col)); }
00071
00073 inline int getIndex(int row, int col) const { return c[row][col]; }
00074
00076 inline int getCols() const { return cols; }
00077
00079 inline int getRows() const { return rows; }
00080
00082 inline const Palette getPalette() const { return p; }
00083
00085 void reset();
00086
00087 protected:
00089 int cols;
00090
00092 int rows;
00093
00095 Palette p;
00096
00098 int **c;
00099 };
00100
00101
00102
00103 }
00104
00105 #endif // VDRAW_INDEXEDCOLORMAP_H
00106