SDL_BlendMode(3type)
β¨ SDL_BlendMode β¨
okay bestie, welcome to the SDL3 DATATYPES corner of the manual, this one's about SDL_BlendMode and it's genuinely iconic π
πΈ NAME πΈ
SDL_BlendMode β a whole set of blend modes that get used in drawing operations. that's it, that's the vibe π
π¦ SYNOPSIS π¦
#include <SDL3/SDL_blendmode.h>
typedef Uint32 SDL_BlendMode;
#define SDL_BLENDMODE_NONE 0x00000000u /**< no blending: dstRGBA = srcRGBA */
#define SDL_BLENDMODE_BLEND 0x00000001u /**< alpha blending: dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)), dstA = srcA + (dstA * (1-srcA)) */
#define SDL_BLENDMODE_BLEND_PREMULTIPLIED 0x00000010u /**< pre-multiplied alpha blending: dstRGBA = srcRGBA + (dstRGBA * (1-srcA)) */
#define SDL_BLENDMODE_ADD 0x00000002u /**< additive blending: dstRGB = (srcRGB * srcA) + dstRGB, dstA = dstA */
#define SDL_BLENDMODE_ADD_PREMULTIPLIED 0x00000020u /**< pre-multiplied additive blending: dstRGB = srcRGB + dstRGB, dstA = dstA */
#define SDL_BLENDMODE_MOD 0x00000004u /**< color modulate: dstRGB = srcRGB * dstRGB, dstA = dstA */
#define SDL_BLENDMODE_MUL 0x00000008u /**< color multiply: dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)), dstA = dstA */
#define SDL_BLENDMODE_INVALID 0x7FFFFFFFu
so it's just a Uint32 under all that glamour, but the #defines are where the actual lore lives. let me walk you through each one, no gatekeeping π
SDL_BLENDMODE_NONEβ0x00000000u, no blending at all,dstRGBA = srcRGBA. the source just... shows up. periodt.SDL_BLENDMODE_BLENDβ0x00000001u, alpha blending:dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)),dstA = srcA + (dstA * (1-srcA)). the classic translucent girlie β¨SDL_BLENDMODE_BLEND_PREMULTIPLIEDβ0x00000010u, pre-multiplied alpha blending:dstRGBA = srcRGBA + (dstRGBA * (1-srcA)). the source already did the math ahead of time, main character energy πSDL_BLENDMODE_ADDβ0x00000002u, additive blending:dstRGB = (srcRGB * srcA) + dstRGB,dstA = dstA. everything gets brighter, it's giving glow-up π₯SDL_BLENDMODE_ADD_PREMULTIPLIEDβ0x00000020u, pre-multiplied additive blending:dstRGB = srcRGB + dstRGB,dstA = dstA. same glow-up, just pre-multiplied, iykyk β¨SDL_BLENDMODE_MODβ0x00000004u, color modulate:dstRGB = srcRGB * dstRGB,dstA = dstA. colors multiply together like the most dramatic crossover event πSDL_BLENDMODE_MULβ0x00000008u, color multiply:dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)),dstA = dstA. yes bestie,MODandMULare two different things, do not mix them up πSDL_BLENDMODE_INVALIDβ0x7FFFFFFFu. the "something went wrong" one. if you see this, it's not your moment π
π DESCRIPTION π
these predefined blend modes? supported everywhere. like, everywhere everywhere. no cap. π
and if the pre-baked ones aren't giving what you need, you can get additional values from SDL_ComposeCustomBlendMode. build your own, you're an artist π«Ά
β AVAILABILITY β
this datatype has been around since SDL 3.2.0. so if your SDL is older than that... girl. upgrade. π
π SEE ALSO π
SDL_ComposeCustomBlendMode(3)β go make a custom one, bestie β¨
and that's the whole page, you ate it π
this was Simple Directmedia Layer, SDL 3.4.18, and yes the footer said SDL_BlendMode(3type) so now you know exactly where you are. bye babes, go blend responsibly π¦ππ
π¦ 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