Unofficial OpenGL Software Development Kit
0.5.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
distro
glsdk_0_5_1
glimg
include
glimg
ImageFormat.h
Go to the documentation of this file.
1
#ifndef GLIMG_IMAGE_FORMAT_H
2
#define GLIMG_IMAGE_FORMAT_H
3
4
#include <string>
5
#include <exception>
6
7
16
namespace
glimg
17
{
20
29
enum
PixelDataType
30
{
31
DT_NORM_UNSIGNED_INTEGER
,
32
DT_NORM_SIGNED_INTEGER
,
33
DT_UNSIGNED_INTEGRAL
,
34
DT_SIGNED_INTEGRAL
,
35
DT_FLOAT
,
36
DT_SHARED_EXP_FLOAT
,
37
DT_NUM_UNCOMPRESSED_TYPES,
38
39
DT_COMPRESSED_BC1
= DT_NUM_UNCOMPRESSED_TYPES,
40
DT_COMPRESSED_BC2
,
41
DT_COMPRESSED_BC3
,
42
DT_COMPRESSED_UNSIGNED_BC4
,
43
DT_COMPRESSED_SIGNED_BC4
,
44
DT_COMPRESSED_UNSIGNED_BC5
,
45
DT_COMPRESSED_SIGNED_BC5
,
46
DT_COMPRESSED_UNSIGNED_BC6H
,
47
DT_COMPRESSED_SIGNED_BC6H
,
48
DT_COMPRESSED_BC7
,
49
50
DT_NUM_TYPES,
51
};
52
60
enum
PixelComponents
61
{
62
FMT_COLOR_RED
,
63
FMT_COLOR_RG
,
64
FMT_COLOR_RGB
,
65
FMT_COLOR_RGBX
,
66
FMT_COLOR_RGBA
,
67
FMT_COLOR_RGB_sRGB
,
68
FMT_COLOR_RGBX_sRGB
,
69
FMT_COLOR_RGBA_sRGB
,
70
71
FMT_DEPTH
,
72
FMT_DEPTH_X
,
73
74
FMT_NUM_FORMATS,
75
};
76
85
enum
ComponentOrder
86
{
87
ORDER_RGBA
,
88
ORDER_BGRA
,
89
ORDER_RGBE
,
90
91
ORDER_DEPTH_STENCIL
,
92
93
ORDER_COMPRESSED
,
94
95
ORDER_NUM_ORDERS,
96
};
97
119
enum
Bitdepth
120
{
121
BD_COMPRESSED
,
122
123
BD_PER_COMP_8
,
124
BD_PER_COMP_16
,
125
BD_PER_COMP_32
,
126
BD_NUM_PER_COMPONENT,
127
128
BD_PACKED_16_BIT_565
= BD_NUM_PER_COMPONENT,
129
BD_PACKED_16_BIT_5551
,
130
BD_PACKED_16_BIT_4444
,
131
132
BD_PACKED_32_BIT_8888
,
133
BD_PACKED_32_BIT_1010102
,
134
BD_PACKED_32_BIT_248
,
135
136
BD_PACKED_16_BIT_565_REV
,
137
BD_PACKED_16_BIT_1555_REV
,
138
BD_PACKED_16_BIT_4444_REV
,
139
140
BD_PACKED_32_BIT_8888_REV
,
141
BD_PACKED_32_BIT_2101010_REV
,
142
BD_PACKED_32_BIT_101111_REV
,
143
BD_PACKED_32_BIT_5999_REV
,
144
145
BD_NUM_BITDEPTH,
146
};
147
157
struct
UncheckedImageFormat
158
{
159
PixelDataType
eType
;
160
PixelComponents
eFormat
;
161
ComponentOrder
eOrder
;
162
Bitdepth
eBitdepth
;
163
164
int
lineAlignment
;
165
178
std::string
ValidateFormatText
()
const
;
179
181
bool
ValidateFormat
()
const
;
182
};
183
185
class
InvalidFormatException
:
public
std::exception
186
{
187
public
:
188
InvalidFormatException
()
189
: message(
"Invalid Image Format"
)
190
{}
191
192
InvalidFormatException
(
const
std::string &msg)
193
: message(
"Invalid Image Format:\n"
)
194
{
195
message += msg;
196
}
197
198
virtual
~
InvalidFormatException
()
throw
() {}
199
200
virtual
const
char
*what()
const
throw
() {
return
message.c_str();}
201
202
protected
:
203
std::string message;
204
};
205
214
class
ImageFormat
215
{
216
public
:
224
ImageFormat
(
PixelDataType
_eType,
225
PixelComponents
_eFormat,
226
ComponentOrder
_eOrder,
227
Bitdepth
_eBitdepth,
228
int
_lineAlignment);
229
237
ImageFormat
(
UncheckedImageFormat
_fmt);
238
240
UncheckedImageFormat
GetUncheckedFormat
()
const
{
return
fmt;}
241
246
PixelDataType
Type()
const
{
return
fmt.
eType
;}
247
PixelComponents
Components()
const
{
return
fmt.
eFormat
;}
248
ComponentOrder
Order()
const
{
return
fmt.
eOrder
;}
249
Bitdepth
Depth()
const
{
return
fmt.
eBitdepth
;}
250
int
LineAlign()
const
{
return
fmt.
lineAlignment
;}
253
254
size_t
AlignByteCount
(
size_t
byteCount)
const
;
255
256
private
:
257
UncheckedImageFormat fmt;
258
};
259
260
261
263
}
264
265
266
#endif //GLIMG_IMAGE_FORMAT_H
Generated on Mon Jul 29 2013 05:34:59 for Unofficial OpenGL Software Development Kit by
1.8.3.1