00001 #ifndef _IMAGE__H_
00002 #define _IMAGE__H_
00003
00066
00068 template <class T>
00069 class Image
00070 {
00071 public:
00072
00074 typedef T Type;
00075
00077 Image ();
00078
00082 Image (const int nbRow, const int nbCol);
00083
00088 Image (const int nbRow, const int nbCol, const T &val);
00089
00092 Image (const Image &ima);
00093
00098 Image (const int nbRow, const int nbCol, const T *const buf);
00099
00101 ~Image ();
00102
00107 int NbRow () const ;
00108
00111 int NbCol () const ;
00112
00115 int BufferSize () const ;
00117
00124 const T& operator () (const int row, const int col) const ;
00125
00129 const T& operator [] (const int i) const;
00131
00138 T& operator () (const int row, const int col);
00139
00143 T& operator [] (const int i);
00144
00149 T* PixelPointer (const int row, const int col);
00150
00154 T* PixelPointer (const int i);
00155
00160 const T* PixelPointer (const int row, const int col) const;
00161
00165 const T* PixelPointer (const int i) const;
00166
00168
00174 Image& operator = (const Image &ima);
00175
00178 void InitTo (const T &val);
00179
00183 void Resize (const int nbRow, const int nbCol);
00184
00189 void InitBuff(const T*const otherBuff, const int nbRow, const int nbCol);
00190
00195 void ShallowSetBuff( T* const otherBuff, const int nbRow, const int nbCol);
00197
00198 protected:
00202 T* buffer;
00203
00205 bool deleteBuffer;
00206
00208 int height;
00209
00211 int width;
00212
00214 int bufferSize;
00216
00222 void Allocate(const int nbRow, const int nbCol);
00223
00225 void DeAllocate();
00227
00228 };
00230
00231 #ifndef IMAGE_MAIN
00232 #include "image.cpp"
00233 #endif
00234
00235 #endif // _IMAGE__HH_
00236
00237