00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef HxRgbLabel_h
00011 #define HxRgbLabel_h
00012
00013 #include "HxTagList.h"
00014 #include "HxClassName.h"
00015 #include "HxColConvert.h"
00016
00017
00021 template<class ValT, class ValDoubleT>
00022 class HxRgbLabel
00023 {
00024 public:
00025 HxRgbLabel(HxTagList&);
00026
00027 int doIt(const ValT& pixV)
00028 {
00029 int pix = (int) pixV.x();
00030 int mask = (pix == 0) ? 8 : pix % 8;
00031 return colorTable[mask];
00032 }
00033
00034 int doItDouble(const ValDoubleT& pixV)
00035 {
00036 int pix = (int) pixV.x();
00037 int mask = (pix == 0) ? 8 : pix % 8;
00038 return colorTable[mask];
00039 }
00040
00041 static HxString className()
00042 { return HxString("Label"); }
00043
00044 private:
00045 int colorTable[9];
00046 };
00047
00048
00049 template<class ValT, class ValDoubleT>
00050 HxRgbLabel<ValT, ValDoubleT>::HxRgbLabel(HxTagList&)
00051 {
00052 colorTable[0] = (255 << 24) | (127 << 16) | (127 << 8) | 127;
00053 colorTable[1] = (255 << 24) | (255 << 16) | ( 0 << 8) | 0;
00054 colorTable[2] = (255 << 24) | ( 0 << 16) | (255 << 8) | 0;
00055 colorTable[3] = (255 << 24) | (255 << 16) | (255 << 8) | 0;
00056 colorTable[4] = (255 << 24) | ( 0 << 16) | ( 0 << 8) | 255;
00057 colorTable[5] = (255 << 24) | (255 << 16) | ( 0 << 8) | 255;
00058 colorTable[6] = (255 << 24) | ( 0 << 16) | (255 << 8) | 255;
00059 colorTable[7] = (255 << 24) | (255 << 16) | (255 << 8) | 255;
00060 colorTable[8] = (255 << 24) | ( 0 << 16) | ( 0 << 8) | 0;
00061 }
00062
00063
00064 #endif