SDL3pp
A slim C++ wrapper for SDL3
|
SDL offers facilities for pixel management. More...
Classes | |
class | SDL::PixelFormat |
Pixel format. More... | |
class | SDL::Colorspace |
Colorspace definitions. More... | |
struct | SDL::Color |
A structure that represents a color as RGBA components. More... | |
struct | SDL::FColor |
The bits of this structure can be directly reinterpreted as a float-packed color which uses the PIXELFORMAT_RGBA128_FLOAT format. More... | |
struct | SDL::PaletteBase |
A set of indexed colors representing a palette. More... | |
struct | SDL::PaletteRef |
Handle to a non owned palette. More... | |
struct | SDL::Palette |
Handle to an owned palette. More... | |
Macros | |
#define | SDL_ALPHA_OPAQUE 255 |
A fully opaque 8-bit alpha value. | |
#define | SDL_ALPHA_OPAQUE_FLOAT 1.0f |
A fully opaque floating point alpha value. | |
#define | SDL_ALPHA_TRANSPARENT 0 |
A fully transparent 8-bit alpha value. | |
#define | SDL_ALPHA_TRANSPARENT_FLOAT 0.0f |
A fully transparent floating point alpha value. | |
#define | SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D) |
A macro for defining custom FourCC pixel formats. | |
#define | SDL_PIXELFLAG(format) (((format) >> 28) & 0x0F) |
A macro to retrieve the flags of an PixelFormat. | |
Typedefs | |
using | SDL::PixelFormatDetails = SDL_PixelFormatDetails |
Details about the format of a pixel. | |
Functions | |
Uint32 | SDL::MapRGB (const PixelFormatDetails &format, const PaletteBase &palette, Uint8 r, Uint8 g, Uint8 b) |
Map an RGB triple to an opaque pixel value for a given pixel format. | |
Uint32 | SDL::MapRGBA (const PixelFormatDetails &format, const PaletteBase &palette, Uint8 r, Uint8 g, Uint8 b, Uint8 a) |
Map an RGBA quadruple to a pixel value for a given pixel format. | |
void | SDL::GetRGB (Uint32 pixel, const PixelFormatDetails &format, const PaletteBase &palette, Uint8 *r, Uint8 *g, Uint8 *b) |
Get RGB values from a pixel in the specified format. | |
void | SDL::GetRGBA (Uint32 pixel, const PixelFormatDetails &format, const PaletteBase &palette, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a) |
Get RGBA values from a pixel in the specified format. | |
PixelTypes | |
using | SDL::PixelType = SDL_PixelType |
Pixel type. | |
constexpr PixelType | SDL::PIXELTYPE_UNKNOWN = SDL_PIXELTYPE_UNKNOWN |
UNKNOWN. | |
constexpr PixelType | SDL::PIXELTYPE_INDEX1 = SDL_PIXELTYPE_INDEX1 |
INDEX1. | |
constexpr PixelType | SDL::PIXELTYPE_INDEX4 = SDL_PIXELTYPE_INDEX4 |
INDEX4. | |
constexpr PixelType | SDL::PIXELTYPE_INDEX8 = SDL_PIXELTYPE_INDEX8 |
INDEX8. | |
constexpr PixelType | SDL::PIXELTYPE_PACKED8 = SDL_PIXELTYPE_PACKED8 |
PACKED8. | |
constexpr PixelType | SDL::PIXELTYPE_PACKED16 = SDL_PIXELTYPE_PACKED16 |
PACKED16. | |
constexpr PixelType | SDL::PIXELTYPE_PACKED32 = SDL_PIXELTYPE_PACKED32 |
PACKED32. | |
constexpr PixelType | SDL::PIXELTYPE_ARRAYU8 = SDL_PIXELTYPE_ARRAYU8 |
ARRAYU8. | |
constexpr PixelType | SDL::PIXELTYPE_ARRAYU16 = SDL_PIXELTYPE_ARRAYU16 |
ARRAYU16. | |
constexpr PixelType | SDL::PIXELTYPE_ARRAYU32 = SDL_PIXELTYPE_ARRAYU32 |
ARRAYU32. | |
constexpr PixelType | SDL::PIXELTYPE_ARRAYF16 = SDL_PIXELTYPE_ARRAYF16 |
ARRAYF16. | |
constexpr PixelType | SDL::PIXELTYPE_ARRAYF32 = SDL_PIXELTYPE_ARRAYF32 |
ARRAYF32. | |
constexpr PixelType | SDL::PIXELTYPE_INDEX2 = SDL_PIXELTYPE_INDEX2 |
INDEX2. | |
BitmapOrders | |
using | SDL::BitmapOrder = SDL_BitmapOrder |
Bitmap pixel order, high bit -> low bit. | |
constexpr BitmapOrder | SDL::BITMAPORDER_NONE = SDL_BITMAPORDER_NONE |
NONE. | |
constexpr BitmapOrder | SDL::BITMAPORDER_4321 = SDL_BITMAPORDER_4321 |
4321 | |
constexpr BitmapOrder | SDL::BITMAPORDER_1234 = SDL_BITMAPORDER_1234 |
1234 | |
PackedOrders | |
using | SDL::PackedOrder = SDL_PackedOrder |
Packed component order, high bit -> low bit. | |
constexpr PackedOrder | SDL::PACKEDORDER_NONE = SDL_PACKEDORDER_NONE |
NONE. | |
constexpr PackedOrder | SDL::PACKEDORDER_XRGB = SDL_PACKEDORDER_XRGB |
XRGB. | |
constexpr PackedOrder | SDL::PACKEDORDER_RGBX = SDL_PACKEDORDER_RGBX |
RGBX. | |
constexpr PackedOrder | SDL::PACKEDORDER_ARGB = SDL_PACKEDORDER_ARGB |
ARGB. | |
constexpr PackedOrder | SDL::PACKEDORDER_RGBA = SDL_PACKEDORDER_RGBA |
RGBA. | |
constexpr PackedOrder | SDL::PACKEDORDER_XBGR = SDL_PACKEDORDER_XBGR |
XBGR. | |
constexpr PackedOrder | SDL::PACKEDORDER_BGRX = SDL_PACKEDORDER_BGRX |
BGRX. | |
constexpr PackedOrder | SDL::PACKEDORDER_ABGR = SDL_PACKEDORDER_ABGR |
ABGR. | |
constexpr PackedOrder | SDL::PACKEDORDER_BGRA = SDL_PACKEDORDER_BGRA |
BGRA. | |
ArrayOrders | |
using | SDL::ArrayOrder = SDL_ArrayOrder |
Array component order, low byte -> high byte. | |
constexpr ArrayOrder | SDL::ARRAYORDER_NONE = SDL_ARRAYORDER_NONE |
NONE. | |
constexpr ArrayOrder | SDL::ARRAYORDER_RGB = SDL_ARRAYORDER_RGB |
RGB. | |
constexpr ArrayOrder | SDL::ARRAYORDER_RGBA = SDL_ARRAYORDER_RGBA |
RGBA. | |
constexpr ArrayOrder | SDL::ARRAYORDER_ARGB = SDL_ARRAYORDER_ARGB |
ARGB. | |
constexpr ArrayOrder | SDL::ARRAYORDER_BGR = SDL_ARRAYORDER_BGR |
BGR. | |
constexpr ArrayOrder | SDL::ARRAYORDER_BGRA = SDL_ARRAYORDER_BGRA |
BGRA. | |
constexpr ArrayOrder | SDL::ARRAYORDER_ABGR = SDL_ARRAYORDER_ABGR |
ABGR. | |
PackedLayouts | |
using | SDL::PackedLayout = SDL_PackedLayout |
Packed component layout. | |
constexpr PackedLayout | SDL::PACKEDLAYOUT_NONE = SDL_PACKEDLAYOUT_NONE |
NONE. | |
constexpr PackedLayout | SDL::PACKEDLAYOUT_332 = SDL_PACKEDLAYOUT_332 |
332 | |
constexpr PackedLayout | SDL::PACKEDLAYOUT_4444 = SDL_PACKEDLAYOUT_4444 |
4444 | |
constexpr PackedLayout | SDL::PACKEDLAYOUT_1555 = SDL_PACKEDLAYOUT_1555 |
1555 | |
constexpr PackedLayout | SDL::PACKEDLAYOUT_5551 = SDL_PACKEDLAYOUT_5551 |
5551 | |
constexpr PackedLayout | SDL::PACKEDLAYOUT_565 = SDL_PACKEDLAYOUT_565 |
565 | |
constexpr PackedLayout | SDL::PACKEDLAYOUT_8888 = SDL_PACKEDLAYOUT_8888 |
8888 | |
constexpr PackedLayout | SDL::PACKEDLAYOUT_2101010 |
2101010 | |
constexpr PackedLayout | SDL::PACKEDLAYOUT_1010102 |
1010102 | |
ColorTypes | |
using | SDL::ColorType = SDL_ColorType |
Colorspace color type. | |
constexpr ColorType | SDL::COLOR_TYPE_UNKNOWN |
COLOR_TYPE_UNKNOWN. | |
constexpr ColorType | SDL::COLOR_TYPE_RGB = SDL_COLOR_TYPE_RGB |
COLOR_TYPE_RGB. | |
constexpr ColorType | SDL::COLOR_TYPE_YCBCR |
COLOR_TYPE_YCBCR. | |
ColorRanges | |
using | SDL::ColorRange = SDL_ColorRange |
Colorspace color range, as described by https://www.itu.int/rec/R-REC-BT.2100-2-201807-I/en. | |
constexpr ColorRange | SDL::COLOR_RANGE_UNKNOWN |
COLOR_RANGE_UNKNOWN. | |
constexpr ColorRange | SDL::COLOR_RANGE_LIMITED = SDL_COLOR_RANGE_LIMITED |
Narrow range, e.g. | |
constexpr ColorRange | SDL::COLOR_RANGE_FULL = SDL_COLOR_RANGE_FULL |
Full range, e.g. | |
ChromaLocations | |
using | SDL::ChromaLocation = SDL_ChromaLocation |
Colorspace chroma sample location. | |
constexpr ChromaLocation | SDL::CHROMA_LOCATION_NONE |
RGB, no chroma sampling. | |
constexpr ChromaLocation | SDL::CHROMA_LOCATION_LEFT = SDL_CHROMA_LOCATION_LEFT |
In MPEG-2, MPEG-4, and AVC, Cb and Cr are taken on midpoint of the left-edge of the 2x2 square. | |
constexpr ChromaLocation | SDL::CHROMA_LOCATION_CENTER = SDL_CHROMA_LOCATION_CENTER |
In JPEG/JFIF, H.261, and MPEG-1, Cb and Cr are taken at the center of the 2x2 square. | |
constexpr ChromaLocation | SDL::CHROMA_LOCATION_TOPLEFT = SDL_CHROMA_LOCATION_TOPLEFT |
In HEVC for BT.2020 and BT.2100 content (in particular on Blu-rays), Cb and Cr are sampled at the same location as the group's top-left Y pixel ("co-sited", "co-located"). | |
PixelFormats | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_UNKNOWN |
UNKNOWN. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_INDEX1LSB |
INDEX1LSB. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_INDEX1MSB |
INDEX1MSB. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_INDEX2LSB |
INDEX2LSB. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_INDEX2MSB |
INDEX2MSB. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_INDEX4LSB |
INDEX4LSB. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_INDEX4MSB |
INDEX4MSB. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_INDEX8 |
INDEX8. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_RGB332 |
RGB332. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_XRGB4444 |
XRGB4444. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_XBGR4444 |
XBGR4444. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_XRGB1555 |
XRGB1555. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_XBGR1555 |
XBGR1555. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_ARGB4444 |
ARGB4444. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_RGBA4444 |
RGBA4444. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_ABGR4444 |
ABGR4444. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_BGRA4444 |
BGRA4444. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_ARGB1555 |
ARGB1555. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_RGBA5551 |
RGBA5551. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_ABGR1555 |
ABGR1555. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_BGRA5551 |
BGRA5551. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_RGB565 |
RGB565. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_BGR565 |
BGR565. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_RGB24 = SDL_PIXELFORMAT_RGB24 |
RGB24. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_BGR24 = SDL_PIXELFORMAT_BGR24 |
BGR24. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_XRGB8888 |
XRGB8888. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_RGBX8888 |
RGBX8888. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_XBGR8888 |
XBGR8888. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_BGRX8888 |
BGRX8888. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_ARGB8888 |
ARGB8888. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_RGBA8888 |
RGBA8888. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_ABGR8888 |
ABGR8888. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_BGRA8888 |
BGRA8888. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_XRGB2101010 |
XRGB2101010. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_XBGR2101010 |
XBGR2101010. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_ARGB2101010 |
ARGB2101010. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_ABGR2101010 |
ABGR2101010. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_RGB48 = SDL_PIXELFORMAT_RGB48 |
RGB48. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_BGR48 = SDL_PIXELFORMAT_BGR48 |
BGR48. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_RGBA64 |
RGBA64. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_ARGB64 |
ARGB64. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_BGRA64 |
BGRA64. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_ABGR64 |
ABGR64. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_RGB48_FLOAT |
RGB48_FLOAT. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_BGR48_FLOAT |
BGR48_FLOAT. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_RGBA64_FLOAT |
RGBA64_FLOAT. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_ARGB64_FLOAT |
ARGB64_FLOAT. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_BGRA64_FLOAT |
BGRA64_FLOAT. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_ABGR64_FLOAT |
ABGR64_FLOAT. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_RGB96_FLOAT |
RGB96_FLOAT. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_BGR96_FLOAT |
BGR96_FLOAT. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_RGBA128_FLOAT |
RGBA128_FLOAT. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_ARGB128_FLOAT |
ARGB128_FLOAT. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_BGRA128_FLOAT |
BGRA128_FLOAT. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_ABGR128_FLOAT |
ABGR128_FLOAT. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_YV12 |
Planar mode: Y + V + U (3 planes) | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_IYUV |
Planar mode: Y + U + V (3 planes) | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_YUY2 |
Packed mode: Y0+U0+Y1+V0 (1 plane) | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_UYVY |
Packed mode: U0+Y0+V0+Y1 (1 plane) | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_YVYU |
Packed mode: Y0+V0+Y1+U0 (1 plane) | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_NV12 |
Planar mode: Y + U/V interleaved (2 planes) | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_NV21 |
Planar mode: Y + V/U interleaved (2 planes) | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_P010 |
Planar mode: Y + U/V interleaved (2 planes) | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_EXTERNAL_OES |
Android video texture format. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_MJPG |
Motion JPEG. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_RGBA32 |
RGBA32. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_ARGB32 |
ARGB32. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_BGRA32 |
BGRA32. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_ABGR32 |
ABGR32. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_RGBX32 |
RGBX32. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_XRGB32 |
XRGB32. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_BGRX32 |
BGRX32. | |
constexpr SDL_PixelFormat | SDL::PIXELFORMAT_XBGR32 |
XBGR32. | |
Colorspaces | |
constexpr SDL_Colorspace | SDL::COLORSPACE_UNKNOWN |
UNKNOWN. | |
constexpr SDL_Colorspace | SDL::COLORSPACE_SRGB = SDL_COLORSPACE_SRGB |
Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709. | |
constexpr SDL_Colorspace | SDL::COLORSPACE_SRGB_LINEAR |
[object Object] | |
constexpr SDL_Colorspace | SDL::COLORSPACE_HDR10 |
[object Object] | |
constexpr SDL_Colorspace | SDL::COLORSPACE_JPEG = SDL_COLORSPACE_JPEG |
Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601. | |
constexpr SDL_Colorspace | SDL::COLORSPACE_BT601_LIMITED |
Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601. | |
constexpr SDL_Colorspace | SDL::COLORSPACE_BT601_FULL = SDL_COLORSPACE_BT601_FULL |
Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601. | |
constexpr SDL_Colorspace | SDL::COLORSPACE_BT709_LIMITED |
Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709. | |
constexpr SDL_Colorspace | SDL::COLORSPACE_BT709_FULL = SDL_COLORSPACE_BT709_FULL |
Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709. | |
constexpr SDL_Colorspace | SDL::COLORSPACE_BT2020_LIMITED |
Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020. | |
constexpr SDL_Colorspace | SDL::COLORSPACE_BT2020_FULL = SDL_COLORSPACE_BT2020_FULL |
Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020. | |
constexpr SDL_Colorspace | SDL::COLORSPACE_RGB_DEFAULT = SDL_COLORSPACE_RGB_DEFAULT |
The default colorspace for RGB surfaces if no colorspace is specified. | |
constexpr SDL_Colorspace | SDL::COLORSPACE_YUV_DEFAULT = SDL_COLORSPACE_YUV_DEFAULT |
The default colorspace for YUV surfaces if no colorspace is specified. | |
Largely these facilities deal with pixel format: what does this set of bits represent?
If you mostly want to think of a pixel as some combination of red, green, blue, and maybe alpha intensities, this is all pretty straightforward, and in many cases, is enough information to build a perfectly fine game.
However, the actual definition of a pixel is more complex than that:
Pixels are a representation of a color in a particular color space.
The first characteristic of a color space is the color type. SDL understands two different color types, RGB and YCbCr, or in SDL also referred to as YUV.
RGB colors consist of red, green, and blue channels of color that are added together to represent the colors we see on the screen.
https://en.wikipedia.org/wiki/RGB_color_model
YCbCr colors represent colors as a Y luma brightness component and red and blue chroma color offsets. This color representation takes advantage of the fact that the human eye is more sensitive to brightness than the color in an image. The Cb and Cr components are often compressed and have lower resolution than the luma component.
https://en.wikipedia.org/wiki/YCbCr
When the color information in YCbCr is compressed, the Y pixels are left at full resolution and each Cr and Cb pixel represents an average of the color information in a block of Y pixels. The chroma location determines where in that block of pixels the color information is coming from.
The color range defines how much of the pixel to use when converting a pixel into a color on the display. When the full color range is used, the entire numeric range of the pixel bits is significant. When narrow color range is used, for historical reasons, the pixel uses only a portion of the numeric range to represent colors.
The color primaries and white point are a definition of the colors in the color space relative to the standard XYZ color space.
https://en.wikipedia.org/wiki/CIE_1931_color_space
The transfer characteristic, or opto-electrical transfer function (OETF), is the way a color is converted from mathematically linear space into a non-linear output signals.
https://en.wikipedia.org/wiki/Rec._709#Transfer_characteristics
The matrix coefficients are used to convert between YCbCr and RGB colors.
#define SDL_ALPHA_OPAQUE 255 |
#define SDL_ALPHA_OPAQUE_FLOAT 1.0f |
#define SDL_ALPHA_TRANSPARENT 0 |
#define SDL_ALPHA_TRANSPARENT_FLOAT 0.0f |
#define SDL_DEFINE_PIXELFOURCC | ( | A, | |
B, | |||
C, | |||
D | |||
) | SDL_FOURCC(A, B, C, D) |
For example, defining PIXELFORMAT_YV12 looks like this:
A | the first character of the FourCC code. |
B | the second character of the FourCC code. |
C | the third character of the FourCC code. |
D | the fourth character of the FourCC code. |
#define SDL_PIXELFLAG | ( | format | ) | (((format) >> 28) & 0x0F) |
This macro is generally not needed directly by an app, which should use specific tests, like SDL_ISPIXELFORMAT_FOURCC, instead.
format | an PixelFormat to check. |
format
.using SDL::ArrayOrder = typedef SDL_ArrayOrder |
using SDL::BitmapOrder = typedef SDL_BitmapOrder |
using SDL::ChromaLocation = typedef SDL_ChromaLocation |
using SDL::ColorPrimaries = typedef SDL_ColorPrimaries |
using SDL::ColorRange = typedef SDL_ColorRange |
using SDL::ColorType = typedef SDL_ColorType |
using SDL::MatrixCoefficients = typedef SDL_MatrixCoefficients |
These are as described by https://www.itu.int/rec/T-REC-H.273-201612-S/en
using SDL::PackedLayout = typedef SDL_PackedLayout |
using SDL::PackedOrder = typedef SDL_PackedOrder |
using SDL::PixelFormatDetails = typedef SDL_PixelFormatDetails |
using SDL::PixelType = typedef SDL_PixelType |
using SDL::TransferCharacteristics = typedef SDL_TransferCharacteristics |
These are as described by https://www.itu.int/rec/T-REC-H.273-201612-S/en
|
inline |
This function uses the entire 8-bit [0..255] range when converting color components from pixel formats with less than 8-bits per RGB component (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).
pixel | a pixel value. |
format | a reference to PixelFormatDetails describing the pixel format. |
palette | an optional palette for indexed formats, may be nullptr. |
r | a pointer filled in with the red component, may be nullptr. |
g | a pointer filled in with the green component, may be nullptr. |
b | a pointer filled in with the blue component, may be nullptr. |
|
inline |
This function uses the entire 8-bit [0..255] range when converting color components from pixel formats with less than 8-bits per RGB component (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).
If the surface has no alpha component, the alpha will be returned as 0xff (100% opaque).
pixel | a pixel value. |
format | a reference to PixelFormatDetails describing the pixel format. |
palette | an optional palette for indexed formats, may be nullptr. |
r | a pointer filled in with the red component, may be nullptr. |
g | a pointer filled in with the green component, may be nullptr. |
b | a pointer filled in with the blue component, may be nullptr. |
a | a pointer filled in with the alpha component, may be nullptr. |
|
inline |
This function maps the RGB color value to the specified pixel format and returns the pixel value best approximating the given RGB color value for the given pixel format.
If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned.
If the specified pixel format has an alpha component it will be returned as all 1 bits (fully opaque).
If the pixel format bpp (color depth) is less than 32-bpp then the unused upper bits of the return value can safely be ignored (e.g., with a 16-bpp format the return value can be assigned to a Uint16, and similarly a Uint8 for an 8-bpp format).
format | a reference to PixelFormatDetails describing the pixel format. |
palette | an optional palette for indexed formats, may be nullptr. |
r | the red component of the pixel in the range 0-255. |
g | the green component of the pixel in the range 0-255. |
b | the blue component of the pixel in the range 0-255. |
|
inline |
This function maps the RGBA color value to the specified pixel format and returns the pixel value best approximating the given RGBA color value for the given pixel format.
If the specified pixel format has no alpha component the alpha value will be ignored (as it will be in formats with a palette).
If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned.
If the pixel format bpp (color depth) is less than 32-bpp then the unused upper bits of the return value can safely be ignored (e.g., with a 16-bpp format the return value can be assigned to a Uint16, and similarly a Uint8 for an 8-bpp format).
format | a reference to PixelFormatDetails describing the pixel format. |
palette | an optional palette for indexed formats, may be nullptr. |
r | the red component of the pixel in the range 0-255. |
g | the green component of the pixel in the range 0-255. |
b | the blue component of the pixel in the range 0-255. |
a | the alpha component of the pixel in the range 0-255. |
|
constexpr |
In other words, they are offset one-half pixel to the right and one-half pixel down compared to the top-left pixel.
|
constexpr |
In other words, they have the same horizontal location as the top-left pixel, but is shifted one-half pixel down vertically.
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
0-255 for 8-bit RGB and luma, and 1-255 for 8-bit chroma
|
constexpr |
16-235 for 8-bit RGB and luma, and 16-240 for 8-bit chroma
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |