00001 #ifndef _AnImageAdaptor_H 00002 #define _AnImageAdaptor_H 00003 00004 #include <stdio.h> 00005 00006 00007 00026 #include "AnImage.hpp" 00027 00028 class AnImageAdaptor 00029 { 00030 protected: 00031 00032 AnImage* image; 00033 int width0, height0; 00034 00035 public: 00036 00037 AnImageAdaptor(AnImage* animage=0) 00038 { 00039 image= animage; 00040 width0=height0=0; 00041 if( image != 0 ){width0= image->getWidth(); height0= image->getHeight();} 00042 } 00043 virtual ~AnImageAdaptor(){ image= 0; } 00044 00045 void set(AnImage* im) 00046 { 00047 image= im; 00048 width0=height0=0; 00049 if( image != 0 ){width0= image->getWidth(); height0= image->getHeight();} 00050 } 00051 00052 int getWidth(){ return width0; } 00053 int getHeight(){ return height0; } 00054 int getChannels(){ return image->getChannels(); } 00055 int getChannelDepth(){ return image->getPower2MaxRangeBoundary(); } 00056 00057 virtual int get(int x, int y, int c=0){ return image->get(c,x,y); } 00058 00059 virtual int igetR(double x, double y, int c=0)=0; // integer rounding 00060 virtual double getR(double x, double y, int c=0)=0; // interpolated value 00061 }; 00062 00063 #endif