Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

RgbLabel.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_Trait_RgbLabel_h
00002 #define Impala_Core_Array_Trait_RgbLabel_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 RgbLabel
00021 {
00022 public:
00024     RgbLabel()
00025     {
00026         mTab[0][0] = 127; mTab[0][1] = 127; mTab[0][2] = 127; // 50% grey
00027         mTab[1][0] = 255; mTab[1][1] =   0; mTab[1][2] =   0; // red
00028         mTab[2][0] =   0; mTab[2][1] = 255; mTab[2][2] =   0; // green
00029         mTab[3][0] = 255; mTab[3][1] = 255; mTab[3][2] =   0; // yellow
00030         mTab[4][0] =   0; mTab[4][1] =   0; mTab[4][2] = 255; // blue
00031         mTab[5][0] = 255; mTab[5][1] =   0; mTab[5][2] = 255; // magenta
00032         mTab[6][0] =   0; mTab[6][1] = 255; mTab[6][2] = 255; // cyan
00033         mTab[7][0] = 255; mTab[7][1] = 255; mTab[7][2] = 255; // white
00034         mTab[8][0] =   0; mTab[8][1] =   0; mTab[8][2] =   0; // black
00035     }
00036 
00038     void
00039     DoIt(const ValT& pixV, UInt8* rgbPtr)
00040     {
00041         int pix = Element::E1Cast(pixV, int());
00042         int mask = (pix == 0) ? 8 : pix % 8;
00043         *rgbPtr++ = mTab[mask][0];
00044         *rgbPtr++ = mTab[mask][1];
00045         *rgbPtr++ = mTab[mask][2];
00046     }
00047 
00048 private:
00049     int mTab[9][3];
00050 };
00051 
00052 } // namespace Trait
00053 } // namespace Array
00054 } // namespace Core
00055 } // namespace Impala
00056 
00057 #endif

Generated on Fri Mar 19 09:30:59 2010 for ImpalaSrc by  doxygen 1.5.1