00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef __IMAGE_FILE_CLASS__
00029 #define __IMAGE_FILE_CLASS__
00030
00031 #include <iostream>
00032 #include <fstream>
00033 #include <string>
00034 #include <math.h>
00035 #include <stdio.h>
00036 #include <stdlib.h>
00037
00038 namespace celeste
00039 {
00040 enum
00041 {
00042 kChars = 0x01,
00043 kFloats = 0x02,
00044 kRGB = 0x04
00045 };
00046
00047 class ImageFile
00048 {
00049 public:
00050
00051 ImageFile();
00052 virtual ~ImageFile();
00053
00054
00055 inline void SetWidth( int w ) { mWidth = w; }
00056 inline int GetWidth() { return mWidth; }
00057
00058
00059 inline void SetHeight( int h ){ mHeight = h; }
00060 inline int GetHeight(){ return mHeight; }
00061
00062
00063 inline void SetPixel( int x, int y, unsigned char p ) { if ( mPixels != NULL ) mPixels[x][y] = p; }
00064 unsigned char GetPixel( int x, int y );
00065
00066
00067 inline int*** GetRGBPixels( void ) { return mRGB; }
00068 void SetPixels( float** );
00069 float** GetPixels( void );
00070
00071
00072 void Allocate( int dataset );
00073 void Deallocate();
00074
00075
00076 virtual int Read( char* ) = 0;
00077 virtual void Write( char* ) = 0;
00078
00079 protected:
00080
00081 int*** mRGB;
00082 unsigned char** mPixels;
00083 float** mFloats;
00084 int mWidth;
00085 int mHeight;
00086 bool mVerbosity;
00087
00088 };
00089 }
00090 #endif