SDL_GetSurfaceColorKey(3)
β¨ SDL_GetSurfaceColorKey β¨
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual π this one's about finding out which pixel your surface is treating as "invisible". it's giving detective energy, fr fr.
πΈ NAME πΈ
SDL_GetSurfaceColorKey β get the color key (transparent pixel) for a surface π«Ά
π SYNOPSIS π
#include <SDL3/SDL_surface.h>
bool SDL_GetSurfaceColorKey(SDL_Surface *surface, Uint32 *key);
π DESCRIPTION π
so the color key is a pixel of the format used by the surface, as generated by SDL_MapRGB(). that's the one pixel value that gets treated as transparent. iconic behaviour honestly.
and here's the tea: if the surface doesn't have color key enabled, this function returns false. no color key, no answer, sorry babe π
π¦ FUNCTION PARAMETERS π¦
surfaceβ theSDL_Surfacestructure to query. this is the one we're snooping on πkeyβ a pointer filled in with the transparent pixel. you hand it the spot, it fills it in. mutual trust π
β RETURN VALUE β
Returns true on success or false on failure; call SDL_GetError() for more information. so like, if it fails, go ask SDL_GetError() what's wrong, she always knows π₯
π THREAD SAFETY π
It is safe to call this function from any thread. yes bestie, ANY thread. go wild, main character energy, no locks required π
π§ AVAILABILITY π§
This function is available since SDL 3.2.0. so if you're on something older, that's a you problem, go update π
π SEE ALSO π
and that's the whole page, periodt β¨ this one came to you straight from the Simple Directmedia Layer girlies, running on SDL 3.4.18, and it's filed under SDL_GetSurfaceColorKey(3) β mwah, take care of her π
π
π¦ 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