34enum class ColorSpace { NONE, GREYSCALE, sRGB, CIELAB, BINARY };
37enum class ImageEncoding { UNSUPPORTED, RAW, TIFF, JPEG2000, JPEG, DEFLATE, PNG, WEBP, AVIF };
40enum class SampleType { FIXEDPOINT, FLOATINGPOINT };
113 RawTile(
int tn = 0,
int res = 0,
int hs = 0,
int vs = 0,
114 int w = 0,
int h = 0,
int c = 0,
int b = 0 )
215 if(
sampleType == SampleType::FLOATINGPOINT )
data =
new float[size/4];
216 else data =
new int[size/4];
219 data =
new unsigned short[size/2];
222 data =
new unsigned char[size];
238 if(
sampleType == SampleType::FLOATINGPOINT )
delete[] (
float*) buffer;
239 else delete[] (
unsigned int*) buffer;
242 delete[] (
unsigned short*) buffer;
245 delete[] (
unsigned char*) buffer;
261 void crop(
const unsigned int w,
const unsigned int h ) {
271 unsigned char* src_ptr = (
unsigned char*) buffer;
272 unsigned char* dst_ptr = (
unsigned char*)
data;
278 for(
unsigned int i=0; i<h; i++ ){
279 memcpy( dst_ptr, src_ptr, dlen );
312 for( uint32_t i=0; i<len; i++ ){
313 for( uint8_t k=0; k<3; k++ ){
315 if(
sampleType == SampleType::FLOATINGPOINT ) ((
float*)
data)[n+k] = ((
float*) buffer)[i];
316 else ((
unsigned int*)
data)[n+k] = ((
unsigned int*) buffer)[i];
318 else if(
bpc == 16 ) ((
unsigned short*)
data)[n+k] = ((
unsigned short*) buffer)[i];
319 else ((
unsigned char*)
data)[n+k] = ((
unsigned char*) buffer)[i];
367#if (__cplusplus >= 201103L) || ((defined(_MSC_VER) && _MSC_VER >= 1900))
390 if( tile.memoryManaged == 1 ){
399 tile.memoryManaged = 0;
402 else if( tile.data && tile.dataLength > 0 ){
404 memcpy(
data, tile.data, tile.dataLength );
419 filename = std::move( tile.filename );
436 if( tile.memoryManaged == 1 ){
445 tile.memoryManaged = 0;
447 else if( tile.data && tile.dataLength > 0 ){
449 memcpy(
data, tile.data, tile.dataLength );
Class to represent a single image tile.
Definition RawTile.h:45
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:113
unsigned int width
The width in pixels of this tile.
Definition RawTile.h:53
uint32_t dataLength
The size of the data pointed to by the data pointer in bytes.
Definition RawTile.h:92
ImageEncoding compressionType
Compression type.
Definition RawTile.h:68
std::string filename
Name of the file from which this tile comes.
Definition RawTile.h:50
int bpc
The number of bits per channel for this tile.
Definition RawTile.h:62
void allocate(uint32_t size=0)
Allocate memory for the tile.
Definition RawTile.h:209
friend int operator!=(const RawTile &A, const RawTile &B)
Overloaded non-equality operator.
Definition RawTile.h:351
time_t timestamp
Tile timestamp.
Definition RawTile.h:74
int vSequence
The vertical angle to which this tile belongs.
Definition RawTile.h:86
RawTile & operator=(const RawTile &tile)
Copy assignment constructor.
Definition RawTile.h:173
friend int operator==(const RawTile &A, const RawTile &B)
Overloaded equality operator.
Definition RawTile.h:335
~RawTile()
Destructor to free the data array if is has previously be allocated locally.
Definition RawTile.h:135
uint32_t capacity
Amount of memory actually allocated in bytes.
Definition RawTile.h:89
void crop(const unsigned int w, const unsigned int h)
Crop tile to the defined dimensions.
Definition RawTile.h:261
int tileNum
The tile number for this tile.
Definition RawTile.h:77
int resolution
The resolution number to which this tile belongs.
Definition RawTile.h:80
void triplicate()
Expand monochrome 1 band image to 3 by duplicating channels.
Definition RawTile.h:297
void deallocate(void *buffer)
Free our data buffer.
Definition RawTile.h:233
void * data
Pointer to the image data.
Definition RawTile.h:100
RawTile(const RawTile &tile)
Copy constructor - handles copying of data buffer.
Definition RawTile.h:142
SampleType sampleType
Sample format type (fixed or floating point)
Definition RawTile.h:65
int memoryManaged
Definition RawTile.h:97
int channels
The number of channels for this tile.
Definition RawTile.h:59
int quality
Compression rate or quality.
Definition RawTile.h:71
int hSequence
The horizontal angle to which this tile belongs.
Definition RawTile.h:83
unsigned int height
The height in pixels of this tile.
Definition RawTile.h:56