![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
#include <qtgafile.h>
Public Types | |
| enum | Compression { NoCompression = 0 , RleCompression = 1 } |
| 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 } |
| enum | FooterOffset { ExtensionOffset = 0 , DeveloperOffset = 4 , SignatureOffset = 8 , FooterSize = 26 } |
Public Member Functions | |
| QTgaFile (QIODevice *) | |
| Construct a new QTgaFile object getting data from device. | |
| ~QTgaFile () | |
| bool | isValid () const |
| QString | errorMessage () const |
| QImage | readImage () |
| int | xOffset () const |
| int | yOffset () const |
| int | width () const |
| int | height () const |
| QSize | size () const |
| Compression | compression () const |
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 16 of file qtgafile.h.
| Enumerator | |
|---|---|
| NoCompression | |
| RleCompression | |
Definition at line 21 of file qtgafile.h.
| Enumerator | |
|---|---|
| ExtensionOffset | |
| DeveloperOffset | |
| SignatureOffset | |
| FooterSize | |
Definition at line 42 of file qtgafile.h.
| Enumerator | |
|---|---|
| IdLength | |
| ColorMapType | |
| ImageType | |
| CMapStart | |
| CMapLength | |
| CMapDepth | |
| XOffset | |
| YOffset | |
| Width | |
| Height | |
| PixelDepth | |
| ImageDescriptor | |
| HeaderSize | |
Definition at line 26 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 102 of file qtgafile.cpp.
References FooterSize, HeaderSize, height(), ImageType, PixelDepth, SignatureOffset, and width().
Referenced by QTgaHandler::canRead().
| QTgaFile::~QTgaFile | ( | ) |
Destroy the device, recovering any resources.
Definition at line 168 of file qtgafile.cpp.
|
inline |
Definition at line 114 of file qtgafile.h.
|
inline |
Definition at line 75 of file qtgafile.h.
|
inline |
Definition at line 104 of file qtgafile.h.
Referenced by QTgaFile(), readImage(), and size().
|
inline |
Definition at line 70 of file qtgafile.h.
Referenced by QTgaHandler::canRead(), QTgaHandler::canRead(), and readImage().
| 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 186 of file qtgafile.cpp.
References CMapDepth, ColorMapType, HeaderSize, height(), IdLength, ImageDescriptor, isValid(), PixelDepth, and width().
|
inline |
Definition at line 109 of file qtgafile.h.
References height(), and width().
|
inline |
Definition at line 99 of file qtgafile.h.
Referenced by QTgaFile(), readImage(), and size().
|
inline |
Definition at line 89 of file qtgafile.h.
|
inline |
Definition at line 94 of file qtgafile.h.