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 β€” the SDL_Surface structure 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