Main Page   Class Overview   Pixels   Images   Geometry   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:
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; // 50% grey
00053     colorTable[1] = (255 << 24) | (255 << 16) | (  0 << 8) |   0; // red
00054     colorTable[2] = (255 << 24) | (  0 << 16) | (255 << 8) |   0; // green
00055     colorTable[3] = (255 << 24) | (255 << 16) | (255 << 8) |   0; // yellow
00056     colorTable[4] = (255 << 24) | (  0 << 16) | (  0 << 8) | 255; // blue
00057     colorTable[5] = (255 << 24) | (255 << 16) | (  0 << 8) | 255; // magenta
00058     colorTable[6] = (255 << 24) | (  0 << 16) | (255 << 8) | 255; // cyan
00059     colorTable[7] = (255 << 24) | (255 << 16) | (255 << 8) | 255; // white
00060     colorTable[8] = (255 << 24) | (  0 << 16) | (  0 << 8) |   0; // black
00061 }
00062 
00063 
00064 #endif

Generated on Tue Jan 8 13:59:16 2002 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001