TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
G3D::ImageFormat Class Reference

#include <ImageFormat.h>

Classes

class  BayerAlgorithm
 

Public Types

enum  Code {
  CODE_AUTO = -2, CODE_NONE = -1, CODE_L8, CODE_L16,
  CODE_L16F, CODE_L32F, CODE_A8, CODE_A16,
  CODE_A16F, CODE_A32F, CODE_LA4, CODE_LA8,
  CODE_LA16, CODE_LA16F, CODE_LA32F, CODE_RGB5,
  CODE_RGB5A1, CODE_RGB8, CODE_RGB10, CODE_RGB10A2,
  CODE_RGB16, CODE_RGB16F, CODE_RGB32F, CODE_R11G11B10F,
  CODE_RGB9E5F, CODE_RGB8I, CODE_RGB8UI, CODE_RGBA8I,
  CODE_RGBA8UI, CODE_RGB8_SNORM, CODE_RGBA8_SNORM, CODE_RGB16_SNORM,
  CODE_RGBA16_SNORM, CODE_ARGB8, CODE_BGR8, CODE_BGRA8,
  CODE_R8, CODE_R8I, CODE_R8UI, CODE_R16,
  CODE_R16I, CODE_R16UI, CODE_R32I, CODE_R32UI,
  CODE_RG8, CODE_RG8I, CODE_RG8UI, CODE_RG16,
  CODE_RG16I, CODE_RG16UI, CODE_R16F, CODE_RG16F,
  CODE_RG32I, CODE_RG32UI, CODE_R32F, CODE_RG32F,
  CODE_RGBA8, CODE_RGBA16, CODE_RGBA16F, CODE_RGBA32F,
  CODE_RGBA16I, CODE_RGBA16UI, CODE_RGB32I, CODE_RGB32UI,
  CODE_RGBA32I, CODE_RGBA32UI, CODE_BAYER_RGGB8, CODE_BAYER_GRBG8,
  CODE_BAYER_GBRG8, CODE_BAYER_BGGR8, CODE_BAYER_RGGB32F, CODE_BAYER_GRBG32F,
  CODE_BAYER_GBRG32F, CODE_BAYER_BGGR32F, CODE_HSV8, CODE_HSV32F,
  CODE_YUV420_PLANAR, CODE_YUV422, CODE_YUV444, CODE_RGB_DXT1,
  CODE_RGBA_DXT1, CODE_RGBA_DXT3, CODE_RGBA_DXT5, CODE_SRGB8,
  CODE_SRGBA8, CODE_SL8, CODE_SLA8, CODE_SRGB_DXT1,
  CODE_SRGBA_DXT1, CODE_SRGBA_DXT3, CODE_SRGBA_DXT5, CODE_DEPTH16,
  CODE_DEPTH24, CODE_DEPTH32, CODE_DEPTH32F, CODE_STENCIL1,
  CODE_STENCIL4, CODE_STENCIL8, CODE_STENCIL16, CODE_DEPTH24_STENCIL8,
  CODE_NUM
}
 
enum  ColorSpace {
  COLOR_SPACE_NONE, COLOR_SPACE_RGB, COLOR_SPACE_HSV, COLOR_SPACE_YUV,
  COLOR_SPACE_SRGB
}
 
enum  BayerPattern {
  BAYER_PATTERN_NONE, BAYER_PATTERN_RGGB, BAYER_PATTERN_GRBG, BAYER_PATTERN_GBRG,
  BAYER_PATTERN_BGGR
}
 
enum  NumberFormat { FLOATING_POINT_FORMAT, INTEGER_FORMAT, NORMALIZED_FIXED_POINT_FORMAT, OTHER }
 

Public Member Functions

const std::string & name () const
 
bool canInterpretAs (const ImageFormat *otherFormat) const
 
bool representableAsColor1unorm8 () const
 
bool representableAsColor2unorm8 () const
 
bool representableAsColor3unorm8 () const
 
bool representableAsColor4unorm8 () const
 
Color4 channelMask () const
 
bool isIntegerFormat () const
 
bool sameComponents (const ImageFormat *other) const
 

Static Public Member Functions

static const ImageFormatgetFormatWithAlpha (const ImageFormat *otherFormat)
 
static const ImageFormatgetSRGBFormat (const ImageFormat *otherFormat)
 
static const ImageFormatfromString (const std::string &s)
 
static const ImageFormatL8 ()
 
static const ImageFormatL16 ()
 
static const ImageFormatL16F ()
 
static const ImageFormatL32F ()
 
static const ImageFormatA8 ()
 
static const ImageFormatA16 ()
 
static const ImageFormatA16F ()
 
static const ImageFormatA32F ()
 
static const ImageFormatLA4 ()
 
static const ImageFormatLA8 ()
 
static const ImageFormatLA16 ()
 
static const ImageFormatLA16F ()
 
static const ImageFormatLA32F ()
 
static const ImageFormatBGR8 ()
 
static const ImageFormatBGRA8 ()
 
static const ImageFormatR8 ()
 
static const ImageFormatR8I ()
 
static const ImageFormatR8UI ()
 
static const ImageFormatR16 ()
 
static const ImageFormatR16I ()
 
static const ImageFormatR16UI ()
 
static const ImageFormatR32I ()
 
static const ImageFormatR32UI ()
 
static const ImageFormatRG8 ()
 
static const ImageFormatRG8I ()
 
static const ImageFormatRG8UI ()
 
static const ImageFormatRG16 ()
 
static const ImageFormatRG16I ()
 
static const ImageFormatRG16UI ()
 
static const ImageFormatR16F ()
 
static const ImageFormatRG16F ()
 
static const ImageFormatRG32I ()
 
static const ImageFormatRG32UI ()
 
static const ImageFormatR32F ()
 
static const ImageFormatRG32F ()
 
static const ImageFormatRGB5 ()
 
static const ImageFormatRGB5A1 ()
 
static const ImageFormatRGB8 ()
 
static const ImageFormatRGB10 ()
 
static const ImageFormatRGB10A2 ()
 
static const ImageFormatRGB16 ()
 
static const ImageFormatRGB16F ()
 
static const ImageFormatRGB32F ()
 
static const ImageFormatRGBA8 ()
 
static const ImageFormatRGBA16 ()
 
static const ImageFormatRGBA16F ()
 
static const ImageFormatRGBA32F ()
 
static const ImageFormatRGBA16I ()
 
static const ImageFormatRGBA16UI ()
 
static const ImageFormatRGB32UI ()
 
static const ImageFormatRGB32I ()
 
static const ImageFormatRGBA32I ()
 
static const ImageFormatRGBA32UI ()
 
static const ImageFormatR11G11B10F ()
 
static const ImageFormatRGB9E5F ()
 
static const ImageFormatRGB8I ()
 
static const ImageFormatRGB8UI ()
 
static const ImageFormatRGBA8I ()
 
static const ImageFormatRGBA8UI ()
 
static const ImageFormatRGB8_SNORM ()
 
static const ImageFormatRGBA8_SNORM ()
 
static const ImageFormatRGB16_SNORM ()
 
static const ImageFormatRGBA16_SNORM ()
 
static const ImageFormatRGB_DXT1 ()
 
static const ImageFormatRGBA_DXT1 ()
 
static const ImageFormatRGBA_DXT3 ()
 
static const ImageFormatRGBA_DXT5 ()
 
static const ImageFormatSRGB8 ()
 
static const ImageFormatSRGBA8 ()
 
static const ImageFormatSL8 ()
 
static const ImageFormatSLA8 ()
 
static const ImageFormatSRGB_DXT1 ()
 
static const ImageFormatSRGBA_DXT1 ()
 
static const ImageFormatSRGBA_DXT3 ()
 
static const ImageFormatSRGBA_DXT5 ()
 
static const ImageFormatDEPTH16 ()
 
static const ImageFormatDEPTH24 ()
 
static const ImageFormatDEPTH32 ()
 
static const ImageFormatDEPTH32F ()
 
static const ImageFormatSTENCIL1 ()
 
static const ImageFormatSTENCIL4 ()
 
static const ImageFormatSTENCIL8 ()
 
static const ImageFormatSTENCIL16 ()
 
static const ImageFormatDEPTH24_STENCIL8 ()
 
static const ImageFormatYUV420_PLANAR ()
 
static const ImageFormatYUV422 ()
 
static const ImageFormatYUV444 ()
 
static const ImageFormatAUTO ()
 
static const ImageFormatdepth (int depthBits=24)
 
static const ImageFormatstencil (int bits=8)
 
static const ImageFormatfromCode (ImageFormat::Code code)
 
static bool convert (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY=false, BayerAlgorithm bayerAlg=BayerAlgorithm::MHC)
 
static bool conversionAvailable (const ImageFormat *srcFormat, int srcRowPadBits, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY=false)
 

Public Attributes

int numComponents
 
bool compressed
 
Code code
 
ColorSpace colorSpace
 
BayerPattern bayerPattern
 
int openGLFormat
 
int openGLBaseFormat
 
int luminanceBits
 
int alphaBits
 
int redBits
 
int greenBits
 
int blueBits
 
int stencilBits
 
int depthBits
 
int cpuBitsPerPixel
 
int openGLBitsPerPixel
 
int openGLDataFormat
 
bool opaque
 
bool floatingPoint
 
NumberFormat numberFormat
 

Private Member Functions

 ImageFormat (int numComponents, bool compressed, int glFormat, int glBaseFormat, int luminanceBits, int alphaBits, int redBits, int greenBits, int blueBits, int depthBits, int stencilBits, int openGLBitsPerPixel, int cpuBitsPerPixel, int glDataFormat, bool opaque, NumberFormat numberFormat, Code code, ColorSpace colorSpace, BayerPattern bayerPattern=BAYER_PATTERN_NONE)
 

Detailed Description

Information about common image formats. Don't construct these; use the methods provided to access the const instances.

For most formats, the number indicates the number of bits per channel and a suffix of "F" indicates floating point (following OpenGL conventions). This does not hold for the YUV and DXT formats.

See also
G3D::Image, G3D::Texture, G3D::ImageConvert

Member Enumeration Documentation

Enumerator
BAYER_PATTERN_NONE 
BAYER_PATTERN_RGGB 
BAYER_PATTERN_GRBG 
BAYER_PATTERN_GBRG 
BAYER_PATTERN_BGGR 
175  {
181  };
Definition: ImageFormat.h:180
Definition: ImageFormat.h:176
Definition: ImageFormat.h:179
Definition: ImageFormat.h:178
Definition: ImageFormat.h:177
Enumerator
CODE_AUTO 
CODE_NONE 
CODE_L8 
CODE_L16 
CODE_L16F 
CODE_L32F 
CODE_A8 
CODE_A16 
CODE_A16F 
CODE_A32F 
CODE_LA4 
CODE_LA8 
CODE_LA16 
CODE_LA16F 
CODE_LA32F 
CODE_RGB5 
CODE_RGB5A1 
CODE_RGB8 
CODE_RGB10 
CODE_RGB10A2 
CODE_RGB16 
CODE_RGB16F 
CODE_RGB32F 
CODE_R11G11B10F 
CODE_RGB9E5F 
CODE_RGB8I 
CODE_RGB8UI 
CODE_RGBA8I 
CODE_RGBA8UI 
CODE_RGB8_SNORM 
CODE_RGBA8_SNORM 
CODE_RGB16_SNORM 
CODE_RGBA16_SNORM 
CODE_ARGB8 
CODE_BGR8 
CODE_BGRA8 
CODE_R8 
CODE_R8I 
CODE_R8UI 
CODE_R16 
CODE_R16I 
CODE_R16UI 
CODE_R32I 
CODE_R32UI 
CODE_RG8 
CODE_RG8I 
CODE_RG8UI 
CODE_RG16 
CODE_RG16I 
CODE_RG16UI 
CODE_R16F 
CODE_RG16F 
CODE_RG32I 
CODE_RG32UI 
CODE_R32F 
CODE_RG32F 
CODE_RGBA8 
CODE_RGBA16 
CODE_RGBA16F 
CODE_RGBA32F 
CODE_RGBA16I 
CODE_RGBA16UI 
CODE_RGB32I 
CODE_RGB32UI 
CODE_RGBA32I 
CODE_RGBA32UI 
CODE_BAYER_RGGB8 
CODE_BAYER_GRBG8 
CODE_BAYER_GBRG8 
CODE_BAYER_BGGR8 
CODE_BAYER_RGGB32F 
CODE_BAYER_GRBG32F 
CODE_BAYER_GBRG32F 
CODE_BAYER_BGGR32F 
CODE_HSV8 
CODE_HSV32F 
CODE_YUV420_PLANAR 
CODE_YUV422 
CODE_YUV444 
CODE_RGB_DXT1 
CODE_RGBA_DXT1 
CODE_RGBA_DXT3 
CODE_RGBA_DXT5 
CODE_SRGB8 
CODE_SRGBA8 
CODE_SL8 
CODE_SLA8 
CODE_SRGB_DXT1 
CODE_SRGBA_DXT1 
CODE_SRGBA_DXT3 
CODE_SRGBA_DXT5 
CODE_DEPTH16 
CODE_DEPTH24 
CODE_DEPTH32 
CODE_DEPTH32F 
CODE_STENCIL1 
CODE_STENCIL4 
CODE_STENCIL8 
CODE_STENCIL16 
CODE_DEPTH24_STENCIL8 
CODE_NUM 
34  {
35  CODE_AUTO = -2,
36  CODE_NONE = -1,
37  CODE_L8,
38  CODE_L16,
39  CODE_L16F,
40  CODE_L32F,
41 
42  CODE_A8,
43  CODE_A16,
44  CODE_A16F,
45  CODE_A32F,
46 
47  CODE_LA4,
48  CODE_LA8,
49  CODE_LA16,
50  CODE_LA16F,
51  CODE_LA32F,
52 
53  CODE_RGB5,
55  CODE_RGB8,
56  CODE_RGB10,
58  CODE_RGB16,
63 
64  CODE_RGB8I,
66 
69 
74 
75  CODE_ARGB8,
76  CODE_BGR8,
77  CODE_BGRA8,
78 
79  CODE_R8,
80  CODE_R8I,
81  CODE_R8UI,
82 
83  CODE_R16,
84  CODE_R16I,
85  CODE_R16UI,
86 
87  CODE_R32I,
88  CODE_R32UI,
89 
90  CODE_RG8,
91  CODE_RG8I,
92  CODE_RG8UI,
93 
94  CODE_RG16,
95  CODE_RG16I,
97 
98  CODE_R16F,
99  CODE_RG16F,
100 
101  CODE_RG32I,
102  CODE_RG32UI,
103 
104  CODE_R32F,
105  CODE_RG32F,
106 
107  CODE_RGBA8,
108  CODE_RGBA16,
109  CODE_RGBA16F,
110  CODE_RGBA32F,
111 
112  CODE_RGBA16I,
114 
115  CODE_RGB32I,
116  CODE_RGB32UI,
117  CODE_RGBA32I,
119 
128 
129  CODE_HSV8,
130  CODE_HSV32F,
131 
133  CODE_YUV422,
134  CODE_YUV444,
135 
140 
141  CODE_SRGB8,
142  CODE_SRGBA8,
143 
144  CODE_SL8,
145  CODE_SLA8,
146 
151 
152  CODE_DEPTH16,
153  CODE_DEPTH24,
154  CODE_DEPTH32,
156 
161 
163 
164  CODE_NUM
165  };
Definition: ImageFormat.h:147
Definition: ImageFormat.h:139
Definition: ImageFormat.h:80
Definition: ImageFormat.h:159
Definition: ImageFormat.h:90
Definition: ImageFormat.h:98
Definition: ImageFormat.h:105
Definition: ImageFormat.h:138
Definition: ImageFormat.h:95
Definition: ImageFormat.h:94
Definition: ImageFormat.h:137
Definition: ImageFormat.h:72
Definition: ImageFormat.h:48
Definition: ImageFormat.h:62
Definition: ImageFormat.h:88
Definition: ImageFormat.h:117
Definition: ImageFormat.h:92
Definition: ImageFormat.h:125
Definition: ImageFormat.h:54
Definition: ImageFormat.h:87
Definition: ImageFormat.h:58
Definition: ImageFormat.h:142
Definition: ImageFormat.h:53
Definition: ImageFormat.h:99
Definition: ImageFormat.h:75
Definition: ImageFormat.h:79
Definition: ImageFormat.h:149
Definition: ImageFormat.h:109
Definition: ImageFormat.h:157
Definition: ImageFormat.h:122
Definition: ImageFormat.h:127
Definition: ImageFormat.h:85
Definition: ImageFormat.h:91
Definition: ImageFormat.h:164
Definition: ImageFormat.h:121
Definition: ImageFormat.h:130
Definition: ImageFormat.h:56
Definition: ImageFormat.h:35
Definition: ImageFormat.h:68
Definition: ImageFormat.h:39
Definition: ImageFormat.h:102
Definition: ImageFormat.h:60
Definition: ImageFormat.h:49
Definition: ImageFormat.h:81
Definition: ImageFormat.h:158
Definition: ImageFormat.h:55
Definition: ImageFormat.h:118
Definition: ImageFormat.h:132
Definition: ImageFormat.h:126
Definition: ImageFormat.h:70
Definition: ImageFormat.h:148
Definition: ImageFormat.h:141
Definition: ImageFormat.h:65
Definition: ImageFormat.h:61
Definition: ImageFormat.h:83
Definition: ImageFormat.h:134
Definition: ImageFormat.h:101
Definition: ImageFormat.h:37
Definition: ImageFormat.h:42
Definition: ImageFormat.h:116
Definition: ImageFormat.h:64
Definition: ImageFormat.h:162
Definition: ImageFormat.h:112
Definition: ImageFormat.h:104
Definition: ImageFormat.h:115
Definition: ImageFormat.h:71
Definition: ImageFormat.h:120
Definition: ImageFormat.h:144
Definition: ImageFormat.h:154
Definition: ImageFormat.h:96
Definition: ImageFormat.h:150
Definition: ImageFormat.h:38
Definition: ImageFormat.h:36
Definition: ImageFormat.h:110
Definition: ImageFormat.h:51
Definition: ImageFormat.h:136
Definition: ImageFormat.h:108
Definition: ImageFormat.h:67
Definition: ImageFormat.h:129
Definition: ImageFormat.h:44
Definition: ImageFormat.h:43
Definition: ImageFormat.h:155
Definition: ImageFormat.h:50
Definition: ImageFormat.h:133
Definition: ImageFormat.h:145
Definition: ImageFormat.h:107
Definition: ImageFormat.h:77
Definition: ImageFormat.h:47
Definition: ImageFormat.h:152
Definition: ImageFormat.h:153
Definition: ImageFormat.h:40
Definition: ImageFormat.h:123
Definition: ImageFormat.h:73
Definition: ImageFormat.h:124
Definition: ImageFormat.h:59
Definition: ImageFormat.h:76
Definition: ImageFormat.h:113
Definition: ImageFormat.h:45
Definition: ImageFormat.h:160
Definition: ImageFormat.h:84
Definition: ImageFormat.h:57
Enumerator
COLOR_SPACE_NONE 
COLOR_SPACE_RGB 
COLOR_SPACE_HSV 
COLOR_SPACE_YUV 
COLOR_SPACE_SRGB 
167  {
173  };
Definition: ImageFormat.h:171
Definition: ImageFormat.h:168
Definition: ImageFormat.h:169
Definition: ImageFormat.h:170
Definition: ImageFormat.h:172
Enumerator
FLOATING_POINT_FORMAT 
INTEGER_FORMAT 
NORMALIZED_FIXED_POINT_FORMAT 
OTHER 
184  {
188  OTHER // e.g. DXT
189  };
Definition: ImageFormat.h:186
Definition: ImageFormat.h:188
Definition: ImageFormat.h:185

Constructor & Destructor Documentation

G3D::ImageFormat::ImageFormat ( int  numComponents,
bool  compressed,
int  glFormat,
int  glBaseFormat,
int  luminanceBits,
int  alphaBits,
int  redBits,
int  greenBits,
int  blueBits,
int  depthBits,
int  stencilBits,
int  openGLBitsPerPixel,
int  cpuBitsPerPixel,
int  glDataFormat,
bool  opaque,
NumberFormat  numberFormat,
Code  code,
ColorSpace  colorSpace,
BayerPattern  bayerPattern = BAYER_PATTERN_NONE 
)
private
35  :
36 
37  numComponents(_numComponents),
38  compressed(_compressed),
39  code(_code),
40  colorSpace(_colorSpace),
41  bayerPattern(_bayerPattern),
42  openGLFormat(_glFormat),
43  openGLBaseFormat(_glBaseFormat),
44  luminanceBits(_luminanceBits),
45  alphaBits(_alphaBits),
46  redBits(_redBits),
47  greenBits(_greenBits),
48  blueBits(_blueBits),
49  stencilBits(_stencilBits),
50  depthBits(_depthBits),
51  cpuBitsPerPixel(_cpuBitsPerPixel),
52  openGLBitsPerPixel(_openGLBitsPerPixel),
53  openGLDataFormat(glDataFormat),
54  opaque(_opaque),
55  numberFormat(_numberFormat){
56 
59 }
int stencilBits
Definition: ImageFormat.h:224
int openGLFormat
Definition: ImageFormat.h:204
int redBits
Definition: ImageFormat.h:215
bool opaque
Definition: ImageFormat.h:246
int openGLDataFormat
Definition: ImageFormat.h:243
int depthBits
Definition: ImageFormat.h:227
ColorSpace colorSpace
Definition: ImageFormat.h:198
int blueBits
Definition: ImageFormat.h:221
int greenBits
Definition: ImageFormat.h:218
NumberFormat numberFormat
Definition: ImageFormat.h:253
int alphaBits
Definition: ImageFormat.h:212
BayerPattern bayerPattern
Definition: ImageFormat.h:201
#define debugAssert(exp)
Definition: debugAssert.h:160
int cpuBitsPerPixel
Definition: ImageFormat.h:230
Code code
Definition: ImageFormat.h:196
int luminanceBits
Definition: ImageFormat.h:209
Definition: ImageFormat.h:185
int openGLBitsPerPixel
Definition: ImageFormat.h:240
bool compressed
Definition: ImageFormat.h:193
int numComponents
Definition: ImageFormat.h:192
bool floatingPoint
Definition: ImageFormat.h:250
int openGLBaseFormat
Definition: ImageFormat.h:207

Member Function Documentation

static const ImageFormat* G3D::ImageFormat::A16 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::A16F ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::A32F ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::A8 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::AUTO ( )
inlinestatic

NULL pointer; indicates that the G3D::Texture class should choose either RGBA8 or RGB8 depending on the presence of an alpha channel in the input.

459 { return NULL; }
arena_t NULL
Definition: jemalloc_internal.h:624
static const ImageFormat* G3D::ImageFormat::BGR8 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::BGRA8 ( )
static

+ Here is the caller graph for this function:

bool G3D::ImageFormat::canInterpretAs ( const ImageFormat otherFormat) const

True if data in otherFormat is binary compatible

250  {
251  if (this == otherFormat) {
252  return true;
253  }
254 
255  if (compressed || otherFormat->compressed) {
256  return false;
257  }
258 
259  if (colorSpace != otherFormat->colorSpace) {
260  return false;
261  }
262 
263  if (floatingPoint != otherFormat->floatingPoint) {
264  return false;
265  }
266 
267  if (numComponents != otherFormat->numComponents) {
268  return false;
269  }
270 
271  if (cpuBitsPerPixel != otherFormat->cpuBitsPerPixel) {
272  return false;
273  }
274 
275  if (openGLDataFormat != otherFormat->openGLDataFormat) {
276  return false;
277  }
278 
279  return true;
280 }
int openGLDataFormat
Definition: ImageFormat.h:243
ColorSpace colorSpace
Definition: ImageFormat.h:198
int cpuBitsPerPixel
Definition: ImageFormat.h:230
bool compressed
Definition: ImageFormat.h:193
int numComponents
Definition: ImageFormat.h:192
bool floatingPoint
Definition: ImageFormat.h:250
Color4 G3D::ImageFormat::channelMask ( ) const

Returns a Color4 that masks off unused components in the format, given in RGBA For example, the mask for R32F is (1,0,0,0), for A32F is (0,0,0,1), for RGB32F is (1,1,1,0). (Note that luminance is interpreted as using only the R channel, even though RGB would make more sense to me...)

714  {
715  Color4 mask;
716  mask.r = (redBits > 0 || luminanceBits > 0) ? 1.0f : 0.0f;
717  mask.b = (blueBits > 0) ? 1.0f : 0.0f;
718  mask.g = (greenBits > 0) ? 1.0f : 0.0f;
719  mask.a = (alphaBits > 0) ? 1.0f : 0.0f;
720  return mask;
721 
722 }
int redBits
Definition: ImageFormat.h:215
int blueBits
Definition: ImageFormat.h:221
int greenBits
Definition: ImageFormat.h:218
int alphaBits
Definition: ImageFormat.h:212
int luminanceBits
Definition: ImageFormat.h:209
static bool G3D::ImageFormat::conversionAvailable ( const ImageFormat srcFormat,
int  srcRowPadBits,
const ImageFormat dstFormat,
int  dstRowPadBits,
bool  invertY = false 
)
static

Checks if a conversion between two formats is available.

Deprecated:
See also
G3D::ImageConvert

+ Here is the caller graph for this function:

bool G3D::ImageFormat::convert ( const Array< const void * > &  srcBytes,
int  srcWidth,
int  srcHeight,
const ImageFormat srcFormat,
int  srcRowPadBits,
const Array< void * > &  dstBytes,
const ImageFormat dstFormat,
int  dstRowPadBits,
bool  invertY = false,
BayerAlgorithm  bayerAlg = BayerAlgorithm::MHC 
)
static

Converts between arbitrary formats on the CPU. Not all format conversions are supported or directly supported. Formats without direct conversions will attempt to convert through RGBA first.

A conversion routine might only support source or destination padding or y inversion or none. If support is needed and not available in any of the direct conversion routines, then no conversion is done.

YUV422 expects data in YUY2 format (Y, U, Y2, v). Most YUV formats require width and heights that are multiples of 2.

Returns true if a conversion was available, false if none occurred.

Deprecated:
See also
G3D::ImageConvert
165  {
166 
167  bool conversionAvailable = false;
168 
169  // Handle direct copy of image to same format
170  if ( (srcFormat->code == dstFormat->code) && (srcRowPadBits == dstRowPadBits) && !invertY) {
171 
172  System::memcpy(dstBytes[0], srcBytes[0], iCeil(((srcWidth * srcFormat->cpuBitsPerPixel + srcRowPadBits) * srcHeight) / 8.0f));
173  conversionAvailable = true;
174  } else {
175  // if no direct conversion routine exists,
176  // then look for conversion to intermediate
177  // and then from intermediate to dest.
178  // intermediate format is RGBA32F
179  ConvertFunc directConverter = findConverter(srcFormat->code, dstFormat->code, srcRowPadBits > 0, dstRowPadBits > 0, invertY);
180 
181  // if we have a direct converter, use it, otherwise find intermdiate path
182  if (directConverter) {
183  directConverter(srcBytes, srcWidth, srcHeight, srcFormat, srcRowPadBits, dstBytes, dstFormat, dstRowPadBits, invertY, bayerAlg);
184  conversionAvailable = true;
185  } else {
186  ConvertFunc toInterConverter = findConverter(srcFormat->code, ImageFormat::CODE_RGBA32F, srcRowPadBits > 0, false, false);;
187  ConvertFunc fromInterConverter = findConverter(ImageFormat::CODE_RGBA32F, dstFormat->code, false, dstRowPadBits > 0, invertY);;
188 
189  if (toInterConverter && fromInterConverter) {
190  Array<void*> tmp;
191  tmp.append(System::malloc(srcWidth * srcHeight * ImageFormat::RGBA32F()->cpuBitsPerPixel * 8));
192 
193  toInterConverter(srcBytes, srcWidth, srcHeight, srcFormat, srcRowPadBits, tmp, ImageFormat::RGBA32F(), 0, false, bayerAlg);
194  fromInterConverter(reinterpret_cast<Array<const void*>&>(tmp), srcWidth, srcHeight, ImageFormat::RGBA32F(), 0, dstBytes, dstFormat, dstRowPadBits, invertY, bayerAlg);
195 
196  System::free(tmp[0]);
197 
198  conversionAvailable = true;
199  }
200  }
201  }
202 
203  return conversionAvailable;
204 }
static void memcpy(void *dst, const void *src, size_t numBytes)
Definition: System.cpp:643
void(* ConvertFunc)(const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
Definition: ImageFormat_convert.cpp:13
static const ImageFormat * RGBA32F()
static void * malloc(size_t bytes)
Definition: System.cpp:1441
int cpuBitsPerPixel
Definition: ImageFormat.h:230
Definition: ImageFormat.h:110
static void free(void *p)
Definition: System.cpp:1473
static bool conversionAvailable(const ImageFormat *srcFormat, int srcRowPadBits, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY=false)
static ConvertFunc findConverter(TextureFormat::Code sourceCode, TextureFormat::Code destCode, bool needsSourcePadding, bool needsDestPadding, bool needsInvertY)
Definition: ImageFormat_convert.cpp:115
int iCeil(double fValue)
Definition: g3dmath.h:539

+ Here is the call graph for this function:

const ImageFormat * G3D::ImageFormat::depth ( int  depthBits = 24)
static

Returns DEPTH16, DEPTH24, or DEPTH32 according to the bits specified. You can use "glGetInteger(GL_DEPTH_BITS)" to match the screen's format.

75  {
76 
77  switch (depthBits) {
78  case 16:
79  return DEPTH16();
80 
81  case 24:
82  return DEPTH24();
83 
84  case 32:
85  return DEPTH32();
86 
87  default:
88  debugAssertM(false, "Depth must be 16, 24, or 32.");
89  return DEPTH32();
90  }
91 }
int depthBits
Definition: ImageFormat.h:227
#define debugAssertM(exp, message)
Definition: debugAssert.h:161
static const ImageFormat * DEPTH24()
static const ImageFormat * DEPTH16()
static const ImageFormat * DEPTH32()

+ Here is the call graph for this function:

static const ImageFormat* G3D::ImageFormat::DEPTH16 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::DEPTH24 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::DEPTH24_STENCIL8 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::DEPTH32 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::DEPTH32F ( )
static

+ Here is the caller graph for this function:

const ImageFormat * G3D::ImageFormat::fromCode ( ImageFormat::Code  code)
static

Returns the matching ImageFormat* identified by the Code. May return NULL if this format's code is reserved but not yet implemented by G3D.

399  {
400  switch (code) {
402  return ImageFormat::L8();
403 
405  return ImageFormat::L16();
406 
408  return ImageFormat::L16F();
409 
411  return ImageFormat::L32F();
412 
414  return ImageFormat::A8();
415 
417  return ImageFormat::A16();
418 
420  return ImageFormat::A16F();
421 
423  return ImageFormat::A32F();
424 
426  return ImageFormat::LA4();
427 
429  return ImageFormat::LA8();
430 
432  return ImageFormat::LA16();
433 
435  return ImageFormat::LA16F();
436 
438  return ImageFormat::LA32F();
439 
441  return ImageFormat::RGB5();
442 
444  return ImageFormat::RGB5A1();
445 
447  return ImageFormat::RGB8();
448 
450  return ImageFormat::RGB10();
451 
453  return ImageFormat::RGB10A2();
454 
456  return ImageFormat::RGB16();
457 
459  return ImageFormat::RGB32F();
460 
462  return ImageFormat::R11G11B10F();
463 
465  return ImageFormat::RGB9E5F();
466 
468  return ImageFormat::RGB8I();
469 
471  return ImageFormat::RGB8UI();
472 
474  return ImageFormat::RGBA8I();
475 
477  return ImageFormat::RGBA8UI();
478 
480  return ImageFormat::RGB8_SNORM();
482  return ImageFormat::RGBA8_SNORM();
484  return ImageFormat::RGB16_SNORM();
486  return ImageFormat::RGBA16_SNORM();
487 
489  return NULL;
490 
492  return ImageFormat::BGR8();
493 
495  return ImageFormat::BGRA8();
496 
498  return ImageFormat::R8();
499 
501  return ImageFormat::R8I();
502 
504  return ImageFormat::R8UI();
505 
507  return ImageFormat::R16();
508 
510  return ImageFormat::R16I();
511 
513  return ImageFormat::R16UI();
514 
516  return ImageFormat::R32I();
517 
519  return ImageFormat::R32UI();
520 
522  return ImageFormat::RG8();
523 
525  return ImageFormat::RG8I();
526 
528  return ImageFormat::RG8UI();
529 
531  return ImageFormat::R16F();
532 
534  return ImageFormat::RG16F();
535 
537  return ImageFormat::R32F();
538 
540  return ImageFormat::RG32F();
541 
543  return ImageFormat::RGBA8();
544 
546  return ImageFormat::RGBA16();
547 
549  return ImageFormat::RGBA16F();
550 
552  return ImageFormat::RGBA32F();
553 
555  return ImageFormat::RGB32I();
556 
558  return ImageFormat::RGBA32I();
559 
561  return ImageFormat::RGB32UI();
562 
564  return ImageFormat::RGBA32UI();
565 
567  // TODO
569  // TODO
571  // TODO
573  // TODO
575  // TODO
577  // TODO
579  // TODO
581  // TODO
582 
584  // TODO
586  // TODO
587  return NULL;
588  break;
589 
591  return ImageFormat::RGB_DXT1();
592  break;
594  return ImageFormat::RGBA_DXT1();
595  break;
597  return ImageFormat::RGBA_DXT3();
598  break;
600  return ImageFormat::RGBA_DXT5();
601  break;
602 
604  return ImageFormat::SRGB8();
605  break;
606 
608  return ImageFormat::SRGBA8();
609  break;
610 
612  return ImageFormat::SL8();
613  break;
614 
616  return ImageFormat::SLA8();
617  break;
618 
620  return ImageFormat::SRGB_DXT1();
621  break;
622 
624  return ImageFormat::SRGBA_DXT1();
625  break;
626 
628  return ImageFormat::SRGBA_DXT3();
629  break;
630 
632  return ImageFormat::SRGBA_DXT5();
633  break;
634 
636  return ImageFormat::DEPTH16();
637  break;
639  return ImageFormat::DEPTH24();
640  break;
642  return ImageFormat::DEPTH32();
643  break;
645  return ImageFormat::DEPTH32F();
646  break;
647 
649  return ImageFormat::STENCIL1();
650  break;
652  return ImageFormat::STENCIL4();
653  break;
655  return ImageFormat::STENCIL8();
656  break;
658  return ImageFormat::STENCIL16();
659  break;
660 
663  break;
664 
667  break;
668 
670  return ImageFormat::YUV422();
671  break;
672 
674  return ImageFormat::YUV444();
675  break;
676 
677  default:
678  return NULL;
679  }
680 }
Definition: ImageFormat.h:147
Definition: ImageFormat.h:139
Definition: ImageFormat.h:80
Definition: ImageFormat.h:159
static const ImageFormat * L16()
static const ImageFormat * R16I()
static const ImageFormat * L16F()
Definition: ImageFormat.h:90
static const ImageFormat * YUV444()
Definition: ImageFormat.h:98
static const ImageFormat * SLA8()
Definition: ImageFormat.h:105
Definition: ImageFormat.h:138
static const ImageFormat * LA16()
static const ImageFormat * RGBA8I()
static const ImageFormat * RGBA8_SNORM()
static const ImageFormat * RG8UI()
static const ImageFormat * LA32F()
static const ImageFormat * A32F()
static const ImageFormat * SRGB_DXT1()
static const ImageFormat * RGBA_DXT1()
static const ImageFormat * SRGBA_DXT5()
Definition: ImageFormat.h:137
static const ImageFormat * R16UI()
Definition: ImageFormat.h:72
Definition: ImageFormat.h:48
Definition: ImageFormat.h:62
Definition: ImageFormat.h:88
Definition: ImageFormat.h:117
Definition: ImageFormat.h:92
static const ImageFormat * RGB9E5F()
Definition: ImageFormat.h:125
Definition: ImageFormat.h:54
Definition: ImageFormat.h:87
Definition: ImageFormat.h:58
Definition: ImageFormat.h:142
Definition: ImageFormat.h:53
static const ImageFormat * DEPTH24_STENCIL8()
Definition: ImageFormat.h:99
Definition: ImageFormat.h:75
Definition: ImageFormat.h:79
static const ImageFormat * YUV420_PLANAR()
static const ImageFormat * RG16F()
Definition: ImageFormat.h:149
static const ImageFormat * RGB5()
static const ImageFormat * R8UI()
static const ImageFormat * STENCIL4()
Definition: ImageFormat.h:109
static const ImageFormat * R16F()
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: ImageFormat.h:157
static const ImageFormat * R8I()
Definition: ImageFormat.h:122
static const ImageFormat * RGBA8UI()
Definition: ImageFormat.h:127
static const ImageFormat * RG32F()
static const ImageFormat * RGB16_SNORM()
Definition: ImageFormat.h:85
static const ImageFormat * RGB32I()
Definition: ImageFormat.h:91
static const ImageFormat * RGBA32UI()
static const ImageFormat * RGB5A1()
Definition: ImageFormat.h:121
static const ImageFormat * RGB10()
static const ImageFormat * RGB8()
static const ImageFormat * RGBA16F()
static const ImageFormat * RGBA32F()
static const ImageFormat * LA4()
Definition: ImageFormat.h:130
static const ImageFormat * RG8()
static const ImageFormat * LA16F()
Definition: ImageFormat.h:56
static const ImageFormat * RGBA32I()
Definition: ImageFormat.h:68
Definition: ImageFormat.h:39
static const ImageFormat * RGB32UI()
static const ImageFormat * RGB8UI()
static const ImageFormat * R16()
Definition: ImageFormat.h:60
Definition: ImageFormat.h:49
Definition: ImageFormat.h:81
Definition: ImageFormat.h:158
Definition: ImageFormat.h:55
Definition: ImageFormat.h:118
Definition: ImageFormat.h:132
Definition: ImageFormat.h:126
Definition: ImageFormat.h:70
Definition: ImageFormat.h:148
static const ImageFormat * DEPTH24()
Definition: ImageFormat.h:141
static const ImageFormat * DEPTH16()
Definition: ImageFormat.h:65
Definition: ImageFormat.h:61
static const ImageFormat * RGB16()
Definition: ImageFormat.h:83
static const ImageFormat * R32UI()
Definition: ImageFormat.h:134
Definition: ImageFormat.h:37
static const ImageFormat * BGR8()
static const ImageFormat * STENCIL8()
static const ImageFormat * RGB10A2()
Definition: ImageFormat.h:42
static const ImageFormat * RGBA8()
Definition: ImageFormat.h:116
Definition: ImageFormat.h:64
Definition: ImageFormat.h:162
static const ImageFormat * SRGBA_DXT3()
Definition: ImageFormat.h:104
Definition: ImageFormat.h:115
static const ImageFormat * A16()
Definition: ImageFormat.h:71
Definition: ImageFormat.h:120
Definition: ImageFormat.h:144
Definition: ImageFormat.h:154
Definition: ImageFormat.h:150
Definition: ImageFormat.h:38
Definition: ImageFormat.h:110
Definition: inftrees.h:24
Definition: ImageFormat.h:51
Definition: ImageFormat.h:136
Definition: ImageFormat.h:108
static const ImageFormat * LA8()
static const ImageFormat * RGB8_SNORM()
Definition: ImageFormat.h:67
static const ImageFormat * RGBA_DXT5()
Definition: ImageFormat.h:129
static const ImageFormat * YUV422()
static const ImageFormat * BGRA8()
Definition: ImageFormat.h:44
Definition: ImageFormat.h:43
Definition: ImageFormat.h:155
static const ImageFormat * RGB32F()
Definition: ImageFormat.h:50
Definition: ImageFormat.h:133
Definition: ImageFormat.h:145
Definition: ImageFormat.h:107
static const ImageFormat * R32I()
Definition: ImageFormat.h:77
static const ImageFormat * RGBA_DXT3()
Definition: ImageFormat.h:47
static const ImageFormat * R32F()
Definition: ImageFormat.h:152
static const ImageFormat * R11G11B10F()
Definition: ImageFormat.h:153
Definition: ImageFormat.h:40
Definition: ImageFormat.h:123
Definition: ImageFormat.h:73
static const ImageFormat * SRGB8()
static const ImageFormat * SRGBA_DXT1()
static const ImageFormat * L8()
static const ImageFormat * RGB8I()
static const ImageFormat * R8()
Definition: ImageFormat.h:124
static const ImageFormat * A16F()
static const ImageFormat * DEPTH32F()
static const ImageFormat * RG8I()
static const ImageFormat * SL8()
static const ImageFormat * RGB_DXT1()
static const ImageFormat * STENCIL1()
static const ImageFormat * RGBA16_SNORM()
static const ImageFormat * L32F()
Definition: ImageFormat.h:76
Definition: ImageFormat.h:45
static const ImageFormat * SRGBA8()
Definition: ImageFormat.h:160
Definition: ImageFormat.h:84
static const ImageFormat * A8()
static const ImageFormat * DEPTH32()
Definition: ImageFormat.h:57
static const ImageFormat * STENCIL16()
static const ImageFormat * RGBA16()

+ Here is the caller graph for this function:

const ImageFormat * G3D::ImageFormat::fromString ( const std::string &  s)
static

Takes the same values that name() returns

386  {
387  if (toLower(s) == "auto") {
388  return NULL;
389  }
390 
391  for (int i = 0; i < CODE_NUM; ++i) {
392  if (s == nameArray[i]) {
393  return fromCode(ImageFormat::Code(i));
394  }
395  }
396  return NULL;
397 }
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: ImageFormat.h:164
static const ImageFormat * fromCode(ImageFormat::Code code)
Definition: ImageFormat.cpp:399
Code
Definition: ImageFormat.h:34
std::string toLower(const std::string &x)
Definition: stringutils.cpp:223
static const std::string nameArray[ImageFormat::CODE_NUM]
Definition: ImageFormat.cpp:115

+ Here is the call graph for this function:

const ImageFormat * G3D::ImageFormat::getFormatWithAlpha ( const ImageFormat otherFormat)
static

Returns ImageFormat representing the same channels as otherFormat plus an alpha channel, all with at least the same precision as otherFormat, or returns NULL if an equivalent format is unavailable. Will return itself if already contains an alpha channel.

309  {
310  if (! otherFormat->opaque) {
311  return otherFormat;
312  }
313 
314  switch (otherFormat->code) {
315  case CODE_L8:
316  return LA8();
317  break;
318 
319  case CODE_L16F:
320  return LA16F();
321  break;
322 
323  case CODE_RGB8:
324  return RGBA8();
325  break;
326 
327  case CODE_RGB8I:
328  return RGBA8I();
329  break;
330 
331  case CODE_RGB32I:
332  return RGBA32I();
333  break;
334 
335  case CODE_RGB32UI:
336  return RGBA32UI();
337  break;
338 
339  case CODE_RGB8UI:
340  return RGBA8UI();
341  break;
342 
343  case CODE_RGB8_SNORM:
344  return RGB8_SNORM();
345  break;
346  case CODE_RGBA8_SNORM:
347  return RGBA8_SNORM();
348  break;
349 
350  case CODE_RGB16_SNORM:
351  return RGB16_SNORM();
352  break;
353 
354  case CODE_RGBA16_SNORM:
355  return RGBA16_SNORM();
356  break;
357 
358  case CODE_BGR8:
359  return BGRA8();
360  break;
361 
362  case CODE_RGB16:
363  return RGBA16();
364  break;
365 
366  case CODE_RGB16F:
367  return RGBA16F();
368  break;
369 
370  case CODE_RGB32F:
371  return RGBA32F();
372  break;
373 
374  case CODE_R11G11B10F:
375  return RGBA16F();
376  break;
377 
378  default:
379  break;
380  }
381 
382  return NULL;
383 }
static const ImageFormat * RGBA8I()
static const ImageFormat * RGBA8_SNORM()
Definition: ImageFormat.h:72
Definition: ImageFormat.h:58
arena_t NULL
Definition: jemalloc_internal.h:624
static const ImageFormat * RGBA8UI()
static const ImageFormat * RGB16_SNORM()
static const ImageFormat * RGBA32UI()
static const ImageFormat * RGBA16F()
static const ImageFormat * RGBA32F()
static const ImageFormat * LA16F()
static const ImageFormat * RGBA32I()
Definition: ImageFormat.h:39
Definition: ImageFormat.h:60
Definition: ImageFormat.h:55
Definition: ImageFormat.h:70
Definition: ImageFormat.h:65
Definition: ImageFormat.h:61
Definition: ImageFormat.h:37
static const ImageFormat * RGBA8()
Definition: ImageFormat.h:116
Definition: ImageFormat.h:64
Definition: ImageFormat.h:115
Definition: ImageFormat.h:71
static const ImageFormat * LA8()
static const ImageFormat * RGB8_SNORM()
static const ImageFormat * BGRA8()
Definition: ImageFormat.h:73
static const ImageFormat * RGBA16_SNORM()
Definition: ImageFormat.h:59
Definition: ImageFormat.h:76
static const ImageFormat * RGBA16()

+ Here is the call graph for this function:

const ImageFormat * G3D::ImageFormat::getSRGBFormat ( const ImageFormat otherFormat)
static
283  {
284  switch (otherFormat->code) {
285  case CODE_RGB8:
286  return SRGB8();
287 
288  case CODE_RGBA8:
289  return SRGBA8();
290 
291  case CODE_RGB_DXT1:
292  return SRGB_DXT1();
293 
294  case CODE_RGBA_DXT1:
295  return SRGBA_DXT1();
296 
297  case CODE_RGBA_DXT3:
298  return SRGBA_DXT3();
299 
300  case CODE_RGBA_DXT5:
301  return SRGBA_DXT5();
302 
303  default:
304  return otherFormat;
305  }
306 }
Definition: ImageFormat.h:139
Definition: ImageFormat.h:138
static const ImageFormat * SRGB_DXT1()
static const ImageFormat * SRGBA_DXT5()
Definition: ImageFormat.h:137
Definition: ImageFormat.h:55
static const ImageFormat * SRGBA_DXT3()
Definition: ImageFormat.h:136
Definition: ImageFormat.h:107
static const ImageFormat * SRGB8()
static const ImageFormat * SRGBA_DXT1()
static const ImageFormat * SRGBA8()

+ Here is the call graph for this function:

bool G3D::ImageFormat::isIntegerFormat ( ) const
inline
546  {
547  return (numberFormat == INTEGER_FORMAT);
548  }
Definition: ImageFormat.h:186
NumberFormat numberFormat
Definition: ImageFormat.h:253
static const ImageFormat* G3D::ImageFormat::L16 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::L16F ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::L32F ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::L8 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::LA16 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::LA16F ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::LA32F ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::LA4 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::LA8 ( )
static

+ Here is the caller graph for this function:

const std::string & G3D::ImageFormat::name ( ) const

Human readable name of this format.

245  {
247  return nameArray[code];
248 }
Definition: ImageFormat.h:164
#define debugAssert(exp)
Definition: debugAssert.h:160
Code code
Definition: ImageFormat.h:196
Definition: inftrees.h:24
static const std::string nameArray[ImageFormat::CODE_NUM]
Definition: ImageFormat.cpp:115
static const ImageFormat* G3D::ImageFormat::R11G11B10F ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::R16 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::R16F ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::R16I ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::R16UI ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::R32F ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::R32I ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::R32UI ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::R8 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::R8I ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::R8UI ( )
static

+ Here is the caller graph for this function:

bool G3D::ImageFormat::representableAsColor1unorm8 ( ) const

Does this contain exactly one unorm8 component?

683  {
684  return (numComponents == 1) &&
685  (cpuBitsPerPixel == 8) &&
686  ((luminanceBits == 8) ||
687  (redBits == 8) ||
688  (alphaBits == 8));
689 }
int redBits
Definition: ImageFormat.h:215
int alphaBits
Definition: ImageFormat.h:212
int cpuBitsPerPixel
Definition: ImageFormat.h:230
int luminanceBits
Definition: ImageFormat.h:209
int numComponents
Definition: ImageFormat.h:192
bool G3D::ImageFormat::representableAsColor2unorm8 ( ) const

Does this contain exactly two unorm8 components?

692  {
693  return (numComponents == 2) &&
694  (cpuBitsPerPixel == 16) &&
695  ((redBits == 8 && greenBits == 8) ||
696  (luminanceBits == 8 && alphaBits == 8) ||
697  (redBits == 8 && alphaBits == 8));
698 }
int redBits
Definition: ImageFormat.h:215
int greenBits
Definition: ImageFormat.h:218
int alphaBits
Definition: ImageFormat.h:212
int cpuBitsPerPixel
Definition: ImageFormat.h:230
int luminanceBits
Definition: ImageFormat.h:209
int numComponents
Definition: ImageFormat.h:192
bool G3D::ImageFormat::representableAsColor3unorm8 ( ) const

Does this contain exactly three unorm8 components?

701  {
702  return (numComponents == 3) &&
703  (cpuBitsPerPixel == 24) &&
704  (redBits == 8 && greenBits == 8 && blueBits == 8);
705 }
int redBits
Definition: ImageFormat.h:215
int blueBits
Definition: ImageFormat.h:221
int greenBits
Definition: ImageFormat.h:218
int cpuBitsPerPixel
Definition: ImageFormat.h:230
int numComponents
Definition: ImageFormat.h:192
bool G3D::ImageFormat::representableAsColor4unorm8 ( ) const

Does this contain exactly four unorm8 components?

708  {
709  return (numComponents == 4) &&
710  (cpuBitsPerPixel == 32) &&
711  (redBits == 8 && greenBits == 8 && blueBits == 8 && alphaBits == 8);
712 }
int redBits
Definition: ImageFormat.h:215
int blueBits
Definition: ImageFormat.h:221
int greenBits
Definition: ImageFormat.h:218
int alphaBits
Definition: ImageFormat.h:212
int cpuBitsPerPixel
Definition: ImageFormat.h:230
int numComponents
Definition: ImageFormat.h:192
static const ImageFormat* G3D::ImageFormat::RG16 ( )
static
static const ImageFormat* G3D::ImageFormat::RG16F ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RG16I ( )
static
static const ImageFormat* G3D::ImageFormat::RG16UI ( )
static
static const ImageFormat* G3D::ImageFormat::RG32F ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RG32I ( )
static
static const ImageFormat* G3D::ImageFormat::RG32UI ( )
static
static const ImageFormat* G3D::ImageFormat::RG8 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RG8I ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RG8UI ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGB10 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGB10A2 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGB16 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGB16_SNORM ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGB16F ( )
static
static const ImageFormat* G3D::ImageFormat::RGB32F ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGB32I ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGB32UI ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGB5 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGB5A1 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGB8 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGB8_SNORM ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGB8I ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGB8UI ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGB9E5F ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGB_DXT1 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGBA16 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGBA16_SNORM ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGBA16F ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGBA16I ( )
static
static const ImageFormat* G3D::ImageFormat::RGBA16UI ( )
static
static const ImageFormat* G3D::ImageFormat::RGBA32F ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGBA32I ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGBA32UI ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGBA8 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGBA8_SNORM ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGBA8I ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGBA8UI ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGBA_DXT1 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGBA_DXT3 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::RGBA_DXT5 ( )
static

+ Here is the caller graph for this function:

bool G3D::ImageFormat::sameComponents ( const ImageFormat other) const

Returns true if these formats have the same components (possibly in different NumberFormats or sizes)

62  {
63  return
64  (numComponents == other->numComponents) &&
65  ((alphaBits != 0) == (other->alphaBits != 0)) &&
66  ((redBits != 0) == (other->redBits != 0)) &&
67  ((greenBits != 0) == (other->greenBits != 0)) &&
68  ((blueBits != 0) == (other->blueBits != 0)) &&
69  ((luminanceBits != 0) == (other->luminanceBits != 0)) &&
70  ((stencilBits != 0) == (other->stencilBits != 0)) &&
71  ((depthBits != 0) == (other->depthBits != 0));
72 }
int stencilBits
Definition: ImageFormat.h:224
int redBits
Definition: ImageFormat.h:215
int depthBits
Definition: ImageFormat.h:227
int blueBits
Definition: ImageFormat.h:221
int greenBits
Definition: ImageFormat.h:218
int alphaBits
Definition: ImageFormat.h:212
int luminanceBits
Definition: ImageFormat.h:209
int numComponents
Definition: ImageFormat.h:192
static const ImageFormat* G3D::ImageFormat::SL8 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::SLA8 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::SRGB8 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::SRGB_DXT1 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::SRGBA8 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::SRGBA_DXT1 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::SRGBA_DXT3 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::SRGBA_DXT5 ( )
static

+ Here is the caller graph for this function:

const ImageFormat * G3D::ImageFormat::stencil ( int  bits = 8)
static

Returns STENCIL1, STENCIL4, STENCIL8 or STENCIL16 according to the bits specified. You can use "glGetInteger(GL_STENCIL_BITS)" to match the screen's format.

94  {
95  switch (bits) {
96  case 1:
97  return STENCIL1();
98 
99  case 4:
100  return STENCIL4();
101 
102  case 8:
103  return STENCIL8();
104 
105  case 16:
106  return STENCIL16();
107 
108  default:
109  debugAssertM(false, "Stencil must be 1, 4, 8 or 16.");
110  return STENCIL16();
111  }
112 }
static const ImageFormat * STENCIL4()
#define debugAssertM(exp, message)
Definition: debugAssert.h:161
static const ImageFormat * STENCIL8()
uint16 bits() const
Returns the underlying bits in this representation. Equivalent to:
Definition: unorm16.h:89
static const ImageFormat * STENCIL1()
static const ImageFormat * STENCIL16()

+ Here is the call graph for this function:

static const ImageFormat* G3D::ImageFormat::STENCIL1 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::STENCIL16 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::STENCIL4 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::STENCIL8 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::YUV420_PLANAR ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::YUV422 ( )
static

+ Here is the caller graph for this function:

static const ImageFormat* G3D::ImageFormat::YUV444 ( )
static

+ Here is the caller graph for this function:

Member Data Documentation

int G3D::ImageFormat::alphaBits

Number of bits per pixel storage for alpha values; Zero for compressed textures and non-RGB.

BayerPattern G3D::ImageFormat::bayerPattern

If this is a Bayer format, what is the pattern.

int G3D::ImageFormat::blueBits

Number of bits per pixel storage for blue values; Zero for compressed textures and non-RGB.

Code G3D::ImageFormat::code

Useful for serializing.

ColorSpace G3D::ImageFormat::colorSpace
bool G3D::ImageFormat::compressed
int G3D::ImageFormat::cpuBitsPerPixel

Amount of CPU memory per pixel when packed into an array, discounting any end-of-row padding.

int G3D::ImageFormat::depthBits

Number of depth bits (for depth textures; e.g. shadow maps)

bool G3D::ImageFormat::floatingPoint

True if the bit depths specified are for float formats. TODO: Remove, replace with function keying off numberFormat

int G3D::ImageFormat::greenBits

Number of bits per pixel storage for green values; Zero for compressed textures and non-RGB.

int G3D::ImageFormat::luminanceBits
NumberFormat G3D::ImageFormat::numberFormat

Indicates whether this format treats numbers as integers, floating point, or normalized fixed point

int G3D::ImageFormat::numComponents

Number of channels (1 for a depth texture).

bool G3D::ImageFormat::opaque

True if there is no alpha channel for this texture.

int G3D::ImageFormat::openGLBaseFormat

The OpenGL base format equivalent to this one (e.g., GL_RGB, GL_ALPHA). Zero if there is no equivalent.

int G3D::ImageFormat::openGLBitsPerPixel

Amount of GPU memory per pixel on most graphics cards, for formats supported by OpenGL. This is only an estimate–the actual amount of memory may be different on your actual card.

This may be greater than the sum of the per-channel bits because graphics cards need to pad to the nearest 1, 2, or 4 bytes.

int G3D::ImageFormat::openGLDataFormat

The OpenGL bytes (type) format of the data buffer used with this texture format, e.g., GL_UNSIGNED_BYTE

int G3D::ImageFormat::openGLFormat

The OpenGL format equivalent to this one, e.g, GL_RGB8 Zero if there is no equivalent. This is actually a GLenum

int G3D::ImageFormat::redBits

Number of bits per pixel storage for red values; Zero for compressed textures and non-RGB.

int G3D::ImageFormat::stencilBits

Number of bits per pixel


The documentation for this class was generated from the following files: