SDL_SetTextureColorMod(3)
π SDL_SetTextureColorMod π
okay bestie, so this is a page from the SDL3 FUNCTIONS manual β the whole thing lives in SDL_SetTextureColorMod(3) β and it's literally the cutest little function for tinting your textures. let's get into it π
β¨ NAME β¨
SDL_SetTextureColorMod β slap an extra color value on there that gets multiplied into render copy operations. it's giving tint, it's giving glow-up π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_render.h>
bool SDL_SetTextureColorMod(SDL_Texture *texture, Uint8 r, Uint8 g, Uint8 b);
π¦ DESCRIPTION π¦
so here's the tea π: when this texture gets rendered, during the copy operation each source color channel gets modulated by the matching color value. the formula is right here, no cap:
srcC = srcC * (color / 255)
and the reddest flag of them all π©: color modulation is not always supported by the renderer. if it's not supported, this function will return false. periodt.
π FUNCTION PARAMETERS π
textureβ the texture you're updating, bestie. the main character of this whole operation.rβ the red color value that gets multiplied into copy operations.gβ the green color value that gets multiplied into copy operations.bβ the blue color value that gets multiplied into copy operations.
β RETURN VALUE β
returns true on success or false on failure π«Ά and if it fails, call SDL_GetError() for more info β she'll tell you what went wrong, iykyk.
π§ THREAD SAFETY π§
lowkey important: this function should only be called on the main thread. no sneaky side-thread shenanigans π
π AVAILABILITY π
this function is available since SDL 3.2.0. iconic behavior honestly.
π SEE ALSO π
okay that's the whole page, bestie!! stay hydrated, modulate responsibly, and remember β this was brought to you by Simple Directmedia Layer β¨ version SDL 3.4.18 β¨ the SDL_SetTextureColorMod(3) page itself. mwah, love u, 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