Wiki Page Content

SDL_SetSurfaceBlendMode

Use this function to set the blend mode used for blit operations.

Syntax

int SDL_SetSurfaceBlendMode(SDL_Surface*  surface,
                            SDL_BlendMode blendMode)

Function Parameters

surface

the SDL_Surface structure to update

blendMode

the SDL_BlendMode to use for blit blending; see Remarks for details

Return Value

Returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

Code Examples

You can add your code example here

Remarks

blendMode may be one of the following:

SDL_BLENDMODE_NONE

no blending

dstRGBA = srcRGBA

SDL_BLENDMODE_BLEND

alpha blending

dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA))

dstA = srcA + (dstA * (1-srcA))

SDL_BLENDMODE_ADD

additive blending

dstRGB = (srcRGB * srcA) + dstRGB

dstA = dstA

SDL_BLENDMODE_MOD

color modulate

dstRGB = srcRGB * dstRGB

dstA = dstA

To copy a surface to another surface (or texture) without blending with the existing data, the blendmode of the SOURCE surface should be set to 'SDL_BLENDMODE_NONE'.


CategoryAPI, CategorySurface

None: SDL_SetSurfaceBlendMode (last edited 2014-02-18 03:03:34 by mattbentley)

Feedback
Please include your contact information if you'd like to receive a reply.
Submit