SDL_SetTextureColorModFloat(3)
π SDL_SetTextureColorModFloat(3) π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, this one's called SDL_SetTextureColorModFloat and it's literally the tint-your-texture button but make it β¨floatβ¨
πΈ NAME πΈ
SDL_SetTextureColorModFloat β sets an extra color value that gets multiplied into render copy operations π¨
π¦ SYNOPSIS π¦
#include <SDL3/SDL_render.h>
bool SDL_SetTextureColorModFloat(SDL_Texture *texture, float r, float g, float b);
β¨ DESCRIPTION β¨
so when this texture gets rendered, during the copy operation every source color channel gets modulated by the matching color value, using this formula right here:
srcC = srcC * color
that's it, that's the whole vibe. π«Ά
heads up bestie: color modulation is not always supported by the renderer β if it isn't, this function returns false. no cap, no tint. π
π FUNCTION PARAMETERS π
textureβ the texture to update, obviously, it's the main character here πrβ the red color value multiplied into copy operations πgβ the green color value multiplied into copy operations πbβ the blue color value 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. π
π§ THREAD SAFETY π§
this function should only be called on the main thread. no side quests, no background threads, main character energy only. periodt. π
β AVAILABILITY β
this function is available since SDL 3.2.0 β so if you're on anything older, she is simply not there yet, sorry babe π
π SEE ALSO π
go read those too, they're all part of the same little color-modulation friend group π«Ά
and that's the whole page!! brought to you by Simple Directmedia Layer, version SDL 3.4.18 β mwah, go tint something cute, 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