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 HxRgbDirect_h 00011 #define HxRgbDirect_h 00012 00013 #include "HxTagList.h" 00014 #include "HxClassName.h" 00015 #include "HxColConvert.h" 00016 00017 00021 template<class ValT, class ValDoubleT> 00022 class HxRgbDirect 00023 { 00024 public: 00026 typedef ValDoubleT ArithTypeDouble; 00027 00029 HxRgbDirect(HxTagList&) 00030 {} 00031 00033 int doIt(const ValT& pixV) 00034 { return HxColRGB2int((HxVec3Int) pixV); } 00035 00037 int doItDouble(const ValDoubleT& pixV) 00038 { return HxColRGB2int((HxVec3Double) pixV); } 00039 00041 static HxString className() 00042 { return HxString("Direct"); } 00043 }; 00044 00045 00049 template<class ValT, class ValDoubleT> 00050 class HxRgbDirectNC 00051 { 00052 public: 00054 typedef ValDoubleT ArithTypeDouble; 00055 00057 HxRgbDirectNC(HxTagList&) 00058 {} 00059 00061 int doIt(const ValT& pixV) 00062 { 00063 HxVec3Int v = (HxVec3Int) pixV; 00064 return (255 << 24) | (v.x() << 16) | (v.y() << 8) | v.z(); 00065 } 00066 00068 int doItDouble(const ValDoubleT& pixV) 00069 { 00070 HxVec3Int v = (HxVec3Int) pixV; 00071 return (255 << 24) | (v.x() << 16) | (v.y() << 8) | v.z(); 00072 } 00073 00075 static HxString className() 00076 { return HxString("DirectNC"); } 00077 }; 00078 00079 00080 #endif