Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's quick Index  

HxRgbLabel.h

00001 /*
00002  *  Copyright (c) 2000, University of Amsterdam, The Netherlands.
00003  *  All rights reserved.
00004  *
00005  *  Author(s):
00006  *  Dennis Koelma (koelma@wins.uva.nl)
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; // 50% grey
00060     colorTable[1] = (255 << 24) | (255 << 16) | (  0 << 8) |   0; // red
00061     colorTable[2] = (255 << 24) | (  0 << 16) | (255 << 8) |   0; // green
00062     colorTable[3] = (255 << 24) | (255 << 16) | (255 << 8) |   0; // yellow
00063     colorTable[4] = (255 << 24) | (  0 << 16) | (  0 << 8) | 255; // blue
00064     colorTable[5] = (255 << 24) | (255 << 16) | (  0 << 8) | 255; // magenta
00065     colorTable[6] = (255 << 24) | (  0 << 16) | (255 << 8) | 255; // cyan
00066     colorTable[7] = (255 << 24) | (255 << 16) | (255 << 8) | 255; // white
00067     colorTable[8] = (255 << 24) | (  0 << 16) | (  0 << 8) |   0; // black
00068 }
00069 
00070 
00071 #endif

Generated on Tue Feb 3 14:18:41 2004 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001