00001 #ifndef Impala_Core_Array_Pattern_FuncRgbOp_h
00002 #define Impala_Core_Array_Pattern_FuncRgbOp_h
00003 
00004 #include "Core/Array/Pattern/Categories.h"
00005 #include "Core/Array/Pattern/ArrayFunc.h"
00006 
00007 namespace Impala
00008 {
00009 namespace Core
00010 {
00011 namespace Array
00012 {
00013 namespace Pattern
00014 {
00015 
00016 
00062 template <class ArrayT, class RgbT>
00063 void
00064 FuncRgbOp(ArrayT* src, UInt8* pixels, int resWidth, int resHeight,
00065           Geometry::GeoIntType gi, RgbT& rgb)
00066 {
00067     typedef typename ArrayT::StorType StorT;
00068     typedef typename ArrayT::ArithType ArithT;
00069 
00070     int width = ArrayCW(src);
00071     int height = ArrayCH(src);
00072 
00073     if (((resWidth == -1) && (resHeight == -1)) ||
00074                 ((resWidth == width) && (resHeight == height)))
00075     {
00076         for (int y=0 ; y<height ; y++)
00077         {
00078             StorT* sPtr = ArrayCPB(src, 0, y);
00079             for (int x=0 ; x<width ; x++)
00080             {
00081                 rgb.DoIt(PtrRead(sPtr, ArithT()), pixels);
00082                 sPtr += ArrayT::ElemSize();
00083                 pixels += 3;
00084             }
00085         }
00086         return;
00087     }
00088     
00089 
00090 
00091 
00092 
00093 
00094 
00095 
00096 
00097 
00098 
00099 
00100 
00101 
00102 
00103 
00104 
00105 
00106 
00107 
00108 
00109 
00110 
00111 }
00112 
00113 } 
00114 } 
00115 } 
00116 } 
00117 
00118 #endif