SDL_PIXELFLAG(3)

SDL_PIXELFLAG πŸ’…βœ¨

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we vibe with pixels πŸ’–


✨ NAME ✨

SDL_PIXELFLAG β€” it's a macro, and its whole entire job is to go get the flags out of an SDL_PixelFormat. that's it. that's the girl. πŸŽ€


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_pixels.h>

#define SDL_PIXELFLAG(format)    (((format) >> 28) & 0x0F)

look at her. shifting right by 28 and masking with 0x0F. she's doing bit math and she's doing it flawlessly. 😌


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea β˜• β€” this macro is generally not needed directly by an app. like, it exists, it's cute, it works, but most of the time you should be reaching for specific tests instead, like SDL_ISPIXELFORMAT_FOURCC. that's the one you actually want in your group chat. 🫢

ngl this is giving "you can use me but you should use the other one" energy, and honestly? respect. πŸ’…


🧚 MACRO PARAMETERS 🧚

  • format β€” an SDL_PixelFormat to check. hand her over and let the macro do its little investigation. πŸ”

πŸ’œ RETURN VALUE πŸ’œ

Returns the flags of format. periodt. πŸ’…βœ¨


🌈 THREAD SAFETY 🌈

It is safe to call this macro from any thread. go wild, queen, thread it up, no locks required, she's built different. πŸ‘‘


⭐ AVAILABILITY ⭐

This macro is available since SDL 3.2.0. so if you're on something older… bestie, upgrade. πŸ™ˆ


🚨 real talk: nothing here is deprecated or dangerous, but remember the DESCRIPTION β€” for actual app code, use specific tests like SDL_ISPIXELFORMAT_FOURCC rather than this macro directly. iykyk. πŸ’€

Simple Directmedia Layer πŸ¦‹ SDL 3.4.18 β€” mwah, that's the source and the version, love u, bye bestie! πŸ’–πŸŽ€βœ¨

πŸ“¦ where this page comes from