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:
00026 typedef ValDoubleT ArithTypeDouble;
00027
00029 HxRgbLabel(HxTagList&);
00030
00032 int doIt(const ValT& pixV)
00033 {
00034 int pix = (int) pixV.x();
00035 int mask = (pix == 0) ? 8 : pix % 8;
00036 return colorTable[mask];
00037 }
00038
00040 int doItDouble(const ValDoubleT& pixV)
00041 {
00042 int pix = (int) pixV.x();
00043 int mask = (pix == 0) ? 8 : pix % 8;
00044 return colorTable[mask];
00045 }
00046
00048 static HxString className()
00049 { return HxString("Label"); }
00050
00051 private:
00052 int colorTable[9];
00053 };
00054
00055
00056 template<class ValT, class ValDoubleT>
00057 HxRgbLabel<ValT, ValDoubleT>::HxRgbLabel(HxTagList&)
00058 {
00059 colorTable[0] = (255 << 24) | (127 << 16) | (127 << 8) | 127;
00060 colorTable[1] = (255 << 24) | (255 << 16) | ( 0 << 8) | 0;
00061 colorTable[2] = (255 << 24) | ( 0 << 16) | (255 << 8) | 0;
00062 colorTable[3] = (255 << 24) | (255 << 16) | (255 << 8) | 0;
00063 colorTable[4] = (255 << 24) | ( 0 << 16) | ( 0 << 8) | 255;
00064 colorTable[5] = (255 << 24) | (255 << 16) | ( 0 << 8) | 255;
00065 colorTable[6] = (255 << 24) | ( 0 << 16) | (255 << 8) | 255;
00066 colorTable[7] = (255 << 24) | (255 << 16) | (255 << 8) | 255;
00067 colorTable[8] = (255 << 24) | ( 0 << 16) | ( 0 << 8) | 0;
00068 }
00069
00070
00071 #endif