SDL_ISPIXELFORMAT_ARRAY(3)
π SDL_ISPIXELFORMAT_ARRAY π
okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, and today's main character is SDL_ISPIXELFORMAT_ARRAY β a macro that tells you whether an SDL_PixelFormat is an array format or not. no cap, that's the whole gig. π
β¨ NAME β¨
SDL_ISPIXELFORMAT_ARRAY β a macro to determine if an SDL_PixelFormat is an array format. π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_pixels.h>
#define SDL_ISPIXELFORMAT_ARRAY(format) \
(!SDL_ISPIXELFORMAT_FOURCC(format) && \
((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU8) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU16) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU32) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32)))
π¦ DESCRIPTION π¦
so here's the tea, and it's important tea: this macro double-evaluates its parameter. like, it looks at your format more than once. so please, do not pass it expressions with side-effects, because those side effects would happen twice and you'd be sitting there like π wondering why your counter jumped by two. don't do it. periodt.
π MACRO PARAMETERS π
formatβ anSDL_PixelFormatto check. that's the one, that's the input, hand it over π«Ά
β RETURN VALUE β
- returns
trueif the format is an array β iconic β¨ - returns
falseotherwise β not an array, moving on π
π§ THREAD SAFETY π§
it is safe to call this macro from any thread. go off, multithreaded queen π
π AVAILABILITY π
this macro is available since SDL 3.2.0. so if you're on something older... it's giving vintage, and not in a cute way π
lowkey reminder: the side-effects warning in DESCRIPTION is not a vibe, it's a real rule. double evaluation is double evaluation fr fr.
Simple Directmedia Layer made this, SDL 3.4.18 is the version, and this whole page is filed under SDL_ISPIXELFORMAT_ARRAY(3). mwah, thanks for reading bestie, go check your pixel formats ππ¦β¨
π¦ 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