Module blendmode

Available on crate feature dep_sdl3 only.
Expand description

Blend modes decide how two colors will mix together. There are both standard modes for basic needs and a means to create custom modes, dictating what sort of math to do on what color components.

Structs§

SDL_BlendFactor
The normalized factor used to multiply pixel components.
SDL_BlendOperation
The blend operation used when combining source and destination pixel components.

Constants§

SDL_BLENDFACTOR_DST_ALPHA
dstA, dstA, dstA, dstA
SDL_BLENDFACTOR_DST_COLOR
dstR, dstG, dstB, dstA
SDL_BLENDFACTOR_ONE
1, 1, 1, 1
SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA
1-dstA, 1-dstA, 1-dstA, 1-dstA
SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR
1-dstR, 1-dstG, 1-dstB, 1-dstA
SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA
1-srcA, 1-srcA, 1-srcA, 1-srcA
SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR
1-srcR, 1-srcG, 1-srcB, 1-srcA
SDL_BLENDFACTOR_SRC_ALPHA
srcA, srcA, srcA, srcA
SDL_BLENDFACTOR_SRC_COLOR
srcR, srcG, srcB, srcA
SDL_BLENDFACTOR_ZERO
0, 0, 0, 0
SDL_BLENDMODE_ADD
additive blending: dstRGB = (srcRGB * srcA) + dstRGB, dstA = dstA
SDL_BLENDMODE_ADD_PREMULTIPLIED
pre-multiplied additive blending: dstRGB = srcRGB + dstRGB, dstA = dstA
SDL_BLENDMODE_BLEND
alpha blending: dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)), dstA = srcA + (dstA * (1-srcA))
SDL_BLENDMODE_BLEND_PREMULTIPLIED
pre-multiplied alpha blending: dstRGBA = srcRGBA + (dstRGBA * (1-srcA))
SDL_BLENDMODE_INVALID
SDL_BLENDMODE_MOD
color modulate: dstRGB = srcRGB * dstRGB, dstA = dstA
SDL_BLENDMODE_MUL
color multiply: dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)), dstA = dstA
SDL_BLENDMODE_NONE
no blending: dstRGBA = srcRGBA
SDL_BLENDOPERATION_ADD
dst + src: supported by all renderers
SDL_BLENDOPERATION_MAXIMUM
max(dst, src) : supported by D3D, OpenGL, OpenGLES, and Vulkan
SDL_BLENDOPERATION_MINIMUM
min(dst, src) : supported by D3D, OpenGL, OpenGLES, and Vulkan
SDL_BLENDOPERATION_REV_SUBTRACT
dst - src : supported by D3D, OpenGL, OpenGLES, and Vulkan
SDL_BLENDOPERATION_SUBTRACT
src - dst : supported by D3D, OpenGL, OpenGLES, and Vulkan

Functions§

SDL_ComposeCustomBlendMode
Compose a custom blend mode for renderers.

Type Aliases§

SDL_BlendMode
A set of blend modes used in drawing operations.