SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
SDL::PixelFormat Class Reference

Pixel format. More...

Public Member Functions

constexpr PixelFormat (PixelFormatRaw format={}) noexcept
 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 noexcept
 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 PixelFormatDetailsGetDetails () const
 Create an PixelFormatDetails structure corresponding to a pixel format. More...
 
 operator const PixelFormatDetails & () const
 Same as GetDetails()
 
Uint32 Map (ColorRaw c, PaletteConstRef palette={}) const
 Map an RGBA quadruple to a pixel value for a given pixel format. More...
 
Color Get (Uint32 pixel, PaletteConstRef palette={}) const
 Get RGBA values from a pixel in the specified format. More...
 
ColorTypes
constexpr bool IsAlpha () const
 Determine if this has an alpha channel. More...
 
constexpr bool IsFourCC () const
 Determine if this is a "FourCC" format. More...
 

Static Public Member Functions

static PixelFormat ForMasks (int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
 Convert a bpp value and RGBA masks to an enumerated pixel format. More...
 

Detailed Description

SDL's pixel formats have the following naming convention:

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

Constructor & Destructor Documentation

◆ PixelFormat()

constexpr SDL::PixelFormat::PixelFormat ( PixelFormatRaw  format = {})
inlineconstexprnoexcept
Parameters
formatthe value to be wrapped

Member Function Documentation

◆ operator PixelFormatRaw()

constexpr SDL::PixelFormat::operator PixelFormatRaw ( ) const
inlineconstexprnoexcept
Returns
the underlying PixelFormatRaw.

The documentation for this class was generated from the following file: