|
constexpr | PixelFormat (PixelFormatRaw format={}) |
| Wraps PixelFormat. More...
|
|
constexpr | PixelFormat (PixelType type, int order, PackedLayout layout, int bits, int bytes) |
| Defining custom non-FourCC pixel formats. More...
|
|
constexpr | operator PixelFormatRaw () const |
| Unwraps to the underlying PixelFormat. More...
|
|
constexpr Uint8 | GetFlags () const |
| Retrieve the flags of an PixelFormat. More...
|
|
constexpr PixelType | GetType () const |
| Retrieve the type. More...
|
|
constexpr int | GetOrder () const |
| Retrieve the order. More...
|
|
constexpr PackedLayout | GetLayout () const |
| Retrieve the layout. More...
|
|
constexpr int | GetBitsPerPixel () const |
| Determine this's bits per pixel. More...
|
|
constexpr int | GetBytesPerPixel () const |
| Determine this's bytes per pixel. More...
|
|
constexpr bool | IsIndexed () const |
| Determine if this is an indexed format. More...
|
|
constexpr bool | IsPacked () const |
| Determine if this is a packed format. More...
|
|
constexpr bool | IsArray () const |
| Determine if this is an array format. More...
|
|
constexpr bool | Is10Bit () const |
| Determine if this is a 10-bit format. More...
|
|
constexpr bool | IsFloat () const |
| Determine if this is a floating point format. More...
|
|
const char * | GetName () const |
| Get the human readable name of a pixel format. More...
|
|
void | GetMasks (int *bpp, Uint32 *Rmask, Uint32 *Gmask, Uint32 *Bmask, Uint32 *Amask) const |
| Convert one of the enumerated pixel formats to a bpp value and RGBA masks. More...
|
|
const PixelFormatDetails & | GetDetails () const |
| Create an PixelFormatDetails structure corresponding to a pixel format. More...
|
|
| operator const PixelFormatDetails & () const |
| Same as GetDetails()
|
|
Uint32 | Map (ColorRaw c, PaletteConstParam palette={}) const |
| Map an RGBA quadruple to a pixel value for a given pixel format. More...
|
|
Color | Get (Uint32 pixel, PaletteConstParam palette={}) const |
| Get RGBA values from a pixel in the specified format. More...
|
|
|
constexpr bool | IsAlpha () const |
| Determine if this has an alpha channel. More...
|
|
constexpr bool | IsFourCC () const |
| Determine if this is a "FourCC" format. More...
|
|
SDL's pixel formats have the following naming convention:
- Names with a list of components and a single bit count, such as RGB24 and ABGR32, define a platform-independent encoding into bytes in the order specified. For example, in RGB24 data, each pixel is encoded in 3 bytes (red, green, blue) in that order, and in ABGR32 data, each pixel is encoded in 4 bytes (alpha, blue, green, red) in that order. Use these names if the property of a format that is important to you is the order of the bytes in memory or on disk.
- Names with a bit count per component, such as ARGB8888 and XRGB1555, are "packed" into an appropriately-sized integer in the platform's native endianness. For example, ARGB8888 is a sequence of 32-bit integers; in each integer, the most significant bits are alpha, and the least significant bits are blue. On a little-endian CPU such as x86, the least significant bits of each integer are arranged first in memory, but on a big-endian CPU such as s390x, the most significant bits are arranged first. Use these names if the property of a format that is important to you is the meaning of each bit position within a native-endianness integer.
- In indexed formats such as INDEX4LSB, each pixel is represented by encoding an index into the palette into the indicated number of bits, with multiple pixels packed into each byte if appropriate. In LSB formats, the first (leftmost) pixel is stored in the least-significant bits of the byte; in MSB formats, it's stored in the most-significant bits. INDEX8 does not need LSB/MSB variants, because each pixel exactly fills one byte.
The 32-bit byte-array encodings such as RGBA32 are aliases for the appropriate 8888 encoding for the current platform. For example, RGBA32 is an alias for ABGR8888 on little-endian CPUs like x86, or an alias for RGBA8888 on big-endian CPUs.
- Since
- This enum is available since SDL 3.2.0.
- Category:
- Wrap state
- See also
- wrap-state
-
PixelFormats