OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgrePixelFormat.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2014 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef _PixelFormat_H__
29 #define _PixelFormat_H__
30 
31 #include "OgrePrerequisites.h"
32 #include "OgreCommon.h"
33 #include "OgreHeaderPrefix.h"
34 
35 namespace Ogre {
44  {
48  PF_L8 = 1,
51  PF_L16 = 2,
54  PF_A8 = 3,
57  PF_A4L4 = 4,
61  PF_R5G6B5 = 6,
63  PF_B5G6R5 = 7,
65  PF_R3G3B2 = 31,
71  PF_R8G8B8 = 10,
73  PF_B8G8R8 = 11,
88 #if OGRE_ENDIAN == OGRE_ENDIAN_BIG
97 #else
101  PF_BYTE_BGR = PF_R8G8B8,
103  PF_BYTE_BGRA = PF_A8R8G8B8,
105  PF_BYTE_RGBA = PF_A8B8G8R8,
106 #endif
107  PF_A2R10G10B10 = 15,
112  PF_DXT1 = 17,
114  PF_DXT2 = 18,
116  PF_DXT3 = 19,
118  PF_DXT4 = 20,
120  PF_DXT5 = 21,
127  // 32-bit pixel format, 32 bits (float) for red
138  PF_DEPTH = 29,
226  PF_R8 = 78,
228  PF_RG8 = 79,
259  // Number of pixel formats currently defined
260  PF_COUNT = 95
261  };
263 
269  PFF_HASALPHA = 0x00000001,
272  PFF_COMPRESSED = 0x00000002,
274  PFF_FLOAT = 0x00000004,
276  PFF_DEPTH = 0x00000008,
279  PFF_NATIVEENDIAN = 0x00000010,
282  PFF_LUMINANCE = 0x00000020,
284  PFF_INTEGER = 0x00000040
285  };
286 
289  {
290  PCT_BYTE = 0,
291  PCT_SHORT = 1,
294  PCT_SINT = 4,
295  PCT_UINT = 5,
297  };
298 
303  public:
310  static size_t getNumElemBytes( PixelFormat format );
311 
318  static size_t getNumElemBits( PixelFormat format );
319 
337  static size_t getMemorySize(uint32 width, uint32 height, uint32 depth, PixelFormat format);
338 
346  static unsigned int getFlags( PixelFormat format );
347 
349  static bool hasAlpha(PixelFormat format);
351  static bool isFloatingPoint(PixelFormat format);
353  static bool isInteger(PixelFormat format);
355  static bool isCompressed(PixelFormat format);
357  static bool isDepth(PixelFormat format);
359  static bool isNativeEndian(PixelFormat format);
361  static bool isLuminance(PixelFormat format);
362 
375  static bool isValidExtent(size_t width, size_t height, size_t depth, PixelFormat format);
376 
380  static void getBitDepths(PixelFormat format, int rgba[4]);
381 
385  static void getBitMasks(PixelFormat format, uint64 rgba[4]);
386 
390  static void getBitShifts(PixelFormat format, unsigned char rgba[4]);
391 
394  static String getFormatName(PixelFormat srcformat);
395 
403  static bool isAccessible(PixelFormat srcformat);
404 
409  static PixelComponentType getComponentType(PixelFormat fmt);
410 
414  static size_t getComponentCount(PixelFormat fmt);
415 
423  static PixelFormat getFormatFromName(const String& name, bool accessibleOnly = false, bool caseSensitive = false);
424 
432  static String getBNFExpressionOfPixelFormats(bool accessibleOnly = false);
433 
443  static PixelFormat getFormatForBitDepths(PixelFormat fmt, ushort integerBits, ushort floatBits);
444 
450  static void packColour(const ColourValue &colour, const PixelFormat pf, void* dest);
458  static void packColour(const uint8 r, const uint8 g, const uint8 b, const uint8 a, const PixelFormat pf, void* dest);
466  static void packColour(const float r, const float g, const float b, const float a, const PixelFormat pf, void* dest);
467 
473  static void unpackColour(ColourValue *colour, PixelFormat pf, const void* src);
485  static void unpackColour(uint8 *r, uint8 *g, uint8 *b, uint8 *a, PixelFormat pf, const void* src);
494  static void unpackColour(float *r, float *g, float *b, float *a, PixelFormat pf, const void* src);
495 
504  static void bulkPixelConversion(void *src, PixelFormat srcFormat, void *dst, PixelFormat dstFormat, unsigned int count);
505 
513  static void bulkPixelConversion(const PixelBox &src, const PixelBox &dst);
514 
519  static void bulkPixelVerticalFlip(const PixelBox &box);
520  };
524 }
525 
526 #include "OgreHeaderSuffix.h"
527 
528 #endif
64-bit pixel format, 16 bits red (signed int), 16 bits blue (signed int), 16 bits green (signed int)...
unsigned char uint8
Definition: OgrePlatform.h:422
16-bit pixel format, 5 bits red, 6 bits green, 5 bits blue.
32-bit pixel format, 16-bit green, 16-bit red
32-bit pixel format, 32 bits red (signed int).
Short per component (16 bit fixed 0.0..1.0))
32-bit pixel format, 16 bits red (signed int), 16 bits blue (signed int).
8-bit pixel format, 8 bits red (unsigned int).
unsigned int uint32
Definition: OgrePlatform.h:420
8-bit pixel format, 8 bits red (signed int).
This is a depth format (for depth textures)
#define _OgreExport
Definition: OgrePlatform.h:255
8-bit pixel format, 4 bits alpha, 4 bits luminance.
PVRTC (PowerVR) Version 2, 4 bpp.
std::vector< PixelFormat, A > type
DDS (DirectDraw Surface) BC4 format (unsigned normalised)
48-bit pixel format, 16 bits red (signed normalised int), 16 bits blue (signed normalised int)...
16-bit pixel format, 16 bits red (signed normalised int).
16-bit pixel format, 8 bits red (unsigned int), 8 bits blue (unsigned int).
48-bit pixel format, 16 bits red (signed int), 16 bits blue (signed int), 16 bits green (signed int)...
ATC (AMD_compressed_ATC_texture)
32 bit float per component
32-bit pixel format, 8 bits for alpha, red, green and blue.
48-bit pixel format, 16 bits red (unsigned int), 16 bits blue (unsigned int), 16 bits green (unsigned...
DDS (DirectDraw Surface) BC7 format (unsigned normalised sRGB)
ETC2 (Ericsson Texture Compression)
DDS (DirectDraw Surface) BC4 format (signed normalised)
16-bit pixel format, 8 bits red, 8 bits green.
Class representing colour.
DDS (DirectDraw Surface) DXT5 format.
Depth texture format.
Format is in native endian.
PixelFormatFlags
Flags defining some on/off properties of pixel formats.
3 byte pixel format, 1 byte for blue, 1 byte for green, 1 byte for red
PVRTC (PowerVR) RGBA 4 bpp.
DDS (DirectDraw Surface) BC6H format (signed 16 bit float)
ATC (AMD_compressed_ATC_texture)
This is a floating point format.
32-bit pixel format, 8 bits for blue, green, red and alpha.
DDS (DirectDraw Surface) BC7 format (unsigned normalised)
PVRTC (PowerVR) RGBA 2 bpp.
Byte per component (8 bit fixed 0.0..1.0)
This format has an alpha channel.
ETC1 (Ericsson Texture Compression)
24-bit pixel format, 8 bits red (unsigned int), 8 bits blue (unsigned int), 8 bits green (unsigned in...
ETC2 (Ericsson Texture Compression)
128-bit pixel format, 32 bits red (unsigned int), 32 bits blue (unsigned int), 32 bits green (unsigne...
96-bit pixel format, 32 bits (float) for red, 32 bits (float) for green, 32 bits (float) for blue ...
vector< PixelFormat >::type PixelFormatList
Some utility functions for packing and unpacking pixel data.
DDS (DirectDraw Surface) BC6H format (unsigned 16 bit float)
Unknown pixel format.
32-bit pixel format, 8 bits for red, green, blue and alpha.
96-bit pixel format, 32 bits red (unsigned int), 32 bits blue (unsigned int), 32 bits green (unsigned...
DDS (DirectDraw Surface) DXT3 format.
32-bit pixel format, 8 bits red (unsigned int), 8 bits blue (unsigned int), 8 bits green (unsigned in...
8-bit pixel format, 8 bits red (signed normalised int).
128-bit pixel format, 32 bits red (signed int), 32 bits blue (signed int), 32 bits green (signed int)...
PixelComponentType
Pixel component format.
4 byte pixel format, 1 byte for red, 1 byte for green, 1 byte for blue, and one byte for alpha ...
48-bit pixel format, 16 bits for red, green and blue
16 bit float per component
24-bit pixel format, 8 bits for blue, green and red.
DDS (DirectDraw Surface) DXT1 format.
3 byte pixel format, 1 byte for red, 1 byte for green, 1 byte for blue
PVRTC (PowerVR) RGB 2 bpp.
32-bit pixel format, 10 bits for blue, green and red, 2 bits for alpha.
32-bit pixel format, 8 bits for blue, green, red and alpha.
DDS (DirectDraw Surface) DXT2 format.
128-bit pixel format, 32 bits (float) for red, 32 bits (float) for green, 32 bits (float) for blue...
8-bit pixel format, all bits luminance.
16-bit pixel format, 5 bits red, 6 bits green, 5 bits blue.
64-bit pixel format, 32 bits red (unsigned int), 32 bits blue (unsigned int).
32-bit pixel format, 11 bits (float) for red, 11 bits (float) for green, 10 bits (float) for blue ...
64-bit pixel format, 32 bits red (signed int), 32 bits blue (signed int).
PixelFormat
The pixel format used for images, textures, and render surfaces.
32-bit pixel format, 8 bits for red, 8 bits for green, 8 bits for blue like PF_A8R8G8B8, but alpha will get discarded
32-bit, 2-channel s10e5 floating point pixel format, 16-bit green, 16-bit red
unsigned long long uint64
Definition: OgrePlatform.h:431
32-bit pixel format, 16 bits red (signed normalised int), 16 bits blue (signed normalised int)...
16-bit pixel format, 4 bits for alpha, red, green and blue.
This is an intensity format instead of a RGB one.
16-bit pixel format, 5 bits for blue, green, red and 1 for alpha.
4 byte pixel format, 1 byte for blue, 1 byte for green, 1 byte for red and one byte for alpha ...
16-bit pixel format, 16 bits red (unsigned int).
32-bit pixel format, 8 bits red (signed normalised int), 8 bits blue (signed normalised int)...
16-bit pixel format, 16 bits red (signed int).
unsigned short ushort
PVRTC (PowerVR) Version 2, 2 bpp.
64-bit pixel format, 16 bits (float) for red, 16 bits (float) for green, 16 bits (float) for blue...
16-bit pixel format, 8 bits red (signed int), 8 bits blue (signed int).
32-bit pixel format, 2 bits for alpha, 10 bits for red, green and blue.
This format is compressed.
DDS (DirectDraw Surface) DXT4 format.
8-bit pixel format, all bits alpha.
24-bit pixel format, 8 bits red (signed normalised int), 8 bits blue (signed normalised int)...
24-bit pixel format, 8 bits red (signed int), 8 bits blue (signed int), 8 bits green (signed int)...
32-bit pixel format, 32 bits red (unsigned int).
24-bit pixel format, 8 bits for red, green and blue.
32-bit pixel format, 8 bits red (signed int), 8 bits blue (signed int), 8 bits green (signed int)...
8-bit pixel format, all bits red.
Unsigned integer per component.
16-bit pixel format, all bits luminance.
96-bit pixel format, 32 bits red (signed int), 32 bits blue (signed int), 32 bits green (signed int)...
_StringBase String
Definition: OgreCommon.h:53
32-bit pixel format, 16 bits red (unsigned int), 16 bits blue (unsigned int).
ETC2 (Ericsson Texture Compression)
64-bit pixel format, 16 bits red (signed normalised int), 16 bits blue (signed normalised int)...
64-bit, 2-channel floating point pixel format, 32-bit green, 32-bit red
ATC (AMD_compressed_ATC_texture)
32-bit pixel format, 8 bits for blue, 8 bits for green, 8 bits for red like PF_A8B8G8R8, but alpha will get discarded
8-bit pixel format, 2 bits blue, 3 bits green, 3 bits red.
32-bit pixel format, 9 bits for blue, green, red plus a 5 bit exponent.
64-bit pixel format, 16 bits red (unsigned int), 16 bits blue (unsigned int), 16 bits green (unsigned...
Signed integer per component.
16-bit pixel format, 16 bits (float) for red
16-bit pixel format, 8 bits red (signed normalised int), 8 bits blue (signed normalised int)...
DDS (DirectDraw Surface) BC5 format (unsigned normalised)
2 byte pixel format, 1 byte luminance, 1 byte alpha
48-bit pixel format, 16 bits (float) for red, 16 bits (float) for green, 16 bits (float) for blue ...
DDS (DirectDraw Surface) BC5 format (signed normalised)
This is an integer format.
64-bit pixel format, 16 bits for red, green, blue and alpha
PVRTC (PowerVR) RGB 4 bpp.