30#if !( (__cplusplus >= 201103L) || ((defined(_MSC_VER) && _MSC_VER >= 1900)) )
36enum ColourSpaces { NONE, GREYSCALE, sRGB, CIELAB, BINARY };
39enum CompressionType { UNCOMPRESSED, JPEG, DEFLATE, PNG, WEBP };
42enum SampleType { FIXEDPOINT, FLOATINGPOINT };
115 RawTile(
int tn = 0,
int res = 0,
int hs = 0,
int vs = 0,
116 int w = 0,
int h = 0,
int c = 0,
int b = 0 )
218 else data =
new int[size/4];
221 data =
new unsigned short[size/2];
224 data =
new unsigned char[size];
240 if(
sampleType == FLOATINGPOINT )
delete[] (
float*) buffer;
241 else delete[] (
unsigned int*) buffer;
244 delete[] (
unsigned short*) buffer;
247 delete[] (
unsigned char*) buffer;
263 void crop(
const unsigned int w,
const unsigned int h ) {
273 unsigned char* src_ptr = (
unsigned char*) buffer;
274 unsigned char* dst_ptr = (
unsigned char*)
data;
280 for(
unsigned int i=0; i<h; i++ ){
281 memcpy( dst_ptr, src_ptr, dlen );
331#if (__cplusplus >= 201103L) || ((defined(_MSC_VER) && _MSC_VER >= 1900))
354 if( tile.memoryManaged == 1 ){
363 tile.memoryManaged = 0;
366 else if( tile.data && tile.dataLength > 0 ){
368 memcpy(
data, tile.data, tile.dataLength );
383 filename = std::move( tile.filename );
400 if( tile.memoryManaged == 1 ){
409 tile.memoryManaged = 0;
411 else if( tile.data && tile.dataLength > 0 ){
413 memcpy(
data, tile.data, tile.dataLength );
Class to represent a single image tile.
Definition: RawTile.h:47
RawTile(int tn=0, int res=0, int hs=0, int vs=0, int w=0, int h=0, int c=0, int b=0)
Main constructor.
Definition: RawTile.h:115
unsigned int width
The width in pixels of this tile.
Definition: RawTile.h:55
uint32_t dataLength
The size of the data pointed to by the data pointer in bytes.
Definition: RawTile.h:94
std::string filename
Name of the file from which this tile comes.
Definition: RawTile.h:52
int bpc
The number of bits per channel for this tile.
Definition: RawTile.h:64
void allocate(uint32_t size=0)
Allocate memory for the tile.
Definition: RawTile.h:211
friend int operator!=(const RawTile &A, const RawTile &B)
Overloaded non-equality operator.
Definition: RawTile.h:315
time_t timestamp
Tile timestamp.
Definition: RawTile.h:76
int vSequence
The vertical angle to which this tile belongs.
Definition: RawTile.h:88
RawTile & operator=(const RawTile &tile)
Copy assignment constructor.
Definition: RawTile.h:175
friend int operator==(const RawTile &A, const RawTile &B)
Overloaded equality operator.
Definition: RawTile.h:299
~RawTile()
Destructor to free the data array if is has previously be allocated locally.
Definition: RawTile.h:137
uint32_t capacity
Amount of memory actually allocated in bytes.
Definition: RawTile.h:91
void crop(const unsigned int w, const unsigned int h)
Crop tile to the defined dimensions.
Definition: RawTile.h:263
int tileNum
The tile number for this tile.
Definition: RawTile.h:79
int resolution
The resolution number to which this tile belongs.
Definition: RawTile.h:82
void deallocate(void *buffer)
Free our data buffer.
Definition: RawTile.h:235
void * data
Pointer to the image data.
Definition: RawTile.h:102
RawTile(const RawTile &tile)
Copy constructor - handles copying of data buffer.
Definition: RawTile.h:144
SampleType sampleType
Sample format type (fixed or floating point)
Definition: RawTile.h:67
CompressionType compressionType
Compression type.
Definition: RawTile.h:70
int memoryManaged
Definition: RawTile.h:99
int channels
The number of channels for this tile.
Definition: RawTile.h:61
int quality
Compression rate or quality.
Definition: RawTile.h:73
int hSequence
The horizontal angle to which this tile belongs.
Definition: RawTile.h:85
unsigned int height
The height in pixels of this tile.
Definition: RawTile.h:58