SDL_AddSurfaceAlternateImage(3)
π SDL_AddSurfaceAlternateImage π
okay bestie, so this one lives in the SDL3 FUNCTIONS manual, and it's called SDL_AddSurfaceAlternateImage(3). let's get into it π«Ά
β¨ NAME β¨
SDL_AddSurfaceAlternateImage β add an alternate version of a surface. literally giving your surface a little backup twin π―βοΈ
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_surface.h>
bool SDL_AddSurfaceAlternateImage(SDL_Surface *surface, SDL_Surface *image);
π¦ DESCRIPTION π¦
so what this does is it adds an alternate version of this surface. the usual reason you'd do this? content that has high DPI representations β think cursors or icons, the stuff that needs to look crisp on a fancy screen π
and here's the chill part: the size, format, and content of the alternate do not need to match the original surface. no matching outfit required, she can wear whatever π
heads up tho β these alternate versions will not be updated when the original surface changes. they are NOT synced, they do not follow along, they are doing their own thing. periodt.
also important: this function adds a reference to the alternate version. so after you call this, you should call SDL_DestroySurface() on the image. don't skip that part bestie, that's the cleanup π
π FUNCTION PARAMETERS π
surfaceβ theSDL_Surfacestructure to update. this is the main character, the one getting the glow-up πimageβ a pointer to an alternateSDL_Surfaceto associate with this surface. this is the little alt twin π§
β RETURN VALUE β
returns true on success, or false on failure. if it fails, call SDL_GetError() for more info β she'll tell you what went wrong π
π THREAD SAFETY π
this function can be called on different threads with different surfaces. so yes, you can parallelize β just keep it to different surfaces, iykyk β¨
π AVAILABILITY π
this function is available since SDL 3.2.0. not that old, she's fresh π₯
π SEE ALSO π
and that's the whole vibe π this came to you straight from Simple Directmedia Layer, SDL 3.4.18, and yes it's still the SDL_AddSurfaceAlternateImage(3) page. go forth and give your surfaces their alternate selves, bestie πΈπ¦π
π¦ 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