Qt 4.8
|
#include <qtgafile.h>
Public Types | |
enum | Compression { NoCompression = 0, RleCompression = 1 } |
enum | FooterOffset { ExtensionOffset = 0, DeveloperOffset = 4, SignatureOffset = 8, FooterSize = 26 } |
enum | HeaderOffset { IdLength = 0, ColorMapType = 1, ImageType = 2, CMapStart = 3, CMapLength = 5, CMapDepth = 7, XOffset = 8, YOffset = 10, Width = 12, Height = 14, PixelDepth = 16, ImageDescriptor = 17, HeaderSize = 18 } |
Public Functions | |
Compression | compression () const |
QString | errorMessage () const |
int | height () const |
bool | isValid () const |
QTgaFile (QIODevice *) | |
Construct a new QTgaFile object getting data from device. More... | |
QImage | readImage () |
Reads an image file from the QTgaFile's device, and returns it. More... | |
QSize | size () const |
int | width () const |
int | xOffset () const |
int | yOffset () const |
~QTgaFile () | |
Destroy the device, recovering any resources. More... | |
Static Private Functions | |
static quint16 | littleEndianInt (const unsigned char *d) |
Returns the integer encoded in the two little endian bytes at d. More... | |
Properties | |
QIODevice * | mDevice |
QString | mErrorMessage |
unsigned char | mHeader [HeaderSize] |
File data container for a TrueVision Graphics format file.
Format is as described here: http://local.wasp.uwa.edu.au/~pbourke/dataformats/tga/ http://netghost.narod.ru/gff2/graphics/summary/tga.htm
Usage is:
The class is designed to handle sequential and non-sequential sources, so during construction the mHeader is read. Then during the readImage() call the rest of the data is read.
After passing myFile to the constructor, if the QIODevice *myFile is read, or has seek() called, the results are undefined - so don't do that.
Definition at line 52 of file qtgafile.h.
Enumerator | |
---|---|
NoCompression | |
RleCompression |
Definition at line 55 of file qtgafile.h.
Enumerator | |
---|---|
ExtensionOffset | |
DeveloperOffset | |
SignatureOffset | |
FooterSize |
Definition at line 76 of file qtgafile.h.
Enumerator | |
---|---|
IdLength | |
ColorMapType | |
ImageType | |
CMapStart | |
CMapLength | |
CMapDepth | |
XOffset | |
YOffset | |
Width | |
Height | |
PixelDepth | |
ImageDescriptor | |
HeaderSize |
Definition at line 60 of file qtgafile.h.
QTgaFile::QTgaFile | ( | QIODevice * | device | ) |
Construct a new QTgaFile object getting data from device.
The object does not take ownership of the device, but until the object is destroyed do not do any non-const operations, eg seek or read on the device.
Definition at line 130 of file qtgafile.cpp.
QTgaFile::~QTgaFile | ( | ) |
Destroy the device, recovering any resources.
Definition at line 199 of file qtgafile.cpp.
|
inline |
Definition at line 151 of file qtgafile.h.
Referenced by QTgaHandler::option().
|
inline |
Definition at line 109 of file qtgafile.h.
|
inline |
Definition at line 141 of file qtgafile.h.
Referenced by readImage(), and size().
|
inline |
Definition at line 104 of file qtgafile.h.
Referenced by QTgaHandler::canRead(), and readImage().
|
inlinestaticprivate |
Returns the integer encoded in the two little endian bytes at d.
Definition at line 121 of file qtgafile.h.
Referenced by height(), readImage(), width(), xOffset(), and yOffset().
QImage QTgaFile::readImage | ( | ) |
Reads an image file from the QTgaFile's device, and returns it.
This method seeks to the absolute position of the image data in the file, so no assumptions are made about where the devices read pointer is when this method is called. For this reason only random access devices are supported.
If the constructor completed successfully, such that isValid() returns true, then this method is likely to succeed, unless the file is somehow corrupted.
In the case that the read fails, the QImage returned will be null, such that QImage::isNull() will be true.
Definition at line 220 of file qtgafile.cpp.
Referenced by QTgaHandler::read().
|
inline |
Definition at line 146 of file qtgafile.h.
Referenced by QTgaHandler::option().
|
inline |
Definition at line 136 of file qtgafile.h.
Referenced by readImage(), and size().
|
inline |
Definition at line 126 of file qtgafile.h.
|
inline |
Definition at line 131 of file qtgafile.h.
|
private |
Definition at line 101 of file qtgafile.h.
Referenced by QTgaFile(), and readImage().
|
private |
Definition at line 99 of file qtgafile.h.
Referenced by errorMessage(), isValid(), and QTgaFile().
|
private |
Definition at line 100 of file qtgafile.h.
Referenced by height(), QTgaFile(), readImage(), width(), xOffset(), and yOffset().