SDL_SetSurfaceColorMod(3)
β¨ SDL_SetSurfaceColorMod β¨
okay bestie, so like... you know how when you blit a surface you can tint it? this is that function. it's a SDL3 FUNCTIONS girlie, header file SDL3/SDL_surface.h, and she's here to let you multiply a color into every blit. no cap. π
πΈ NAME πΈ
SDL_SetSurfaceColorMod β set an additional color value multiplied into blit operations. literally that's it, that's the whole vibe π
π¦ SYNOPSIS π¦
#include <SDL3/SDL_surface.h>
bool SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b);
π DESCRIPTION π
so the tea is: when this surface gets blitted, during the blit operation each source color channel is modulated by the appropriate color value β and the formula is giving:
srcC = srcC * (color / 255)
that's it. that's the math. iconic behavior fr fr π
π«Ά FUNCTION PARAMETERS π«Ά
surfaceβ theSDL_Surfacestructure to update. the main character, the one we're touching πrβ the red color value multiplied into blit operations.gβ the green color value multiplied into blit operations.bβ the blue color value multiplied into blit operations.
π RETURN VALUE π
Returns true on success or false on failure; call SDL_GetError() for more information. so if it flops, go ask SDL_GetError() what happened, she always knows π
π§ THREAD SAFETY π§
This function can be called on different threads with different surfaces. so like, share the load babes, just keep your surfaces separate β¨
β AVAILABILITY β
This function is available since SDL 3.2.0. she's new-ish but she's thriving π
π₯ SEE ALSO π₯
and that's the whole page bestie π go modulate some colors, you're gonna eat π
this lil writeup is from the Simple Directmedia Layer girlies, version SDL 3.4.18, dated SDL_SetSurfaceColorMod(3) β 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