SDL_SetSurfaceAlphaMod(3)
β¨ SDL_SetSurfaceAlphaMod(3) β¨
okay bestie, welcome to the SDL3 FUNCTIONS section of the SDL_SetSurfaceAlphaMod manual page π this one is short, sweet, and honestly iconic for what it does.
πΈ NAME πΈ
SDL_SetSurfaceAlphaMod β set an extra alpha value that gets used in blit operations π
π¦ SYNOPSIS π¦
#include <SDL3/SDL_surface.h>
bool SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Uint8 alpha);
π DESCRIPTION π
so here's the tea: when this surface gets blitted, the blit operation takes the source alpha value and modulates it by this alpha value, using this exact formula:
srcA = srcA * (alpha / 255)
that's it. that's the whole vibe. no cap π
π FUNCTION PARAMETERS π
surfaceβ theSDL_Surfacestructure you wanna update πalphaβ the alpha value that gets multiplied into blit operations β¨
π RETURN VALUE π
Returns true on success or false on failure π«Ά and if it fails, bestie, call SDL_GetError() for more info. go get that lore.
π§ THREAD SAFETY π§
good news: you can call this function on different threads β as long as you're using different surfaces. main character multitasking energy π
β AVAILABILITY β
this function has been available since SDL 3.2.0. ancient by now, but still slaying.
π SEE ALSO π
Simple Directmedia Layer Β· SDL 3.4.18 Β· SDL_SetSurfaceAlphaMod(3) β okay that's the whole page, mwah π go modulate some alpha, you've got this, ily, bye π¦π
π¦ 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