SDL_SetTextureAlphaMod(3)
β¨ SDL_SetTextureAlphaMod β¨
okay bestie, welcome to the SDL3 corner of the manual β this is the page for SDL_SetTextureAlphaMod(3) and it's giving transparency slay π
πΈ NAME πΈ
SDL_SetTextureAlphaMod</purpose> β set an extra alpha value that gets multiplied into render copy operations π«Ά
π SYNOPSIS π
#include <SDL3/SDL_render.h>
bool SDL_SetTextureAlphaMod(SDL_Texture *texture, Uint8 alpha);
like, that's the whole vibe. one texture, one alpha, one bool. iconic.
π DESCRIPTION π
so here's the tea β β when this texture gets rendered, during the copy operation the source alpha value gets modulated by this alpha value, using this exact formula:
srcA = srcA * (alpha / 255)
so yeah, it's a multiplier. your texture's own alpha times this alpha over 255. math but make it β¨fashionβ¨
β οΈ real talk though: alpha modulation is not always supported by the renderer. if it's not supported, this function will return false. no cap.
π¦ FUNCTION PARAMETERS π¦
textureβ the texture you're updating, bestie. the glow-up target πalphaβ the source alpha value that gets multiplied into copy operations.
β RETURN VALUE β
returns true on success, or false on failure π β and if it fails, go call SDL_GetError() for the deets, she'll tell you what went wrong.
π§ THREAD SAFETY π§
π¨ main thread ONLY, bestie. this function should only be called on the main thread. do not be out here threading this. i'm serious. π
π AVAILABILITY π
this function is available since SDL 3.2.0 π so if you're on something older... upgrade, babe.
π SEE ALSO π
go read those next, iykyk π
and that's the page!! mwah π this whole thing lives in Simple Directmedia Layer, SDL 3.4.18, dated SDL_SetTextureAlphaMod(3) β k bye, go modulate some alpha, you absolute main character π«Άβ¨π
π¦ 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