Debian Codegraph @

src/plugins/imageformats/dds/ddsheader.h

raw symbols SCIP
1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Copyright (C) 2016 Ivan Komissarov.
5 ** Contact: https://www.qt.io/licensing/
6 **
7 ** This file is part of the DDS plugin in the Qt ImageFormats module.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** Commercial License Usage
11 ** Licensees holding valid commercial Qt licenses may use this file in
12 ** accordance with the commercial license agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and The Qt Company. For licensing terms
15 ** and conditions see https://www.qt.io/terms-conditions. For further
16 ** information use the contact form at https://www.qt.io/contact-us.
17 **
18 ** GNU Lesser General Public License Usage
19 ** Alternatively, this file may be used under the terms of the GNU Lesser
20 ** General Public License version 3 as published by the Free Software
21 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
22 ** packaging of this file. Please review the following information to
23 ** ensure the GNU Lesser General Public License version 3 requirements
24 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
25 **
26 ** GNU General Public License Usage
27 ** Alternatively, this file may be used under the terms of the GNU
28 ** General Public License version 2.0 or (at your option) the GNU General
29 ** Public license version 3 or any later version approved by the KDE Free
30 ** Qt Foundation. The licenses are as published by the Free Software
31 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
32 ** included in the packaging of this file. Please review the following
33 ** information to ensure the GNU General Public License requirements will
34 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
35 ** https://www.gnu.org/licenses/gpl-3.0.html.
36 **
37 ** $QT_END_LICENSE$
38 **
39 ****************************************************************************/
40
41 #ifndef DDSHEADER_H
42 #define DDSHEADER_H
43
44 #include <QtCore/QDataStream>
45
46 #ifndef QT_NO_DATASTREAM
47
48 QT_BEGIN_NAMESPACE
49
50 enum Format {
51 FormatUnknown = 0,
52
53 FormatR8G8B8 = 20,
54 FormatA8R8G8B8 = 21,
55 FormatX8R8G8B8 = 22,
56 FormatR5G6B5 = 23,
57 FormatX1R5G5B5 = 24,
58 FormatA1R5G5B5 = 25,
59 FormatA4R4G4B4 = 26,
60 FormatR3G3B2 = 27,
61 FormatA8 = 28,
62 FormatA8R3G3B2 = 29,
63 FormatX4R4G4B4 = 30,
64 FormatA2B10G10R10 = 31,
65 FormatA8B8G8R8 = 32,
66 FormatX8B8G8R8 = 33,
67 FormatG16R16 = 34,
68 FormatA2R10G10B10 = 35,
69 FormatA16B16G16R16 = 36,
70
71 FormatA8P8 = 40,
72 FormatP8 = 41,
73
74 FormatL8 = 50,
75 FormatA8L8 = 51,
76 FormatA4L4 = 52,
77
78 FormatV8U8 = 60,
79 FormatL6V5U5 = 61,
80 FormatX8L8V8U8 = 62,
81 FormatQ8W8V8U8 = 63,
82 FormatV16U16 = 64,
83 FormatA2W10V10U10 = 67,
84
85 FormatUYVY = 0x59565955, // "UYVY"
86 FormatR8G8B8G8 = 0x47424752, // "RGBG"
87 FormatYUY2 = 0x32595559, // "YUY2"
88 FormatG8R8G8B8 = 0x42475247, // "GRGB"
89 FormatDXT1 = 0x31545844, // "DXT1"
90 FormatDXT2 = 0x32545844, // "DXT2"
91 FormatDXT3 = 0x33545844, // "DXT3"
92 FormatDXT4 = 0x34545844, // "DXT4"
93 FormatDXT5 = 0x35545844, // "DXT5"
94 FormatRXGB = 0x42475852, // "RXGB"
95 FormatATI2 = 0x32495441, // "ATI2"
96
97 FormatD16Lockable = 70,
98 FormatD32 = 71,
99 FormatD15S1 = 73,
100 FormatD24S8 = 75,
101 FormatD24X8 = 77,
102 FormatD24X4S4 = 79,
103 FormatD16 = 80,
104
105 FormatD32FLockable = 82,
106 FormatD24FS8 = 83,
107
108 FormatD32Lockable = 84,
109 FormatS8Lockable = 85,
110
111 FormatL16 = 81,
112
113 FormatVertexData =100,
114 FormatIndex16 =101,
115 FormatIndex32 =102,
116
117 FormatQ16W16V16U16 = 110,
118
119 FormatMulti2ARGB8 = 0x3154454d, // "MET1"
120
121 FormatR16F = 111,
122 FormatG16R16F = 112,
123 FormatA16B16G16R16F = 113,
124
125 FormatR32F = 114,
126 FormatG32R32F = 115,
127 FormatA32B32G32R32F = 116,
128
129 FormatCxV8U8 = 117,
130
131 FormatA1 = 118,
132 FormatA2B10G10R10_XR_BIAS = 119,
133 FormatBinaryBuffer = 199,
134
135 FormatP4,
136 FormatA4P4,
137
138 FormatLast = 0x7fffffff
139 };
140
141 struct DDSPixelFormat
142 {
143 enum DDSPixelFormatFlags {
144 FlagAlphaPixels = 0x00000001,
145 FlagAlpha = 0x00000002,
146 FlagFourCC = 0x00000004,
147 FlagPaletteIndexed4 = 0x00000008,
148 FlagPaletteIndexed8 = 0x00000020,
149 FlagRGB = 0x00000040,
150 FlagYUV = 0x00000200,
151 FlagLuminance = 0x00020000,
152 FlagNormal = 0x00080000,
153 FlagRGBA = FlagAlphaPixels | FlagRGB,
154 FlagLA = FlagAlphaPixels | FlagLuminance
155 };
156
157 quint32 size;
158 quint32 flags;
159 quint32 fourCC;
160 quint32 rgbBitCount;
161 quint32 rBitMask;
162 quint32 gBitMask;
163 quint32 bBitMask;
164 quint32 aBitMask;
165 };
166
167 QDataStream &operator>>(QDataStream &s, DDSPixelFormat &pixelFormat);
168 QDataStream &operator<<(QDataStream &s, const DDSPixelFormat &pixelFormat);
169
170 struct DDSHeader
171 {
172 enum DDSFlags {
173 FlagCaps = 0x000001,
174 FlagHeight = 0x000002,
175 FlagWidth = 0x000004,
176 FlagPitch = 0x000008,
177 FlagPixelFormat = 0x001000,
178 FlagMipmapCount = 0x020000,
179 FlagLinearSize = 0x080000,
180 FlagDepth = 0x800000
181 };
182
183 enum DDSCapsFlags {
184 CapsComplex = 0x000008,
185 CapsTexture = 0x001000,
186 CapsMipmap = 0x400000
187 };
188
189 enum DDSCaps2Flags {
190 Caps2CubeMap = 0x0200,
191 Caps2CubeMapPositiveX = 0x0400,
192 Caps2CubeMapNegativeX = 0x0800,
193 Caps2CubeMapPositiveY = 0x1000,
194 Caps2CubeMapNegativeY = 0x2000,
195 Caps2CubeMapPositiveZ = 0x4000,
196 Caps2CubeMapNegativeZ = 0x8000,
197 Caps2Volume = 0x200000
198 };
199
200 enum { ReservedCount = 11 };
201
202 quint32 magic;
203 quint32 size;
204 quint32 flags;
205 quint32 height;
206 quint32 width;
207 quint32 pitchOrLinearSize;
208 quint32 depth;
209 quint32 mipMapCount;
210 quint32 reserved1[ReservedCount];
211 DDSPixelFormat pixelFormat;
212 quint32 caps;
213 quint32 caps2;
214 quint32 caps3;
215 quint32 caps4;
216 quint32 reserved2;
217 };
218
219 QDataStream &operator>>(QDataStream &s, DDSHeader &header);
220 QDataStream &operator<<(QDataStream &s, const DDSHeader &header);
221
222 struct DDSHeaderDX10
223 {
224 quint32 dxgiFormat;
225 quint32 resourceDimension;
226 quint32 miscFlag;
227 quint32 arraySize;
228 quint32 reserved;
229 };
230
231 QDataStream &operator>>(QDataStream &s, DDSHeaderDX10 &header);
232 QDataStream &operator<<(QDataStream &s, const DDSHeaderDX10 &header);
233
234 QT_END_NAMESPACE
235
236 #endif // QT_NO_DATASTREAM
237
238 #endif // DDSHEADER_H