SDL_PIXELLAYOUT(3)
π SDL_PIXELLAYOUT π
okay bestie come CLOSE, because this one is a macro in the SDL3 function family and she is tiny but she is mighty π
β¨ NAME β¨
SDL_PIXELLAYOUT β a macro to retrieve the layout of an SDL_PixelFormat. that's it. that's the whole job. she does one thing and she slays at it π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_pixels.h>
#define SDL_PIXELLAYOUT(format) (((format) >> 16) & 0x0F)
yes ma'am, that's the whole thing. a right shift and a mask. bit math but make it fashion β¨
π¦ DESCRIPTION π¦
so like, what even is the layout, you ask? π₯Ί it's usually a value from the SDL_PackedLayout enumeration. iconic. love that for her.
or β and hear me out β it's zero if a layout doesn't make sense for the format type. like sometimes the answer is just "nope, doesn't apply here" and honestly? valid. we respect it. no cap π
π MACRO PARAMETERS π
formatβ anSDL_PixelFormatto check. that's the one you're passing in, bestie. give her the format and she'll tell you the vibe π
β RETURN VALUE β
returns the layout of format. short, sweet, to the point. she ate and left no crumbs π
π§ THREAD SAFETY π§
it is safe to call this macro from any thread. yes literally any of them. go wild. no locks, no drama, no stress π«Ά
π AVAILABILITY π
this macro has been available since SDL 3.2.0. so if you're on something older... bestie. it's giving outdated. time to update π
lowkey the whole trick is that the layout lives in bits 16 through 19 of the format value, and0x0Fmasks off everything else. the way that>> 16and& 0x0Fteam up?? obsessed. that's the bit-manipulation equivalent of a duet π₯
okay that's the page!! no notes, she's perfect π this was served up by the Simple Directmedia Layer crew, SDL 3.4.18 era, and you were reading SDL_PIXELLAYOUT(3) β mwah, bye bestie!! πβ¨πΈπ¦
π¦ 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