1
/***************************************************************************
3
* This is a class for holding and handling basic image data *
5
* Author: Graeme van der Vlugt *
6
* Copyright: Imetric 3D GmbH *
10
* This program is free software; you can redistribute it and/or modify *
11
* it under the terms of the GNU Library General Public License as *
12
* published by the Free Software Foundation; either version 2 of the *
13
* License, or (at your option) any later version. *
14
* for detail see the LICENCE text file. *
16
***************************************************************************/
24
#define IB_CF_GREY8 1 // 8-bit grey level images
25
#define IB_CF_GREY16 2 // 16-bit grey level images
26
#define IB_CF_GREY32 3 // 32-bit grey level images
27
#define IB_CF_RGB24 4 // 24-bit (8,8,8) RGB color images
28
#define IB_CF_RGB48 5 // 48-bit (16,16,16) RGB color images
29
#define IB_CF_BGR24 6 // 24-bit (8,8,8) BGR color images
30
#define IB_CF_BGR48 7 // 48-bit (16,16,16) BGR color images
31
#define IB_CF_RGBA32 8 // 32-bit (8,8,8,8) RGBA color images (A = alpha)
32
#define IB_CF_RGBA64 9 // 64-bit (16,16,16,16) RGBA color images (A = alpha)
33
#define IB_CF_BGRA32 10 // 32-bit (8,8,8,8) BGRA color images (A = alpha)
34
#define IB_CF_BGRA64 11 // 64-bit (16,16,16,16) BGRA color images (A = alpha)
36
class ImageAppExport ImageBase
42
ImageBase(const ImageBase &rhs);
43
ImageBase & operator=(const ImageBase &rhs);
45
bool hasValidData() const { return (_pPixelData != 0); }
46
void* getPixelDataPtr() { return (void *)_pPixelData; }
47
bool isOwner() const { return _owner; }
48
unsigned long getWidth() const { return _width; }
49
unsigned long getHeight() const { return _height; }
50
int getFormat() const { return _format; }
51
unsigned short getNumSigBitsPerSample() const { return _numSigBitsPerSample; }
52
unsigned short getNumSamples() const { return _numSamples; }
53
unsigned short getNumBitsPerSample() const { return _numBitsPerSample; }
54
unsigned short getNumBytesPerPixel() const { return _numBytesPerPixel; }
57
virtual int createCopy(void* pSrcPixelData, unsigned long width, unsigned long height, int format, unsigned short numSigBitsPerSample);
58
virtual int pointTo(void* pSrcPixelData, unsigned long width, unsigned long height, int format, unsigned short numSigBitsPerSample, bool takeOwnership);
60
virtual int getSample(int x, int y, unsigned short sampleIndex, double &value);
64
int _setColorFormat(int format, unsigned short numSigBitsPerSample);
67
unsigned char* _pPixelData; // pointer to the pixel data
68
bool _owner; // flag defining if the object owns the pixel data or not
69
unsigned long _width; // width of image (number of pixels in horizontal direction)
70
unsigned long _height; // height of image (number of pixels in vertical direction)
71
int _format; // colour format of the pixel data
72
unsigned short _numSigBitsPerSample;// number of significant bits per sample (always <= _numBitsPerSample)
74
// Dependant parameters
75
unsigned short _numSamples; // number of samples per pixel (e.g. 1 for grey, 3 for rgb, 4 for rgba)
76
unsigned short _numBitsPerSample; // number of bits per sample (e.g. 8 for Grey8)
77
unsigned short _numBytesPerPixel; // number of bytes per pixel (e.g. 1 for Grey8)
80
} // namespace ImageApp