bool intReadFrameFloat(float *data) {
if (!tif) return false;
if (!(wwidth>0 && hheight>0)) tinyTIFFErrorHandler("QFImageReaderTinyTIFF", QObject::tr("error in file '%1': frame %2 is too small\n").arg(filename).arg(frame));
else {
if (bits==8) TinyTIFFReader_readFrame<uint8_t, float>(tif, data);
else if (bits==16) TinyTIFFReader_readFrame<uint16_t, float>(tif, data);
else if (bits==32) TinyTIFFReader_readFrame<uint32_t, float>(tif, data);
else {
tinyTIFFErrorHandler("QFImageReaderTinyTIFF", QObject::tr("frame %1 has a datatype not convertible to float (type=%2, bitspersample=%3)\n").arg(frame).arg(sformat).arg(bits));
return false;
}
if (bits==8) TinyTIFFReader_readFrame<int8_t, float>(tif, data);
else if (bits==16) TinyTIFFReader_readFrame<int16_t, float>(tif, data);
else if (bits==32) TinyTIFFReader_readFrame<int32_t, float>(tif, data);
else {
tinyTIFFErrorHandler("QFImageReaderTinyTIFF", QObject::tr("frame %1 has a datatype not convertible to float (type=%2, bitspersample=%3)\n").arg(frame).arg(sformat).arg(bits));
return false;
}
if (bits==32) TinyTIFFReader_readFrame<float, float>(tif, data);
else {
tinyTIFFErrorHandler("QFImageReaderTinyTIFF", QObject::tr("frame %1 has a datatype not convertible to float (type=%2, bitspersample=%3)\n").arg(frame).arg(sformat).arg(bits));
return false;
}
} else {
tinyTIFFErrorHandler("QFImageReaderTinyTIFF", QObject::tr("frame %1 has a datatype not convertible to float (type=%2, bitspersample=%3)\n").arg(frame).arg(sformat).arg(bits));
return false;
}
}
tinyTIFFErrorHandler(
"QFImageReaderTinyTIFF", QObject::tr(
"error reading frame %1: %2\n").arg(frame).arg(
TinyTIFFReader_getLastError(tif)));
return false;
}
return true;
}
uint16_t TinyTIFFReader_getSampleFormat(TinyTIFFReaderFile *tiff)
return the sample format of the current frame
Definition tinytiffreader.c:1055
uint16_t TinyTIFFReader_getBitsPerSample(TinyTIFFReaderFile *tiff, int sample)
return the bits per sample of the current frame
Definition tinytiffreader.c:1062
int TinyTIFFReader_wasError(TinyTIFFReaderFile *tiff)
returns TINYTIFF_TRUE (non-zero) when there was an error in the last function call,...
Definition tinytiffreader.c:332
uint32_t TinyTIFFReader_getWidth(TinyTIFFReaderFile *tiff)
return the width of the current frame
Definition tinytiffreader.c:1033
const char * TinyTIFFReader_getLastError(TinyTIFFReaderFile *tiff)
returns a pointer to the last error message
Definition tinytiffreader.c:327
uint32_t TinyTIFFReader_getHeight(TinyTIFFReaderFile *tiff)
return the height of the current frame
Definition tinytiffreader.c:1040
#define TINYTIFF_SAMPLEFORMAT_UINT
possible return value of TinyTIFFReader_getSampleFormat(), indicating unsigned integer data
Definition tinytiff_defs.h:45
#define TINYTIFF_SAMPLEFORMAT_FLOAT
possible return value of TinyTIFFReader_getSampleFormat(), indicating floating-point data
Definition tinytiff_defs.h:59
#define TINYTIFF_SAMPLEFORMAT_INT
possible return value of TinyTIFFReader_getSampleFormat(), indicating integer data
Definition tinytiff_defs.h:52