00001 #ifndef Impala_Core_Array_Trait_RgbLabel60_h
00002 #define Impala_Core_Array_Trait_RgbLabel60_h
00003
00004 #include "Core/Array/Element/E1Cast.h"
00005
00006 namespace Impala
00007 {
00008 namespace Core
00009 {
00010 namespace Array
00011 {
00012 namespace Trait
00013 {
00014
00015
00019 template<class ValT>
00020 class RgbLabel60
00021 {
00022 public:
00024 RgbLabel60()
00025 {
00026 pl[0][0] = 255; pl[0][1] = 0;
00027 pl[1][0] = 191; pl[1][1] = 63;
00028 pl[2][0] = 127; pl[2][1] = 0;
00029 pl[3][0] = 255; pl[3][1] = 63;
00030 pl[4][0] = 191; pl[4][1] = 0;
00031 pl[5][0] = 255; pl[5][1] = 127;
00032 pl[6][0] = 63; pl[6][1] = 0;
00033 pl[7][0] = 191; pl[7][1] = 127;
00034 pl[8][0] = 255; pl[8][1] = 191;
00035 pl[9][0] = 127; pl[9][1] = 63;
00036
00037 int id = 0;
00038 for (int i=0; i<10; i++) {
00039 red[id] = pl[i][0]; green[id] = pl[i][1]; blue[id] = pl[i][1]; id++;
00040 red[id] = pl[i][0]; green[id] = pl[i][0]; blue[id] = pl[i][1]; id++;
00041 red[id] = pl[i][0]; green[id] = pl[i][1]; blue[id] = pl[i][0]; id++;
00042 red[id] = pl[i][1]; green[id] = pl[i][0]; blue[id] = pl[i][1]; id++;
00043 red[id] = pl[i][1]; green[id] = pl[i][0]; blue[id] = pl[i][0]; id++;
00044 red[id] = pl[i][1]; green[id] = pl[i][1]; blue[id] = pl[i][0]; id++;
00045 }
00046 red[60] = 0; green[60] = 0; blue[60] = 0;
00047 }
00048
00050 void
00051 DoIt(const ValT& pixV, UInt8* rgbPtr)
00052 {
00053 int pix = Element::E1Cast(pixV, int());
00054 int mask = (pix < 0) ? 60 : pix % 60;
00055 *rgbPtr++ = red[mask];
00056 *rgbPtr++ = green[mask];
00057 *rgbPtr++ = blue[mask];
00058 }
00059
00060 private:
00061 UInt8 pl[10][2];
00062 UInt8 red[61];
00063 UInt8 green[61];
00064 UInt8 blue[61];
00065 };
00066
00067 }
00068 }
00069 }
00070 }
00071
00072 #endif