| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the TGA plugin in the Qt ImageFormats module. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 24 | ** |
| 25 | ** GNU General Public License Usage |
| 26 | ** Alternatively, this file may be used under the terms of the GNU |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General |
| 28 | ** Public license version 3 or any later version approved by the KDE Free |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 31 | ** included in the packaging of this file. Please review the following |
| 32 | ** information to ensure the GNU General Public License requirements will |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
| 35 | ** |
| 36 | ** $QT_END_LICENSE$ |
| 37 | ** |
| 38 | ****************************************************************************/ |
| 39 | |
| 40 | #ifndef QTGAFILE_H |
| 41 | #define QTGAFILE_Hcxx . . $ `src/plugins/imageformats/tga/qtgafile.h:41:9`! |
| 42 | |
| 43 | #include <QtGui/QColor> |
| 44 | #include <QtGui/QImage> |
| 45 | #include <QtCore/QCoreApplication> |
| 46 | |
| 47 | QT_BEGIN_NAMESPACEcxx . . $ `<external>/15045578679651060896/qglobal.h:148:10`! |
| 48 | |
| 49 | class QIODevicecxx . . $ QIODevice#; |
| 50 | |
| 51 | class QTgaFilecxx . . $ QTgaFile# |
| 52 | { |
| 53 | Q_DECLARE_TR_FUNCTIONScxx . . $ `<external>/3955209949423095026/qcoreapplication.h:244:9`!(QTgaFile) |
| 54 | |
| 55 | public: |
| 56 | enum Compressioncxx . . $ QTgaFile#Compression# { |
| 57 | NoCompressioncxx . . $ QTgaFile#NoCompression. = 0, |
| 58 | RleCompressioncxx . . $ QTgaFile#RleCompression. = 1 |
| 59 | }; |
| 60 | |
| 61 | enum HeaderOffsetcxx . . $ QTgaFile#HeaderOffset# { |
| 62 | IdLengthcxx . . $ QTgaFile#IdLength. = 0, /* 00h Size of Image ID field */ |
| 63 | ColorMapTypecxx . . $ QTgaFile#ColorMapType. = 1, /* 01h Color map type */ |
| 64 | ImageTypecxx . . $ QTgaFile#ImageType. = 2, /* 02h Image type code */ |
| 65 | CMapStartcxx . . $ QTgaFile#CMapStart. = 3, /* 03h Color map origin */ |
| 66 | CMapLengthcxx . . $ QTgaFile#CMapLength. = 5, /* 05h Color map length */ |
| 67 | CMapDepthcxx . . $ QTgaFile#CMapDepth. = 7, /* 07h Depth of color map entries */ |
| 68 | XOffsetcxx . . $ QTgaFile#XOffset. = 8, /* 08h X origin of image */ |
| 69 | YOffsetcxx . . $ QTgaFile#YOffset. = 10, /* 0Ah Y origin of image */ |
| 70 | Widthcxx . . $ QTgaFile#Width. = 12, /* 0Ch Width of image */ |
| 71 | Heightcxx . . $ QTgaFile#Height. = 14, /* 0Eh Height of image */ |
| 72 | PixelDepthcxx . . $ QTgaFile#PixelDepth. = 16, /* 10h Image pixel size */ |
| 73 | ImageDescriptorcxx . . $ QTgaFile#ImageDescriptor. = 17, /* 11h Image descriptor byte */ |
| 74 | HeaderSizecxx . . $ QTgaFile#HeaderSize. = 18 |
| 75 | }; |
| 76 | |
| 77 | enum FooterOffsetcxx . . $ QTgaFile#FooterOffset# { |
| 78 | ExtensionOffsetcxx . . $ QTgaFile#ExtensionOffset. = 0, |
| 79 | DeveloperOffsetcxx . . $ QTgaFile#DeveloperOffset. = 4, |
| 80 | SignatureOffsetcxx . . $ QTgaFile#SignatureOffset. = 8, |
| 81 | FooterSizecxx . . $ QTgaFile#FooterSize. = 26 |
| 82 | }; |
| 83 | |
| 84 | QTgaFilecxx . . $ QTgaFile#QTgaFile(bebe8f2dee7f9e86).(QIODevicecxx . . $ QIODevice# *); |
| 85 | ~cxx . . $ QTgaFile#`~QTgaFile`(ced63f7c635d850d).QTgaFilecxx . . $ QTgaFile#(); |
| 86 | |
| 87 | inline bool isValidcxx . . $ QTgaFile#isValid(50ce9a9e25b4a850).() const; |
| 88 | inline QStringcxx . . $ QString# errorMessagecxx . . $ QTgaFile#errorMessage(6ef7b6c27b00b43d).() const; |
| 89 | QImagecxx . . $ QImage# readImagecxx . . $ QTgaFile#readImage(89a140e6ec82607c).(); |
| 90 | inline int xOffsetcxx . . $ QTgaFile#xOffset(455f465bc33b4cdf).() const; |
| 91 | inline int yOffsetcxx . . $ QTgaFile#yOffset(455f465bc33b4cdf).() const; |
| 92 | inline int widthcxx . . $ QTgaFile#width(455f465bc33b4cdf).() const; |
| 93 | inline int heightcxx . . $ QTgaFile#height(455f465bc33b4cdf).() const; |
| 94 | inline QSizecxx . . $ QSize# sizecxx . . $ QTgaFile#size(4b3b776e5ee2b367).() const; |
| 95 | inline Compressioncxx . . $ QTgaFile#Compression# compressioncxx . . $ QTgaFile#compression(f01dc19f87fdf233).() const; |
| 96 | |
| 97 | private: |
| 98 | static inline quint16cxx . . $ quint16# littleEndianIntcxx . . $ QTgaFile#littleEndianInt(469dcb4e54b221a8).(const unsigned char *d); |
| 99 | |
| 100 | QStringcxx . . $ QString# mErrorMessagecxx . . $ QTgaFile#mErrorMessage.; |
| 101 | unsigned char mHeadercxx . . $ QTgaFile#mHeader.[HeaderSizecxx . . $ QTgaFile#HeaderSize.]; |
| 102 | QIODevicecxx . . $ QIODevice# *mDevicecxx . . $ QTgaFile#mDevice.; |
| 103 | }; |
| 104 | |
| 105 | inline bool QTgaFilecxx . . $ QTgaFile#::isValidcxx . . $ QTgaFile#isValid(50ce9a9e25b4a850).() const |
| 106 | { |
| 107 | return mErrorMessagecxx . . $ QTgaFile#mErrorMessage..isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).(); |
| 108 | } |
| 109 | |
| 110 | inline QStringcxx . . $ QString# QTgaFilecxx . . $ QTgaFile#::errorMessagecxx . . $ QTgaFile#errorMessage(6ef7b6c27b00b43d).() const |
| 111 | { |
| 112 | return mErrorMessagecxx . . $ QString#QString(132dd6869045752b).; |
| 113 | } |
| 114 | |
| 115 | /*! |
| 116 | \internal |
| 117 | Returns the integer encoded in the two little endian bytes at \a d. |
| 118 | */ |
| 119 | inline quint16cxx . . $ quint16# QTgaFilecxx . . $ QTgaFile#::littleEndianIntcxx . . $ QTgaFile#littleEndianInt(469dcb4e54b221a8).(const unsigned char *d) |
| 120 | { |
| 121 | return d[0] + d[1] * 256; |
| 122 | } |
| 123 | |
| 124 | inline int QTgaFilecxx . . $ QTgaFile#::xOffsetcxx . . $ QTgaFile#xOffset(455f465bc33b4cdf).() const |
| 125 | { |
| 126 | return littleEndianIntcxx . . $ QTgaFile#littleEndianInt(469dcb4e54b221a8).(&mHeadercxx . . $ QTgaFile#mHeader.[XOffsetcxx . . $ QTgaFile#XOffset.]); |
| 127 | } |
| 128 | |
| 129 | inline int QTgaFilecxx . . $ QTgaFile#::yOffsetcxx . . $ QTgaFile#yOffset(455f465bc33b4cdf).() const |
| 130 | { |
| 131 | return littleEndianIntcxx . . $ QTgaFile#littleEndianInt(469dcb4e54b221a8).(&mHeadercxx . . $ QTgaFile#mHeader.[YOffsetcxx . . $ QTgaFile#YOffset.]); |
| 132 | } |
| 133 | |
| 134 | inline int QTgaFilecxx . . $ QTgaFile#::widthcxx . . $ QTgaFile#width(455f465bc33b4cdf).() const |
| 135 | { |
| 136 | return littleEndianIntcxx . . $ QTgaFile#littleEndianInt(469dcb4e54b221a8).(&mHeadercxx . . $ QTgaFile#mHeader.[Widthcxx . . $ QTgaFile#Width.]); |
| 137 | } |
| 138 | |
| 139 | inline int QTgaFilecxx . . $ QTgaFile#::heightcxx . . $ QTgaFile#height(455f465bc33b4cdf).() const |
| 140 | { |
| 141 | return littleEndianIntcxx . . $ QTgaFile#littleEndianInt(469dcb4e54b221a8).(&mHeadercxx . . $ QTgaFile#mHeader.[Heightcxx . . $ QTgaFile#Height.]); |
| 142 | } |
| 143 | |
| 144 | inline QSizecxx . . $ QSize# QTgaFilecxx . . $ QTgaFile#::sizecxx . . $ QTgaFile#size(4b3b776e5ee2b367).() const |
| 145 | { |
| 146 | return QSizecxx . . $ QSize#QSize(c0d38f4800714fae).(widthcxx . . $ QTgaFile#width(455f465bc33b4cdf).(), heightcxx . . $ QTgaFile#height(455f465bc33b4cdf).()); |
| 147 | } |
| 148 | |
| 149 | inline QTgaFilecxx . . $ QTgaFile#::Compressioncxx . . $ QTgaFile#Compression# QTgaFilecxx . . $ QTgaFile#::compressioncxx . . $ QTgaFile#compression(f01dc19f87fdf233).() const |
| 150 | { |
| 151 | // TODO: for now, only handle type 2 files, with no color table |
| 152 | // and no compression |
| 153 | return NoCompressioncxx . . $ QTgaFile#NoCompression.; |
| 154 | } |
| 155 | |
| 156 | QT_END_NAMESPACEcxx . . $ `<external>/15045578679651060896/qglobal.h:149:10`! |
| 157 | |
| 158 | #endif // QTGAFILE_H |