|
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... | |
| class | SDL::PaletteIndex |
| Auxiliary class for Palette to provide access to specific palette index. More... | |
| struct | SDL::Palette |
| A set of indexed colors representing a palette. More... | |
Typedefs | |
| using | SDL::PixelFormatRaw = SDL_PixelFormat |
| Alias to raw representation for PixelFormat. | |
| using | SDL::ColorspaceRaw = SDL_Colorspace |
| Alias to raw representation for Colorspace. | |
| using | SDL::ColorRaw = SDL_Color |
| Alias to raw representation for Color. | |
| using | SDL::FColorRaw = SDL_FColor |
| Alias to raw representation for FColor. | |
| using | SDL::PaletteRaw = SDL_Palette* |
| Alias to raw representation for Palette. | |
| using | SDL::PaletteRawConst = const SDL_Palette* |
| Alias to const raw representation for Palette. | |
| using | SDL::PaletteRef = ResourceRef<Palette> |
| Reference for Palette. | |
| using | SDL::PaletteConstRef = ResourceConstRef<PaletteRaw, PaletteRawConst> |
| Safely wrap Palette for non owning const parameters. | |
| using | SDL::PixelFormatDetails = SDL_PixelFormatDetails |
| Details about the format of a pixel. | |
Functions | |
| constexpr Uint32 | SDL::DefinePixelFourCC (Uint8 A, Uint8 B, Uint8 C, Uint8 D) |
| A function for defining custom FourCC pixel formats. | |
| constexpr PixelFormat | SDL::DefinePixelFormat (PixelType type, int order, PackedLayout layout, int bits, int bytes) |
| A macro for defining custom non-FourCC pixel formats. | |
| constexpr Uint8 | SDL::PixelFormatFlags (PixelFormatRaw format) |
| Retrieve the flags of an PixelFormat. | |
| constexpr PixelType | SDL::PixelFormatType (PixelFormatRaw format) |
| A macro to retrieve the type of an PixelFormat. | |
| constexpr int | SDL::PixelFormatOrder (PixelFormatRaw format) |
| A macro to retrieve the order of an PixelFormat. | |
| constexpr PackedLayout | SDL::PixelFormatLayout (PixelFormatRaw format) |
| A macro to retrieve the layout of an PixelFormat. | |
| constexpr int | SDL::PixelFormatBitsPerPixel (PixelFormatRaw format) |
| A macro to determine an PixelFormat's bits per pixel. | |
| constexpr int | SDL::PixelFormatBytesPerPixel (PixelFormatRaw format) |
| A macro to determine an PixelFormat's bytes per pixel. | |
| constexpr bool | SDL::IsPixelFormatIndexed (PixelFormatRaw format) |
| A macro to determine if an PixelFormat is an indexed format. | |
| constexpr bool | SDL::IsPixelFormatPacked (PixelFormatRaw format) |
| A macro to determine if an PixelFormat is a packed format. | |
| constexpr bool | SDL::IsPixelFormatArray (PixelFormatRaw format) |
| A macro to determine if an PixelFormat is an array format. | |
| constexpr bool | SDL::IsPixelFormat10Bit (PixelFormatRaw format) |
| A macro to determine if an PixelFormat is a 10-bit format. | |
| constexpr bool | SDL::IsPixelFormatFloat (PixelFormatRaw format) |
| A macro to determine if an PixelFormat is a floating point format. | |
| constexpr Colorspace | SDL::DefineColorspace (ColorType type, ColorRange range, ColorPrimaries primaries, TransferCharacteristics transfer, MatrixCoefficients matrix, ChromaLocation chroma) |
| A macro for defining custom Colorspace formats. | |
| constexpr ColorType | SDL::ColorspaceType (ColorspaceRaw cspace) |
| A macro to retrieve the type of an Colorspace. | |
| constexpr ColorRange | SDL::ColorspaceRange (ColorspaceRaw cspace) |
| A macro to retrieve the range of an Colorspace. | |
| constexpr ChromaLocation | SDL::ColorspaceChroma (ColorspaceRaw cspace) |
| A macro to retrieve the chroma sample location of an Colorspace. | |
| constexpr ColorPrimaries | SDL::ColorspacePrimaries (ColorspaceRaw cspace) |
| A macro to retrieve the primaries of an Colorspace. | |
| constexpr TransferCharacteristics | SDL::ColorspaceTransfer (ColorspaceRaw cspace) |
| A macro to retrieve the transfer characteristics of an Colorspace. | |
| constexpr MatrixCoefficients | SDL::ColorspaceMatrix (ColorspaceRaw cspace) |
| A macro to retrieve the matrix coefficients of an Colorspace. | |
| constexpr bool | SDL::IsColorspaceMatrixBT601 (ColorspaceRaw cspace) |
| A macro to determine if an Colorspace uses BT601 (or BT470BG) matrix coefficients. | |
| constexpr bool | SDL::IsColorspaceMatrixBT709 (ColorspaceRaw cspace) |
| A macro to determine if an Colorspace uses BT709 matrix coefficients. | |
| constexpr bool | SDL::IsColorspaceMatrixBT2020_NCL (ColorspaceRaw cspace) |
| Determine if an Colorspace uses BT2020_NCL matrix coefficients. | |
| constexpr bool | SDL::IsColorspaceLimitedRange (ColorspaceRaw cspace) |
| A macro to determine if an Colorspace has a limited range. | |
| constexpr bool | SDL::IsColorspaceFullRange (ColorspaceRaw cspace) |
| A macro to determine if an Colorspace has a full range. | |
| constexpr bool | SDL::operator== (ColorRaw lhs, ColorRaw rhs) noexcept |
| Comparison operator for Color. | |
| constexpr bool | SDL::operator== (const FColorRaw &lhs, const FColorRaw &rhs) noexcept |
| Comparison operator for FColor. | |
| constexpr auto | SDL::operator<=> (ColorRaw lhs, ColorRaw rhs) noexcept |
| Spaceship operator for Color. | |
| constexpr auto | SDL::operator<=> (const FColorRaw &lhs, const FColorRaw &rhs) noexcept |
| Spaceship operator for FColor. | |
| const char * | SDL::GetPixelFormatName (PixelFormatRaw format) |
| Get the human readable name of a pixel format. | |
| void | SDL::GetMasksForPixelFormat (PixelFormatRaw format, int *bpp, Uint32 *Rmask, Uint32 *Gmask, Uint32 *Bmask, Uint32 *Amask) |
| Convert one of the enumerated pixel formats to a bpp value and RGBA masks. | |
| PixelFormat | SDL::GetPixelFormatForMasks (int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) |
| Convert a bpp value and RGBA masks to an enumerated pixel format. | |
| const PixelFormatDetails & | SDL::GetPixelFormatDetails (PixelFormatRaw format) |
| Create an PixelFormatDetails structure corresponding to a pixel format. | |
| Palette | SDL::CreatePalette (int ncolors) |
| Create a palette structure with the specified number of color entries. | |
| void | SDL::SetPaletteColors (PaletteRef palette, SpanRef< const ColorRaw > colors, int firstcolor=0) |
| Set a range of colors in a palette. | |
| void | SDL::DestroyPalette (PaletteRaw palette) |
| Free a palette created with CreatePalette(). | |
| Uint32 | SDL::MapRGB (const PixelFormatDetails &format, PaletteConstRef 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, Uint8 r, Uint8 g, Uint8 b, Uint8 a, PaletteConstRef palette={}) |
| Map an RGBA quadruple to a pixel value for a given pixel format. | |
| Uint32 | SDL::MapColor (const PixelFormatDetails &format, ColorRaw c, PaletteConstRef palette={}) |
| Map an RGBA quadruple to a pixel value for a given pixel format. | |
| void | SDL::GetRGB (Uint32 pixelvalue, const PixelFormatDetails &format, PaletteConstRef palette, Uint8 *r, Uint8 *g, Uint8 *b) |
| Get RGB values from a pixel in the specified format. | |
| void | SDL::GetRGBA (Uint32 pixelvalue, const PixelFormatDetails &format, PaletteConstRef palette, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a) |
| Get RGBA values from a pixel in the specified format. | |
| Color | SDL::GetColor (Uint32 pixel, const PixelFormatDetails &format, PaletteConstRef palette={}) |
| Get RGBA values from a pixel in the specified format. | |
| constexpr | SDL::PixelFormat::PixelFormat (PixelType type, int order, PackedLayout layout, int bits, int bytes) |
| Defining custom non-FourCC pixel formats. | |
| constexpr Uint8 | SDL::PixelFormat::GetFlags () const |
| Retrieve the flags of an PixelFormat. | |
| constexpr PixelType | SDL::PixelFormat::GetType () const |
| Retrieve the type. | |
| constexpr int | SDL::PixelFormat::GetOrder () const |
| Retrieve the order. | |
| constexpr PackedLayout | SDL::PixelFormat::GetLayout () const |
| Retrieve the layout. | |
| constexpr int | SDL::PixelFormat::GetBitsPerPixel () const |
| Determine this's bits per pixel. | |
| constexpr int | SDL::PixelFormat::GetBytesPerPixel () const |
| Determine this's bytes per pixel. | |
| constexpr bool | SDL::PixelFormat::IsIndexed () const |
| Determine if this is an indexed format. | |
| constexpr bool | SDL::PixelFormat::IsPacked () const |
| Determine if this is a packed format. | |
| constexpr bool | SDL::PixelFormat::IsArray () const |
| Determine if this is an array format. | |
| constexpr bool | SDL::PixelFormat::Is10Bit () const |
| Determine if this is a 10-bit format. | |
| constexpr bool | SDL::PixelFormat::IsFloat () const |
| Determine if this is a floating point format. | |
| constexpr | SDL::Colorspace::Colorspace (ColorType type, ColorRange range, ColorPrimaries primaries, TransferCharacteristics transfer, MatrixCoefficients matrix, ChromaLocation chroma) |
| Define custom Colorspace formats. | |
| constexpr ColorType | SDL::Colorspace::GetType () const |
| Retrieve the type of a Colorspace. | |
| constexpr ColorRange | SDL::Colorspace::GetRange () const |
| Retrieve the range of a Colorspace. | |
| constexpr ChromaLocation | SDL::Colorspace::GetChroma () const |
| Retrieve the chroma sample location of an Colorspace. | |
| constexpr ColorPrimaries | SDL::Colorspace::GetPrimaries () const |
| Retrieve the primaries of an Colorspace. | |
| constexpr TransferCharacteristics | SDL::Colorspace::GetTransfer () const |
| Retrieve the transfer characteristics of an Colorspace. | |
| constexpr MatrixCoefficients | SDL::Colorspace::GetMatrix () const |
| Retrieve the matrix coefficients of an Colorspace. | |
| constexpr bool | SDL::Colorspace::IsMatrixBT601 () const |
| Determine if a Colorspace uses BT601 (or BT470BG) matrix coefficients. | |
| constexpr bool | SDL::Colorspace::IsMatrixBT709 () const |
| Determine if an Colorspace uses BT709 matrix coefficients. | |
| constexpr bool | SDL::Colorspace::IsMatrixBT2020_NCL () const |
| Determine if an Colorspace uses BT2020_NCL matrix coefficients. | |
| constexpr bool | SDL::Colorspace::IsLimitedRange () const |
| A function to determine if an Colorspace has a limited range. | |
| constexpr bool | SDL::Colorspace::IsFullRange () const |
| A function to determine if an Colorspace has a full range. | |
| const char * | SDL::PixelFormat::GetName () const |
| Get the human readable name of a pixel format. | |
| void | SDL::PixelFormat::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. | |
| static PixelFormat | SDL::PixelFormat::ForMasks (int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) |
| Convert a bpp value and RGBA masks to an enumerated pixel format. | |
| const PixelFormatDetails & | SDL::PixelFormat::GetDetails () const |
| Create an PixelFormatDetails structure corresponding to a pixel format. | |
| SDL::PixelFormat::operator const PixelFormatDetails & () const | |
| Same as GetDetails(). | |
| SDL::Palette::Palette (int ncolors) | |
| Create a palette structure with the specified number of color entries. | |
| void | SDL::Palette::SetColors (SpanRef< const ColorRaw > colors, int firstcolor=0) |
| Set a range of colors in a palette. | |
| PaletteIndex & | SDL::PaletteIndex::operator= (ColorRaw color) |
| Assignment operator. | |
| void | SDL::Palette::Destroy () |
| Free a palette created with CreatePalette(). | |
| Uint32 | SDL::Color::Map (const PixelFormatDetails &format, PaletteConstRef palette) const |
| Map an RGBA quadruple to a pixel value for a given pixel format. | |
| Uint32 | SDL::PixelFormat::Map (ColorRaw c, PaletteConstRef palette={}) const |
| Map an RGBA quadruple to a pixel value for a given pixel format. | |
| static Color | SDL::Color::Get (Uint32 pixel, const PixelFormatDetails &format, PaletteConstRef palette={}) |
| Get RGBA values from a pixel in the specified format. | |
| Color | SDL::PixelFormat::Get (Uint32 pixel, PaletteConstRef palette={}) const |
| Get RGBA values from a pixel in the specified format. | |
Variables | |
| constexpr Uint8 | SDL::ALPHA_OPAQUE = SDL_ALPHA_OPAQUE |
| A fully opaque 8-bit alpha value. | |
| constexpr float | SDL::ALPHA_OPAQUE_FLOAT = SDL_ALPHA_OPAQUE_FLOAT |
| A fully opaque floating point alpha value. | |
| constexpr Uint8 | SDL::ALPHA_TRANSPARENT = SDL_ALPHA_TRANSPARENT |
| A fully transparent 8-bit alpha value. | |
| constexpr float | SDL::ALPHA_TRANSPARENT_FLOAT = SDL_ALPHA_TRANSPARENT_FLOAT |
| A fully transparent floating point alpha value. | |
PixelTypes | |
Pixel type. | |
| 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. | |
| constexpr bool | SDL::IsPixelFormatAlpha (PixelFormatRaw format) |
| A macro to determine if an PixelFormat has an alpha channel. | |
| constexpr bool | SDL::IsPixelFormatFourCC (PixelFormatRaw format) |
| A macro to determine if an PixelFormat is a "FourCC" format. | |
| constexpr bool | SDL::PixelFormat::IsAlpha () const |
| Determine if this has an alpha channel. | |
| constexpr bool | SDL::PixelFormat::IsFourCC () const |
| Determine if this is a "FourCC" format. | |
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. 0-255 for 8-bit RGB and luma, and 1-255 for 8-bit chroma. | |
ColorPrimaries | |
| using | SDL::ColorPrimaries = SDL_ColorPrimaries |
| Colorspace color primaries, as described by https://www.itu.int/rec/T-REC-H.273-201612-S/en. | |
| constexpr ColorPrimaries | SDL::COLOR_PRIMARIES_UNKNOWN |
| COLOR_PRIMARIES_UNKNOWN. | |
| constexpr ColorPrimaries | SDL::COLOR_PRIMARIES_BT709 |
| ITU-R BT.709-6. | |
| constexpr ColorPrimaries | SDL::COLOR_PRIMARIES_UNSPECIFIED |
| COLOR_PRIMARIES_UNSPECIFIED. | |
| constexpr ColorPrimaries | SDL::COLOR_PRIMARIES_BT470M |
| ITU-R BT.470-6 System M. | |
| constexpr ColorPrimaries | SDL::COLOR_PRIMARIES_BT470BG |
| ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625. | |
| constexpr ColorPrimaries | SDL::COLOR_PRIMARIES_BT601 |
| ITU-R BT.601-7 525, SMPTE 170M. | |
| constexpr ColorPrimaries | SDL::COLOR_PRIMARIES_SMPTE240 |
| SMPTE 240M, functionally the same as COLOR_PRIMARIES_BT601. | |
| constexpr ColorPrimaries | SDL::COLOR_PRIMARIES_GENERIC_FILM |
| Generic film (color filters using Illuminant C). | |
| constexpr ColorPrimaries | SDL::COLOR_PRIMARIES_BT2020 |
| ITU-R BT.2020-2 / ITU-R BT.2100-0. | |
| constexpr ColorPrimaries | SDL::COLOR_PRIMARIES_XYZ |
| SMPTE ST 428-1. | |
| constexpr ColorPrimaries | SDL::COLOR_PRIMARIES_SMPTE431 |
| SMPTE RP 431-2. | |
| constexpr ColorPrimaries | SDL::COLOR_PRIMARIES_SMPTE432 |
| SMPTE EG 432-1 / DCI P3. | |
| constexpr ColorPrimaries | SDL::COLOR_PRIMARIES_EBU3213 |
| EBU Tech. 3213-E. | |
| constexpr ColorPrimaries | SDL::COLOR_PRIMARIES_CUSTOM |
| COLOR_PRIMARIES_CUSTOM. | |
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 PixelFormat | SDL::PIXELFORMAT_UNKNOWN |
| UNKNOWN. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_INDEX1LSB |
| INDEX1LSB. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_INDEX1MSB |
| INDEX1MSB. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_INDEX2LSB |
| INDEX2LSB. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_INDEX2MSB |
| INDEX2MSB. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_INDEX4LSB |
| INDEX4LSB. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_INDEX4MSB |
| INDEX4MSB. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_INDEX8 = SDL_PIXELFORMAT_INDEX8 |
| INDEX8. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_RGB332 = SDL_PIXELFORMAT_RGB332 |
| RGB332. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_XRGB4444 |
| XRGB4444. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_XBGR4444 |
| XBGR4444. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_XRGB1555 |
| XRGB1555. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_XBGR1555 |
| XBGR1555. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_ARGB4444 |
| ARGB4444. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_RGBA4444 |
| RGBA4444. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_ABGR4444 |
| ABGR4444. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_BGRA4444 |
| BGRA4444. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_ARGB1555 |
| ARGB1555. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_RGBA5551 |
| RGBA5551. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_ABGR1555 |
| ABGR1555. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_BGRA5551 |
| BGRA5551. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_RGB565 = SDL_PIXELFORMAT_RGB565 |
| RGB565. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_BGR565 = SDL_PIXELFORMAT_BGR565 |
| BGR565. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_RGB24 = SDL_PIXELFORMAT_RGB24 |
| RGB24. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_BGR24 = SDL_PIXELFORMAT_BGR24 |
| BGR24. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_XRGB8888 |
| XRGB8888. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_RGBX8888 |
| RGBX8888. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_XBGR8888 |
| XBGR8888. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_BGRX8888 |
| BGRX8888. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_ARGB8888 |
| ARGB8888. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_RGBA8888 |
| RGBA8888. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_ABGR8888 |
| ABGR8888. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_BGRA8888 |
| BGRA8888. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_XRGB2101010 |
| XRGB2101010. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_XBGR2101010 |
| XBGR2101010. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_ARGB2101010 |
| ARGB2101010. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_ABGR2101010 |
| ABGR2101010. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_RGB48 = SDL_PIXELFORMAT_RGB48 |
| RGB48. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_BGR48 = SDL_PIXELFORMAT_BGR48 |
| BGR48. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_RGBA64 = SDL_PIXELFORMAT_RGBA64 |
| RGBA64. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_ARGB64 = SDL_PIXELFORMAT_ARGB64 |
| ARGB64. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_BGRA64 = SDL_PIXELFORMAT_BGRA64 |
| BGRA64. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_ABGR64 = SDL_PIXELFORMAT_ABGR64 |
| ABGR64. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_RGB48_FLOAT |
| RGB48_FLOAT. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_BGR48_FLOAT |
| BGR48_FLOAT. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_RGBA64_FLOAT |
| RGBA64_FLOAT. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_ARGB64_FLOAT |
| ARGB64_FLOAT. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_BGRA64_FLOAT |
| BGRA64_FLOAT. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_ABGR64_FLOAT |
| ABGR64_FLOAT. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_RGB96_FLOAT |
| RGB96_FLOAT. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_BGR96_FLOAT |
| BGR96_FLOAT. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_RGBA128_FLOAT |
| RGBA128_FLOAT. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_ARGB128_FLOAT |
| ARGB128_FLOAT. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_BGRA128_FLOAT |
| BGRA128_FLOAT. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_ABGR128_FLOAT |
| ABGR128_FLOAT. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_YV12 |
| Planar mode: Y + V + U (3 planes). | |
| constexpr PixelFormat | SDL::PIXELFORMAT_IYUV |
| Planar mode: Y + U + V (3 planes). | |
| constexpr PixelFormat | SDL::PIXELFORMAT_YUY2 |
| Packed mode: Y0+U0+Y1+V0 (1 plane). | |
| constexpr PixelFormat | SDL::PIXELFORMAT_UYVY |
| Packed mode: U0+Y0+V0+Y1 (1 plane). | |
| constexpr PixelFormat | SDL::PIXELFORMAT_YVYU |
| Packed mode: Y0+V0+Y1+U0 (1 plane). | |
| constexpr PixelFormat | SDL::PIXELFORMAT_NV12 |
| Planar mode: Y + U/V interleaved (2 planes). | |
| constexpr PixelFormat | SDL::PIXELFORMAT_NV21 |
| Planar mode: Y + V/U interleaved (2 planes). | |
| constexpr PixelFormat | SDL::PIXELFORMAT_P010 |
| Planar mode: Y + U/V interleaved (2 planes). | |
| constexpr PixelFormat | SDL::PIXELFORMAT_EXTERNAL_OES |
| Android video texture format. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_MJPG = SDL_PIXELFORMAT_MJPG |
| Motion JPEG. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_RGBA32 |
| RGBA32. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_ARGB32 |
| ARGB32. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_BGRA32 |
| BGRA32. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_ABGR32 |
| ABGR32. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_RGBX32 = SDL_PIXELFORMAT_RGBX32 |
| RGBX32. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_XRGB32 = SDL_PIXELFORMAT_XRGB32 |
| XRGB32. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_BGRX32 = SDL_PIXELFORMAT_BGRX32 |
| BGRX32. | |
| constexpr PixelFormat | SDL::PIXELFORMAT_XBGR32 = SDL_PIXELFORMAT_XBGR32 |
| XBGR32. | |
Colorspaces | |
| constexpr Colorspace | SDL::COLORSPACE_UNKNOWN = SDL_COLORSPACE_UNKNOWN |
| UNKNOWN. | |
| constexpr Colorspace | SDL::COLORSPACE_SRGB = SDL_COLORSPACE_SRGB |
| Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709. | |
| constexpr Colorspace | SDL::COLORSPACE_SRGB_LINEAR = SDL_COLORSPACE_SRGB_LINEAR |
| Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709. | |
| constexpr Colorspace | SDL::COLORSPACE_HDR10 = SDL_COLORSPACE_HDR10 |
| Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020. | |
| constexpr Colorspace | SDL::COLORSPACE_JPEG = SDL_COLORSPACE_JPEG |
| Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601. | |
| constexpr Colorspace | SDL::COLORSPACE_BT601_LIMITED = SDL_COLORSPACE_BT601_LIMITED |
| Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601. | |
| constexpr Colorspace | SDL::COLORSPACE_BT601_FULL = SDL_COLORSPACE_BT601_FULL |
| Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601. | |
| constexpr Colorspace | SDL::COLORSPACE_BT709_LIMITED = SDL_COLORSPACE_BT709_LIMITED |
| Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709. | |
| constexpr Colorspace | SDL::COLORSPACE_BT709_FULL = SDL_COLORSPACE_BT709_FULL |
| Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709. | |
| constexpr Colorspace | SDL::COLORSPACE_BT2020_LIMITED = SDL_COLORSPACE_BT2020_LIMITED |
| Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020. | |
| constexpr Colorspace | SDL::COLORSPACE_BT2020_FULL = SDL_COLORSPACE_BT2020_FULL |
| Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020. | |
| constexpr Colorspace | SDL::COLORSPACE_RGB_DEFAULT = SDL_COLORSPACE_RGB_DEFAULT |
| The default colorspace for RGB surfaces if no colorspace is specified. | |
| constexpr Colorspace | SDL::COLORSPACE_YUV_DEFAULT = SDL_COLORSPACE_YUV_DEFAULT |
| The default colorspace for YUV surfaces if no colorspace is specified. | |
SDL offers facilities for pixel management.
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.
| using SDL::ArrayOrder = SDL_ArrayOrder |
Array component order, low byte -> high byte.
| using SDL::BitmapOrder = SDL_BitmapOrder |
Bitmap pixel order, high bit -> low bit.
| using SDL::ChromaLocation = SDL_ChromaLocation |
Colorspace chroma sample location.
| using SDL::ColorPrimaries = SDL_ColorPrimaries |
Colorspace color primaries, as described by https://www.itu.int/rec/T-REC-H.273-201612-S/en.
| using SDL::ColorRange = SDL_ColorRange |
Colorspace color range, as described by https://www.itu.int/rec/R-REC-BT.2100-2-201807-I/en.
| using SDL::ColorType = SDL_ColorType |
Colorspace color type.
| using SDL::MatrixCoefficients = SDL_MatrixCoefficients |
Colorspace matrix coefficients.
These are as described by https://www.itu.int/rec/T-REC-H.273-201612-S/en
| using SDL::PackedLayout = SDL_PackedLayout |
Packed component layout.
| using SDL::PackedOrder = SDL_PackedOrder |
Packed component order, high bit -> low bit.
| using SDL::PaletteRef = ResourceRef<Palette> |
Reference for Palette.
This does not take ownership!
| using SDL::PixelFormatDetails = SDL_PixelFormatDetails |
Details about the format of a pixel.
| using SDL::PixelType = SDL_PixelType |
Pixel type.
| using SDL::TransferCharacteristics = SDL_TransferCharacteristics |
Colorspace transfer characteristics.
These are as described by https://www.itu.int/rec/T-REC-H.273-201612-S/en
|
constexpr |
Define custom Colorspace formats.
For example, defining COLORSPACE_SRGB looks like this:
| type | the type of the new format, probably an ColorType value. |
| range | the range of the new format, probably a ColorRange value. |
| primaries | the primaries of the new format, probably an ColorPrimaries value. |
| transfer | the transfer characteristics of the new format, probably an TransferCharacteristics value. |
| matrix | the matrix coefficients of the new format, probably an MatrixCoefficients value. |
| chroma | the chroma sample location of the new format, probably an ChromaLocation value. |
|
constexpr |
A macro to retrieve the chroma sample location of an Colorspace.
| cspace | an Colorspace to check. |
|
constexpr |
A macro to retrieve the matrix coefficients of an Colorspace.
| cspace | an Colorspace to check. |
|
constexpr |
A macro to retrieve the primaries of an Colorspace.
| cspace | an Colorspace to check. |
|
constexpr |
A macro to retrieve the range of an Colorspace.
| cspace | an Colorspace to check. |
|
constexpr |
A macro to retrieve the transfer characteristics of an Colorspace.
| cspace | an Colorspace to check. |
|
constexpr |
A macro to retrieve the type of an Colorspace.
| cspace | an Colorspace to check. |
|
inline |
Create a palette structure with the specified number of color entries.
The palette entries are initialized to white.
| ncolors | represents the number of color entries in the color palette. |
| Error | on failure. |
|
constexpr |
A macro for defining custom Colorspace formats.
For example, defining COLORSPACE_SRGB looks like this:
| type | the type of the new format, probably an ColorType value. |
| range | the range of the new format, probably a ColorRange value. |
| primaries | the primaries of the new format, probably an ColorPrimaries value. |
| transfer | the transfer characteristics of the new format, probably an TransferCharacteristics value. |
| matrix | the matrix coefficients of the new format, probably an MatrixCoefficients value. |
| chroma | the chroma sample location of the new format, probably an ChromaLocation value. |
|
constexpr |
A macro for defining custom non-FourCC pixel formats.
For example, defining PIXELFORMAT_RGBA8888 looks like this:
| type | the type of the new format, probably a PixelType value. |
| order | the order of the new format, probably a BitmapOrder, PackedOrder, or ArrayOrder value. |
| layout | the layout of the new format, probably an PackedLayout value or zero. |
| bits | the number of bits per pixel of the new format. |
| bytes | the number of bytes per pixel of the new format. |
A function for defining custom FourCC pixel formats.
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. |
|
inline |
Free a palette created with CreatePalette().
|
inline |
Free a palette created with CreatePalette().
| palette | the Palette structure to be freed. |
|
inlinestatic |
Convert a bpp value and RGBA masks to an enumerated pixel format.
This will return PIXELFORMAT_UNKNOWN if the conversion wasn't possible.
| bpp | a bits per pixel value; usually 15, 16, or 32. |
| Rmask | the red mask for the format. |
| Gmask | the green mask for the format. |
| Bmask | the blue mask for the format. |
| Amask | the alpha mask for the format. |
|
inlinestatic |
Get RGBA values from a pixel in the specified format.
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 pointer to PixelFormatDetails describing the pixel format. |
| palette | an optional palette for indexed formats, may be NULL. |
|
inline |
Get RGBA values from a pixel in the specified format.
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. |
| palette | an optional palette for indexed formats, may be NULL. |
|
constexpr |
Determine this's bits per pixel.
FourCC formats will report zero here, as it rarely makes sense to measure them per-pixel.
|
constexpr |
Determine this's bytes per pixel.
Note that this macro double-evaluates its parameter, so do not use expressions with side-effects here.
FourCC formats do their best here, but many of them don't have a meaningful measurement of bytes per pixel.
|
constexpr |
Retrieve the chroma sample location of an Colorspace.
|
inline |
Get RGBA values from a pixel in the specified format.
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 pointer to PixelFormatDetails describing the pixel format. |
| palette | an optional palette for indexed formats, may be nullptr. |
|
inline |
Create an PixelFormatDetails structure corresponding to a pixel format.
Returned structure may come from a shared global cache (i.e. not newly allocated), and hence should not be modified, especially the palette. Weird errors such as Blit combination not supported may occur.
| Error | on failure. |
|
constexpr |
Retrieve the flags of an PixelFormat.
This function is generally not needed directly by an app, which should use specific tests, like PixelFormat.IsFourCC, instead.
|
constexpr |
Retrieve the layout.
This is usually a value from the PackedLayout enumeration, or zero if a layout doesn't make sense for the format type.
|
inline |
Convert one of the enumerated pixel formats to a bpp value and RGBA masks.
| bpp | a bits per pixel value; usually 15, 16, or 32. |
| Rmask | a pointer filled in with the red mask for the format. |
| Gmask | a pointer filled in with the green mask for the format. |
| Bmask | a pointer filled in with the blue mask for the format. |
| Amask | a pointer filled in with the alpha mask for the format. |
| Error | on failure. |
|
inline |
Convert one of the enumerated pixel formats to a bpp value and RGBA masks.
| format | one of the PixelFormat values. |
| bpp | a bits per pixel value; usually 15, 16, or 32. |
| Rmask | a pointer filled in with the red mask for the format. |
| Gmask | a pointer filled in with the green mask for the format. |
| Bmask | a pointer filled in with the blue mask for the format. |
| Amask | a pointer filled in with the alpha mask for the format. |
| Error | on failure. |
|
constexpr |
Retrieve the matrix coefficients of an Colorspace.
|
inline |
Get the human readable name of a pixel format.
|
constexpr |
Retrieve the order.
This is usually a value from the BitmapOrder, PackedOrder, or ArrayOrder enumerations, depending on the format type.
|
inline |
Create an PixelFormatDetails structure corresponding to a pixel format.
Returned structure may come from a shared global cache (i.e. not newly allocated), and hence should not be modified, especially the palette. Weird errors such as Blit combination not supported may occur.
| format | one of the PixelFormat values. |
| Error | on failure. |
|
inline |
Convert a bpp value and RGBA masks to an enumerated pixel format.
This will return PIXELFORMAT_UNKNOWN if the conversion wasn't possible.
| bpp | a bits per pixel value; usually 15, 16, or 32. |
| Rmask | the red mask for the format. |
| Gmask | the green mask for the format. |
| Bmask | the blue mask for the format. |
| Amask | the alpha mask for the format. |
|
inline |
Get the human readable name of a pixel format.
| format | the pixel format to query. |
|
constexpr |
Retrieve the primaries of an Colorspace.
|
constexpr |
Retrieve the range of a Colorspace.
|
inline |
Get RGB values from a pixel in the specified format.
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]).
| pixelvalue | a pixel value. |
| format | a pointer 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 |
Get RGBA values from a pixel in the specified format.
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).
| pixelvalue | a pixel value. |
| format | a pointer 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. |
|
constexpr |
Retrieve the transfer characteristics of an Colorspace.
|
constexpr |
Retrieve the type of a Colorspace.
|
constexpr |
|
constexpr |
Determine if this is a 10-bit format.
|
constexpr |
Determine if this has an alpha channel.
|
constexpr |
Determine if this is an array format.
|
constexpr |
A macro to determine if an Colorspace has a full range.
| cspace | an Colorspace to check. |
|
constexpr |
A macro to determine if an Colorspace has a limited range.
| cspace | an Colorspace to check. |
|
constexpr |
Determine if an Colorspace uses BT2020_NCL matrix coefficients.
| cspace | an Colorspace to check. |
|
constexpr |
A macro to determine if an Colorspace uses BT601 (or BT470BG) matrix coefficients.
Note that this macro double-evaluates its parameter, so do not use expressions with side-effects here.
| cspace | an Colorspace to check. |
|
constexpr |
A macro to determine if an Colorspace uses BT709 matrix coefficients.
| cspace | an Colorspace to check. |
|
constexpr |
Determine if this is a floating point format.
|
constexpr |
Determine if this is a "FourCC" format.
This covers custom and other unusual formats.
|
constexpr |
A function to determine if an Colorspace has a full range.
|
constexpr |
Determine if this is an indexed format.
|
constexpr |
A function to determine if an Colorspace has a limited range.
|
constexpr |
Determine if an Colorspace uses BT2020_NCL matrix coefficients.
|
constexpr |
Determine if a Colorspace uses BT601 (or BT470BG) matrix coefficients.
|
constexpr |
Determine if an Colorspace uses BT709 matrix coefficients.
|
constexpr |
Determine if this is a packed format.
|
constexpr |
A macro to determine if an PixelFormat is a 10-bit format.
Note that this macro double-evaluates its parameter, so do not use expressions with side-effects here.
| format | an PixelFormat to check. |
|
constexpr |
A macro to determine if an PixelFormat has an alpha channel.
Note that this macro double-evaluates its parameter, so do not use expressions with side-effects here.
| format | an PixelFormat to check. |
|
constexpr |
A macro to determine if an PixelFormat is an array format.
Note that this macro double-evaluates its parameter, so do not use expressions with side-effects here.
| format | an PixelFormat to check. |
|
constexpr |
A macro to determine if an PixelFormat is a floating point format.
Note that this macro double-evaluates its parameter, so do not use expressions with side-effects here.
| format | an PixelFormat to check. |
|
constexpr |
A macro to determine if an PixelFormat is a "FourCC" format.
This covers custom and other unusual formats.
Note that this macro double-evaluates its parameter, so do not use expressions with side-effects here.
| format | an PixelFormat to check. |
|
constexpr |
A macro to determine if an PixelFormat is an indexed format.
Note that this macro double-evaluates its parameter, so do not use expressions with side-effects here.
| format | an PixelFormat to check. |
|
constexpr |
A macro to determine if an PixelFormat is a packed format.
Note that this macro double-evaluates its parameter, so do not use expressions with side-effects here.
| format | an PixelFormat to check. |
|
inline |
Map an RGBA quadruple to a pixel value for a given pixel format.
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 pointer to PixelFormatDetails describing the pixel format. |
| palette | an optional palette for indexed formats, may be NULL. |
|
inline |
Map an RGBA quadruple to a pixel value for a given pixel format.
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).
| c | the color components of the pixel in the range 0-255. |
| palette | an optional palette for indexed formats, may be NULL. |
|
inline |
Map an RGBA quadruple to a pixel value for a given pixel format.
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 pointer to PixelFormatDetails describing the pixel format. |
| c | the color components of the pixel in the range 0-255. |
| palette | an optional palette for indexed formats, may be nullptr. |
|
inline |
Map an RGB triple to an opaque pixel value for a given pixel format.
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 pointer 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 |
Map an RGBA quadruple to a pixel value for a given pixel format.
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 pointer to PixelFormatDetails describing the pixel format. |
| 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. |
| palette | an optional palette for indexed formats, may be nullptr. |
|
inline |
Create a palette structure with the specified number of color entries.
The palette entries are initialized to white.
| ncolors | represents the number of color entries in the color palette. |
| Error | on failure. |
|
constexpr |
Defining custom non-FourCC pixel formats.
For example, defining PIXELFORMAT_RGBA8888 looks like this:
| type | the type of the new format, probably a PixelType value. |
| order | the order of the new format, probably a BitmapOrder, PackedOrder, or ArrayOrder value. |
| layout | the layout of the new format, probably an PackedLayout value or zero. |
| bits | the number of bits per pixel of the new format. |
| bytes | the number of bytes per pixel of the new format. |
|
constexpr |
A macro to determine an PixelFormat's bits per pixel.
Note that this macro double-evaluates its parameter, so do not use expressions with side-effects here.
FourCC formats will report zero here, as it rarely makes sense to measure them per-pixel.
| format | an PixelFormat to check. |
|
constexpr |
A macro to determine an PixelFormat's bytes per pixel.
Note that this macro double-evaluates its parameter, so do not use expressions with side-effects here.
FourCC formats do their best here, but many of them don't have a meaningful measurement of bytes per pixel.
| format | an PixelFormat to check. |
|
constexpr |
Retrieve the flags of an PixelFormat.
This function is generally not needed directly by an app, which should use specific tests, like PixelFormat.IsFourCC, instead.
| format | an PixelFormat to check. |
|
constexpr |
A macro to retrieve the layout of an PixelFormat.
This is usually a value from the PackedLayout enumeration, or zero if a layout doesn't make sense for the format type.
| format | an PixelFormat to check. |
|
constexpr |
A macro to retrieve the order of an PixelFormat.
This is usually a value from the BitmapOrder, PackedOrder, or ArrayOrder enumerations, depending on the format type.
| format | an PixelFormat to check. |
|
constexpr |
A macro to retrieve the type of an PixelFormat.
This is usually a value from the PixelType enumeration.
| format | an PixelFormat to check. |
Set a range of colors in a palette.
| colors | an array of Color structures to copy into the palette. |
| firstcolor | the index of the first palette entry to modify. |
| Error | on failure. |
|
inline |
Set a range of colors in a palette.
| palette | the Palette structure to modify. |
| colors | an array of Color structures to copy into the palette. |
| firstcolor | the index of the first palette entry to modify. |
| Error | on failure. |
|
constexpr |
A fully opaque 8-bit alpha value.
|
constexpr |
A fully opaque floating point alpha value.
|
constexpr |
A fully transparent 8-bit alpha value.
|
constexpr |
A fully transparent floating point alpha value.
|
constexpr |
In JPEG/JFIF, H.261, and MPEG-1, Cb and Cr are taken at the center of the 2x2 square.
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 MPEG-2, MPEG-4, and AVC, Cb and Cr are taken on midpoint of the left-edge of the 2x2 square.
In other words, they have the same horizontal location as the top-left pixel, but is shifted one-half pixel down vertically.
|
constexpr |
RGB, no chroma sampling.
|
constexpr |
ITU-R BT.2020-2 / ITU-R BT.2100-0.
|
constexpr |
ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625.
|
constexpr |
ITU-R BT.470-6 System M.
|
constexpr |
ITU-R BT.601-7 525, SMPTE 170M.
|
constexpr |
ITU-R BT.709-6.
|
constexpr |
COLOR_PRIMARIES_CUSTOM.
|
constexpr |
EBU Tech. 3213-E.
|
constexpr |
Generic film (color filters using Illuminant C).
|
constexpr |
SMPTE 240M, functionally the same as COLOR_PRIMARIES_BT601.
|
constexpr |
SMPTE RP 431-2.
|
constexpr |
SMPTE EG 432-1 / DCI P3.
|
constexpr |
COLOR_PRIMARIES_UNKNOWN.
|
constexpr |
COLOR_PRIMARIES_UNSPECIFIED.
|
constexpr |
SMPTE ST 428-1.
|
constexpr |
Narrow range, e.g.
16-235 for 8-bit RGB and luma, and 16-240 for 8-bit chroma
|
constexpr |
COLOR_RANGE_UNKNOWN.
|
constexpr |
COLOR_TYPE_UNKNOWN.
|
constexpr |
COLOR_TYPE_YCBCR.
|
constexpr |
ITU-R BT.2020-2 constant luminance.
|
constexpr |
ITU-R BT.2020-2 non-constant luminance.
|
constexpr |
ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625, functionally the same as MATRIX_COEFFICIENTS_BT601.
|
constexpr |
ITU-R BT.601-7 525.
|
constexpr |
ITU-R BT.709-6.
|
constexpr |
MATRIX_COEFFICIENTS_CHROMA_DERIVED_CL.
|
constexpr |
MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL.
|
constexpr |
MATRIX_COEFFICIENTS_CUSTOM.
|
constexpr |
US FCC Title 47.
|
constexpr |
ITU-R BT.2100-0 ICTCP.
|
constexpr |
MATRIX_COEFFICIENTS_IDENTITY.
|
constexpr |
SMPTE ST 2085.
|
constexpr |
SMPTE 240M.
|
constexpr |
MATRIX_COEFFICIENTS_UNSPECIFIED.
|
constexpr |
MATRIX_COEFFICIENTS_YCGCO.
|
constexpr |
1010102
|
constexpr |
2101010
|
constexpr |
ABGR128_FLOAT.
|
constexpr |
ABGR1555.
|
constexpr |
ABGR2101010.
|
constexpr |
ABGR4444.
|
constexpr |
ABGR64_FLOAT.
|
constexpr |
ABGR8888.
|
constexpr |
ARGB128_FLOAT.
|
constexpr |
ARGB1555.
|
constexpr |
ARGB2101010.
|
constexpr |
ARGB4444.
|
constexpr |
ARGB64_FLOAT.
|
constexpr |
ARGB8888.
|
constexpr |
BGR48_FLOAT.
|
constexpr |
BGR96_FLOAT.
|
constexpr |
BGRA128_FLOAT.
|
constexpr |
BGRA4444.
|
constexpr |
BGRA5551.
|
constexpr |
BGRA64_FLOAT.
|
constexpr |
BGRA8888.
|
constexpr |
BGRX8888.
|
constexpr |
Android video texture format.
|
constexpr |
INDEX1LSB.
|
constexpr |
INDEX1MSB.
|
constexpr |
INDEX2LSB.
|
constexpr |
INDEX2MSB.
|
constexpr |
INDEX4LSB.
|
constexpr |
INDEX4MSB.
|
constexpr |
Planar mode: Y + U + V (3 planes).
|
constexpr |
Planar mode: Y + U/V interleaved (2 planes).
|
constexpr |
Planar mode: Y + V/U interleaved (2 planes).
|
constexpr |
Planar mode: Y + U/V interleaved (2 planes).
|
constexpr |
RGB48_FLOAT.
|
constexpr |
RGB96_FLOAT.
|
constexpr |
RGBA128_FLOAT.
|
constexpr |
RGBA4444.
|
constexpr |
RGBA5551.
|
constexpr |
RGBA64_FLOAT.
|
constexpr |
RGBA8888.
|
constexpr |
RGBX8888.
|
constexpr |
UNKNOWN.
|
constexpr |
Packed mode: U0+Y0+V0+Y1 (1 plane).
|
constexpr |
XBGR1555.
|
constexpr |
XBGR2101010.
|
constexpr |
XBGR4444.
|
constexpr |
XBGR8888.
|
constexpr |
XRGB1555.
|
constexpr |
XRGB2101010.
|
constexpr |
XRGB4444.
|
constexpr |
XRGB8888.
|
constexpr |
Packed mode: Y0+U0+Y1+V0 (1 plane).
|
constexpr |
Planar mode: Y + V + U (3 planes).
|
constexpr |
Packed mode: Y0+V0+Y1+U0 (1 plane).
|
constexpr |
ITU-R BT1361 Extended Colour Gamut.
|
constexpr |
ITU-R BT2020 for 10-bit system.
|
constexpr |
ITU-R BT2020 for 12-bit system.
|
constexpr |
SMPTE ST 170M / ITU-R BT.601-7 525 or 625.
|
constexpr |
Rec. ITU-R BT.709-6 / ITU-R BT1361.
|
constexpr |
TRANSFER_CHARACTERISTICS_CUSTOM.
|
constexpr |
ITU-R BT.470-6 System M / ITU-R BT1700 625 PAL & SECAM.
|
constexpr |
ITU-R BT.470-6 System B, G.
|
constexpr |
ARIB STD-B67, known as "hybrid log-gamma" (HLG).
|
constexpr |
IEC 61966-2-4.
|
constexpr |
TRANSFER_CHARACTERISTICS_LINEAR.
|
constexpr |
TRANSFER_CHARACTERISTICS_LOG100.
|
constexpr |
TRANSFER_CHARACTERISTICS_LOG100_SQRT10.
|
constexpr |
SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems.
|
constexpr |
SMPTE ST 240M.
|
constexpr |
SMPTE ST 428-1.
|
constexpr |
IEC 61966-2-1 (sRGB or sYCC).
|
constexpr |
TRANSFER_CHARACTERISTICS_UNKNOWN.
|
constexpr |
TRANSFER_CHARACTERISTICS_UNSPECIFIED.