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 β€” an SDL_PixelFormat to 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