SDL_PIXELTYPE(3)

πŸ’… SDL_PIXELTYPE πŸ’…

okay bestie, welcome to SDL_PIXELTYPE β€” she's a macro from the SDL3 FUNCTIONS fam, and she's here to pull the type out of an SDL_PixelFormat. no cap, that's the whole job. πŸŽ€


✨ NAME ✨

SDL_PIXELTYPE β€” a macro to retrieve the type of an SDL_PixelFormat. literally that. one (1) macro, one (1) mission. πŸ‘‘


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_pixels.h>

#define SDL_PIXELTYPE(format)    (((format) >> 24) & 0x0F)

look at her. shifting right by 24 and masking with 0x0F. the way that she's doing bit math and looking this cute doing it?? iconic behavior fr fr. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so what you get back is usually a value from the SDL_PixelType enumeration. that's the vibe. that's the whole description. iykyk. ✨


πŸ“ MACRO PARAMETERS πŸ“

  • format β€” an SDL_PixelFormat to check. that's it, that's the one and only thing she wants from you. hand her a format, she hands you back its type. mutual exchange, healthy relationship, we love to see it. 🫢

πŸ’– RETURN VALUE πŸ’–

Returns the type of format. boom. no drama, no surprises, just your answer. periodt. πŸ’€


🧚 THREAD SAFETY 🧚

good news bestie: it is safe to call this macro from any thread. no locks, no crying, no "wait which thread am i on" panic. go wild. 🌈


⭐ AVAILABILITY ⭐

this macro has been available since SDL 3.2.0. so if you're on anything older... girl. upgrade. πŸŽ€


πŸ’œ reminder: the value it gives you is usually from the SDL_PixelType enumeration β€” the manpage said usually, so we're keeping that energy, okay? no adding extra lore that isn't there.

made with love by Simple Directmedia Layer, SDL 3.4.18, dated SDL_PIXELTYPE(3) β€” k bye, go shift some bits, you're gonna slay πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from