Unofficial OpenGL Software Development Kit  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Classes | Enumerations | Files
Image Format

Types for representing the format of image data.

The ImageFormat class describes a particular arrangement of pixel data within an image. There are four enumerations that specify the different facets of an image format. The ImageFormat also includes the byte alignment of each row of the pixel data, regardless of how wide they are.

Not all combinations of image format parameters are valid. To prevent accidental use of invalid combinations, ImageFormat objects are verified upon creation. Invalid combinations of parameters will throw InvalidFormatException, which contains a message describing the problem. The rules for image format validation are available.

Classes

struct  glimg::UncheckedImageFormat
 Represents a potentially valid image format. More...
 
class  glimg::InvalidFormatException
 Thrown if an invalid format is used by any API. Usually contains an explanation of the problem. More...
 
class  glimg::ImageFormat
 An immutable combination of image format parameters. More...
 

Enumerations

enum  glimg::PixelDataType {
  glimg::DT_NORM_UNSIGNED_INTEGER, glimg::DT_NORM_SIGNED_INTEGER, glimg::DT_UNSIGNED_INTEGRAL, glimg::DT_SIGNED_INTEGRAL,
  glimg::DT_FLOAT, glimg::DT_SHARED_EXP_FLOAT , glimg::DT_COMPRESSED_BC1 = DT_NUM_UNCOMPRESSED_TYPES, glimg::DT_COMPRESSED_BC2,
  glimg::DT_COMPRESSED_BC3, glimg::DT_COMPRESSED_UNSIGNED_BC4, glimg::DT_COMPRESSED_SIGNED_BC4, glimg::DT_COMPRESSED_UNSIGNED_BC5,
  glimg::DT_COMPRESSED_SIGNED_BC5, glimg::DT_COMPRESSED_UNSIGNED_BC6H, glimg::DT_COMPRESSED_SIGNED_BC6H, glimg::DT_COMPRESSED_BC7
}
 Describes the basic type of the pixel data. More...
 
enum  glimg::PixelComponents {
  glimg::FMT_COLOR_RED, glimg::FMT_COLOR_RG, glimg::FMT_COLOR_RGB, glimg::FMT_COLOR_RGBX,
  glimg::FMT_COLOR_RGBA, glimg::FMT_COLOR_RGB_sRGB, glimg::FMT_COLOR_RGBX_sRGB, glimg::FMT_COLOR_RGBA_sRGB,
  glimg::FMT_DEPTH, glimg::FMT_DEPTH_X
}
 Describes the components stored in a pixel of the image. More...
 
enum  glimg::ComponentOrder {
  glimg::ORDER_RGBA, glimg::ORDER_BGRA, glimg::ORDER_RGBE, glimg::ORDER_DEPTH_STENCIL,
  glimg::ORDER_COMPRESSED
}
 Specifies the ordering of the component data in the image. More...
 
enum  glimg::Bitdepth {
  glimg::BD_COMPRESSED, glimg::BD_PER_COMP_8, glimg::BD_PER_COMP_16, glimg::BD_PER_COMP_32 ,
  glimg::BD_PACKED_16_BIT_565 = BD_NUM_PER_COMPONENT, glimg::BD_PACKED_16_BIT_5551, glimg::BD_PACKED_16_BIT_4444, glimg::BD_PACKED_32_BIT_8888,
  glimg::BD_PACKED_32_BIT_1010102, glimg::BD_PACKED_32_BIT_248, glimg::BD_PACKED_16_BIT_565_REV, glimg::BD_PACKED_16_BIT_1555_REV,
  glimg::BD_PACKED_16_BIT_4444_REV, glimg::BD_PACKED_32_BIT_8888_REV, glimg::BD_PACKED_32_BIT_2101010_REV, glimg::BD_PACKED_32_BIT_101111_REV,
  glimg::BD_PACKED_32_BIT_5999_REV
}
 Specifies the bitdepth for each component of each pixel. More...
 

Files

file  ImageFormat.h
 Contains all of the enums and objects related to formats.
 

Enumeration Type Documentation

Specifies the bitdepth for each component of each pixel.

Each component of each pixel has a particular bitdepth. The bitdepths specified here are either per-component or specify the size of an entire pixel. The PER_COMP enumerators specify the size of each component.

So if PER_COMP_16 is used with a RGB format, then each pixel takes up 48 bits. This could be using integers (shorts) or floats (half-floats). Whether it is 16-bit integers or 16-bit floats is determined by the PixelDataType.

The PACKED enumerators are for formats where each component does not have the same bitdepth. The number after PACKED specifies the overall bitdepth of the pixel. PACKED_16_BIT means that the pixel takes up 16 bits. The numbers after represent the bitdepth of the individual components, in the order specified by the ComponentOrder enumerator.

PACKED formats that end in _REV reverse the order of the components. So 1555_REV means that the lowest 5 bits are the first component, the next 5 are the second, the 5 after that are the third, and the highest bit is the fourth component.

Enumerator
BD_COMPRESSED 

Used for compressed data types. They do not have a bitdepth.

BD_PER_COMP_8 

Each component takes up 8 bits.

BD_PER_COMP_16 

Each component takes up 16 bits.

BD_PER_COMP_32 

Each component takes up 32 bits.

BD_PACKED_16_BIT_565 

The first and third components take up 5 bits, while the second takes up 6.

BD_PACKED_16_BIT_5551 

The first three components take up 5 bits, and the last takes up 1.

BD_PACKED_16_BIT_4444 

Each component takes up 4 bits.

BD_PACKED_32_BIT_8888 

Each component takes up 8 bits.

BD_PACKED_32_BIT_1010102 

The first three components take up 10 bits, and the last takes up 2.

BD_PACKED_32_BIT_248 

The first component takes up 24 bits; the second takes up 8 bits.

BD_PACKED_16_BIT_565_REV 

Reverse order. The first and third components take up 5 bits, while the second takes up 6.

BD_PACKED_16_BIT_1555_REV 

Reverse order. The first three components take up 5 bits, and the last takes up 1.

BD_PACKED_16_BIT_4444_REV 

Reverse order. Each component takes up 4 bits.

BD_PACKED_32_BIT_8888_REV 

Reverse order. Each component takes up 8 bits.

BD_PACKED_32_BIT_2101010_REV 

Reverse order. The first three components take up 10 bits, and the last takes up 2.

BD_PACKED_32_BIT_101111_REV 

Reverse order. The first two components take 11 bits, and the third takes 10. Used only for DT_FLOAT types.

BD_PACKED_32_BIT_5999_REV 

Reverse order. The first 3 components take 9 bits, and the last takes 5. Used only for DT_SHARED_EXP_FLOAT types.

Specifies the ordering of the component data in the image.

This enumeration specifies the ordering of the components in the image's values. Components that are missing from the BaseDataFormat are ignored.

Some combinations of order and bitdepth are not allowed.

Enumerator
ORDER_RGBA 

Standard RGBA ordering.

ORDER_BGRA 

Often used in conjunction with _REV Bitdepths.

ORDER_RGBE 

For DT_SHARED_EXP_FLOAT types. The E is the exponent, and it comes last. Can only be used with BD_PACKED_32_BIT_5999_REF.

ORDER_DEPTH_STENCIL 

Ordering for depth and depth-stencil image formats.

ORDER_COMPRESSED 

The order is built into the compressed data format.

Describes the components stored in a pixel of the image.

Pixels can store between 1 and 4 values. This enumerator defines how many values are stored and what these values mean. It defines the colorspace of the values (sRGB vs. linear), and also whether the values are color or depth values.

Enumerator
FMT_COLOR_RED 

Image contains 1 color component, namely red.

FMT_COLOR_RG 

Image contains 2 color components, red and green.

FMT_COLOR_RGB 

Image contains 3 color components, red, green, and blue.

FMT_COLOR_RGBX 

Image contains 3 color components, red, green, and blue. There is a fourth component, which takes up space in the data but should be discarded.

FMT_COLOR_RGBA 

Image contains 4 color components, red, green, blue, and alpha.

FMT_COLOR_RGB_sRGB 

Image contains 3 color components, which are in the sRGB colorspace.

FMT_COLOR_RGBX_sRGB 

Image contains 3 color components, which are in the sRGB colorspace. There is a fourth component, which takes up space in the data but should be discarded.

FMT_COLOR_RGBA_sRGB 

Image contains 4 color components; the RGB components are in the sRGB colorspace.

FMT_DEPTH 

Image contains a single depth component.

FMT_DEPTH_X 

Image contains a depth value (unsigned normalized integer) and a second component, who's value is discarded/irrelevant.

Describes the basic type of the pixel data.

The pixel data type of an image represents the basic type of data stored in the image. This can be floating-point, normalized unsigned integer, and the like. They also describe if they are compressed. You can test a PixelDataType to see if it is a compressed format by seeing if the value is less than DT_NUM_UNCOMPRESSED_TYPES.

Enumerator
DT_NORM_UNSIGNED_INTEGER 

Image data are unsigned integers that are mapped to floats on the range [0, 1].

DT_NORM_SIGNED_INTEGER 

Image data are signed integers that are mapped to floats on the range [-1, 1].

DT_UNSIGNED_INTEGRAL 

Image data are unsigned integers.

DT_SIGNED_INTEGRAL 

Image data are signed integers.

DT_FLOAT 

Image data are individual floating-point numbers.

DT_SHARED_EXP_FLOAT 

Image data are floats, but each pixel uses the same exponent.

DT_COMPRESSED_BC1 

Image data is compressed with DXT1/BC1 compression. Unsigned normalized integers.

DT_COMPRESSED_BC2 

Image data is compressed with DXT3/BC2 compression. Unsigned normalized integers.

DT_COMPRESSED_BC3 

Image data is compressed with DXT5/BC3 compression. Unsigned normalized integers.

DT_COMPRESSED_UNSIGNED_BC4 

Image is compressed with BC4 compression (1-component), with unsigned normalized integers.

DT_COMPRESSED_SIGNED_BC4 

Image is compressed with BC4 compression (1-component), with signed normalized integers.

DT_COMPRESSED_UNSIGNED_BC5 

Image is compressed with BC5 compression (2-component), with unsigned normalized integers.

DT_COMPRESSED_SIGNED_BC5 

Image is compressed with BC5 compression (2-component), with signed normalized integers.

DT_COMPRESSED_UNSIGNED_BC6H 

Image is compressed with BC6H compression, with unsigned floats [0, +inf).

DT_COMPRESSED_SIGNED_BC6H 

Image is compressed with BC6H compression, with floats.

DT_COMPRESSED_BC7 

Image data is compressed with BC7 compression. Unsigned normalized integers.