SDL_GetPixelFormatForMasks(3)
π SDL_GetPixelFormatForMasks(3) π
okay bestie, so this one lives in the SDL3 FUNCTIONS crew, and it's genuinely one of those lil utility functions that just does the thing for you. no cap.
β¨ NAME β¨
SDL_GetPixelFormatForMasks β take a bpp value plus some RGBA masks and turn them into an enumerated pixel format. it's giving translator energy π«Ά
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_pixels.h>
SDL_PixelFormat SDL_GetPixelFormatForMasks(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
π¦ DESCRIPTION π¦
so you hand it your masks and it hands you back a pixel format. iconic behaviour fr fr.
but listen β if the conversion wasn't possible, it will return SDL_PIXELFORMAT_UNKNOWN. that's the "idk bestie, couldn't do it" answer π so always check what you got back, okay?
π FUNCTION PARAMETERS π
bppβ the bits per pixel value. usually15,16, or32but like, that's the usual crowd, not a rule.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 π«₯
β RETURN VALUE β
it returns the SDL_PixelFormat value that matches your format masks β main character moment β¨ β OR it returns SDL_PIXELFORMAT_UNKNOWN if there isn't a match. no match, no format, periodt.
π THREAD SAFETY π
it is safe to call this function from any thread. yes queen, go off, call it wherever you want π₯
π AVAILABILITY π
this function has been available since SDL 3.2.0 π
π SEE ALSO π
SDL_GetMasksForPixelFormat(3)β the reverse girly, go say hi π§
mwah π that's the whole page. this lil manual comes to you courtesy of Simple Directmedia Layer, version SDL 3.4.18 β and it's literally the SDL_GetPixelFormatForMasks(3) page, so you know exactly where you are π byeeeee π
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms