Describes the pixel format of an image. More...
#include <Luminous/PixelFormat.hpp>
Public Types | |
| enum | ChannelLayout { LAYOUT_UNKNOWN, LAYOUT_ALPHA = GL_ALPHA, LAYOUT_RGB = GL_RGB, LAYOUT_RGBA = GL_RGBA, LAYOUT_RED_GREEN = GL_RG, LAYOUT_STENCIL_INDEX = GL_STENCIL_INDEX, LAYOUT_DEPTH_COMPONENT = GL_DEPTH_COMPONENT, LAYOUT_RED = GL_RED, LAYOUT_GREEN = GL_GREEN, LAYOUT_BLUE = GL_BLUE, LAYOUT_BGR = GL_BGR, LAYOUT_BGRA = GL_BGRA } |
| Layout of channels. | |
| enum | ChannelType { TYPE_UNKNOWN, TYPE_BYTE = GL_BYTE, TYPE_UBYTE = GL_UNSIGNED_BYTE, TYPE_SHORT = GL_SHORT, TYPE_USHORT = GL_UNSIGNED_SHORT, TYPE_FLOAT = GL_FLOAT, TYPE_INT = GL_INT, TYPE_UINT = GL_UNSIGNED_INT, TYPE_DOUBLE = GL_DOUBLE } |
| Data type of a single channel. | |
| enum | Compression { COMPRESSION_NONE, COMPRESSED_RGB_DXT1 = GL_COMPRESSED_RGB_S3TC_DXT1_EXT, COMPRESSED_RGBA_DXT1 = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, COMPRESSED_RGBA_DXT3 = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, COMPRESSED_RGBA_DXT5 = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT } |
| Compression used. More... | |
Public Member Functions | |
| int | bytesPerPixel () const |
| Returns the number of bytes in a single pixel. | |
| Compression | compression () const |
| Returns the compression method. | |
| bool | hasAlpha () const |
| Check if the format specifies an alpha channel. More... | |
| ChannelLayout | layout () const |
| Returns the layout of the channels. | |
| int | numChannels () const |
| Returns the number of channels. | |
| bool | operator!= (const PixelFormat &that) const |
| Compare if two pixel formats are not the same. | |
| bool | operator== (const PixelFormat &that) const |
| Compare if two pixel formats are the same. | |
| PixelFormat (const PixelFormat &pf) | |
| Constructs a copy. More... | |
| PixelFormat (ChannelLayout layout=LAYOUT_UNKNOWN, ChannelType type=TYPE_UNKNOWN) | |
| Constructs a pixel format with the given info. More... | |
| PixelFormat (Compression compression) | |
| Constructs a pixel format using compression. More... | |
| QString | toString () const |
| Converts the pixel format into a human-readable string. | |
| ChannelType | type () const |
| Returns the data type of the channels. | |
Static Public Member Functions | |
| static PixelFormat | alphaUByte () |
| Constructs an 8-bit alpha-only pixel format. More... | |
| static PixelFormat | bgraUByte () |
| Constructs an 8-bit BGRA pixel format. More... | |
| static PixelFormat | bgrUByte () |
| Constructs an 8-bit BGR pixel format. More... | |
| static PixelFormat | blueUByte () |
| Constructs an 8-bit blue pixel format. More... | |
| static PixelFormat | greenUByte () |
| Constructs an 8-bit green pixel format. More... | |
| static PixelFormat | redFloat () |
| Constructs a floating-point luminance pixel format. | |
| static PixelFormat | redGreenFloat () |
| Constructs a floating-point luminance-alpha pixel format. | |
| static PixelFormat | redGreenUByte () |
| Constructs an 8-bit luminance-alpha pixel format. More... | |
| static PixelFormat | redUByte () |
| Constructs an 8-bit red pixel format. More... | |
| static PixelFormat | rgbaUByte () |
| Constructs an 8-bit RGBA pixel format. More... | |
| static PixelFormat | rgbUByte () |
| Constructs an 8-bit RGB pixel format. More... | |
Describes the pixel format of an image.
This class tells what type values there are in the pixels, and how they are aligned. It is implemented in a way that makes it easy to convert the pixel formats
| Luminous::PixelFormat::PixelFormat | ( | const PixelFormat & | pf | ) |
Constructs a copy.
| pf | pixel format to copy |
| Luminous::PixelFormat::PixelFormat | ( | ChannelLayout | layout = LAYOUT_UNKNOWN, |
| ChannelType | type = TYPE_UNKNOWN |
||
| ) |
Constructs a pixel format with the given info.
| layout | layout of the channels |
| type | channel data type |
| Luminous::PixelFormat::PixelFormat | ( | Compression | compression | ) |
Constructs a pixel format using compression.
| compression | compression to use |
|
inlinestatic |
Constructs an 8-bit alpha-only pixel format.
|
inlinestatic |
Constructs an 8-bit BGRA pixel format.
|
inlinestatic |
Constructs an 8-bit BGR pixel format.
Some platforms do not support this format.
|
inlinestatic |
Constructs an 8-bit blue pixel format.
|
inlinestatic |
Constructs an 8-bit green pixel format.
| bool Luminous::PixelFormat::hasAlpha | ( | ) | const |
Check if the format specifies an alpha channel.
|
inlinestatic |
Constructs an 8-bit luminance-alpha pixel format.
|
inlinestatic |
Constructs an 8-bit red pixel format.
This format is commonly used for storing grayscale images.
|
inlinestatic |
Constructs an 8-bit RGBA pixel format.
|
inlinestatic |
Constructs an 8-bit RGB pixel format.