SDL_ISPIXELFORMAT_INDEXED(3)
π SDL_ISPIXELFORMAT_INDEXED π
okay bestie, welcome to the SDL_ISPIXELFORMAT_INDEXED page from the SDL3 FUNCTIONS corner of the manual β¨ it's a lil macro, it's a lil vibe check for your pixel formats, and it's here to tell you if a format is an indexed one. no cap.
β¨ NAME β¨
SDL_ISPIXELFORMAT_INDEXED β a macro that determines whether an SDL_PixelFormat is an indexed format π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_pixels.h>
#define SDL_ISPIXELFORMAT_INDEXED(format) \
(!SDL_ISPIXELFORMAT_FOURCC(format) && \
((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX2) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))
like, literally the whole macro is right there, she's not hiding anything π
π¦ DESCRIPTION π¦
so here's the tea, and it's important tea: this macro double-evaluates its parameter π meaning it looks at your argument more than once. so do not pass it expressions with side-effects, bestie. that's giving undefined chaos energy and we are not doing that today.
β οΈ real talk: side effects in the argument = bad time. if your expression changes something every time it's evaluated, it's gonna change it multiple times here. do not do this. π
π MACRO PARAMETERS π
formatβ anSDL_PixelFormatthat you wanna check π just hand it over and she'll tell you what's what.
π RETURN VALUE π
returns true if the format is indexed, and false otherwise. simple as that, periodt. β¨
π THREAD SAFETY π
it is safe to call this macro from any thread π«Ά go off, multi-threaded queen, this one's got you.
β AVAILABILITY β
this macro has been available since SDL 3.2.0 π a modern icon, truly.
and that's the whole page, bestie!! mwah π
this lil rewrite came from the Simple Directmedia Layer crew, rockin' SDL 3.4.18, and you just read the SDL_ISPIXELFORMAT_INDEXED(3) page. stay indexed, stay iconic, ily πβ¨π¦
π¦ 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