ImageBase.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef IMAGEBASE_H
00019 #define IMAGEBASE_H
00020
00021 namespace Image
00022 {
00023
00024 #define IB_CF_GREY8 1 // 8-bit grey level images
00025 #define IB_CF_GREY16 2 // 16-bit grey level images
00026 #define IB_CF_GREY32 3 // 32-bit grey level images
00027 #define IB_CF_RGB24 4 // 24-bit (8,8,8) RGB color images
00028 #define IB_CF_RGB48 5 // 48-bit (16,16,16) RGB color images
00029 #define IB_CF_BGR24 6 // 24-bit (8,8,8) BGR color images
00030 #define IB_CF_BGR48 7 // 48-bit (16,16,16) BGR color images
00031 #define IB_CF_RGBA32 8 // 32-bit (8,8,8,8) RGBA color images (A = alpha)
00032 #define IB_CF_RGBA64 9 // 64-bit (16,16,16,16) RGBA color images (A = alpha)
00033 #define IB_CF_BGRA32 10 // 32-bit (8,8,8,8) BGRA color images (A = alpha)
00034 #define IB_CF_BGRA64 11 // 64-bit (16,16,16,16) BGRA color images (A = alpha)
00035
00036 class ImageExport ImageBase
00037 {
00038 public:
00039
00040 ImageBase();
00041 virtual ~ImageBase();
00042 ImageBase(const ImageBase &rhs);
00043 ImageBase & operator=(const ImageBase &rhs);
00044
00045 bool hasValidData() const { return (_pPixelData != 0); }
00046 void* getPixelDataPtr() { return (void *)_pPixelData; }
00047 bool isOwner() const { return _owner; }
00048 unsigned long getWidth() const { return _width; }
00049 unsigned long getHeight() const { return _height; }
00050 int getFormat() const { return _format; }
00051 unsigned short getNumSigBitsPerSample() const { return _numSigBitsPerSample; }
00052 unsigned short getNumSamples() const { return _numSamples; }
00053 unsigned short getNumBitsPerSample() const { return _numBitsPerSample; }
00054 unsigned short getNumBytesPerPixel() const { return _numBytesPerPixel; }
00055
00056 virtual void clear();
00057 virtual int createCopy(void* pSrcPixelData, unsigned long width, unsigned long height, int format, unsigned short numSigBitsPerSample);
00058 virtual int pointTo(void* pSrcPixelData, unsigned long width, unsigned long height, int format, unsigned short numSigBitsPerSample, bool takeOwnership);
00059
00060 virtual int getSample(int x, int y, unsigned short sampleIndex, double &value);
00061
00062 protected:
00063
00064 int _setColorFormat(int format, unsigned short numSigBitsPerSample);
00065 int _allocate();
00066
00067 unsigned char* _pPixelData;
00068 bool _owner;
00069 unsigned long _width;
00070 unsigned long _height;
00071 int _format;
00072 unsigned short _numSigBitsPerSample;
00073
00074
00075 unsigned short _numSamples;
00076 unsigned short _numBitsPerSample;
00077 unsigned short _numBytesPerPixel;
00078 };
00079
00080 }
00081
00082 #endif // IMAGEBASE_H