SDL_ISPIXELFORMAT_FLOAT(3)
β¨ NAME β¨
SDL_ISPIXELFORMAT_FLOAT β a macro that checks whether an SDL_PixelFormat is giving floating point format energy π
Like, it's the SDL_ISPIXELFORMAT_FLOAT(3) page bestie, and we're about to make pixel format checks make sense fr fr.
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_pixels.h>
#define SDL_ISPIXELFORMAT_FLOAT(format) \
(!SDL_ISPIXELFORMAT_FOURCC(format) && \
((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32)))
π DESCRIPTION π
Okay so real talk: this macro double-evaluates its parameter. Do NOT put expressions with side-effects in there, bestie. That's the warning, and it's not a drill π
It checks if the format is a floating point format, and it does it by first making sure it's not a FourCC format, then checking whether the pixel type is SDL_PIXELTYPE_ARRAYF16 or SDL_PIXELTYPE_ARRAYF32. Iconic behavior honestly.
β οΈ Side effects in the parameter = chaos. Double evaluation means your expression runs twice. Not me warning you twice because it literally runs twice π
π¦ MACRO PARAMETERS π¦
formatβ anSDL_PixelFormatto check. That's the one, the only, the format being vibe-checked β¨
π RETURN VALUE π
Returns true if the format is a floating point, false otherwise. Simple. Clean. Slay.
π₯ THREAD SAFETY π₯
It is safe to call this macro from any thread. No cap, go off wherever you need to π«Ά
π AVAILABILITY π
This macro is available since SDL 3.2.0. Periodt.
Simple Directmedia Layer β’ SDL 3.4.18 β’ SDL_ISPIXELFORMAT_FLOAT(3)
That's the whole page, bestie π Go check those pixel formats, stay hydrated, and remember: double evaluation is real and it will catch you slipping. Mwah πβ¨π¦
π¦ 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