Blend Mode in SDL

Started by
1 comment, last by Kylotan 6 years, 9 months ago

What is the Blend Mode in SDL and explains each mode such as SDL_BLENDMODE_BLEND, help me!!!

 

Capture.PNG

Advertisement

The _NONE mode is basically "overwrite" - when you write a pixel to the location that you already wrote a pixel to, the pixel underneath is completely replaced with the new one.

The _BLEND mode instead gives you a mixture of the old pixel and the new one, based on how large the 'A' or 'alpha' value of the new pixel is. If 'A' is 1, you just see the new pixel (like with the _NONE mode), if 'A' is 0, the old pixel is left in place, and values between 0 and 1 will be a blend between the 2.

_ADD is like _BLEND except the new pixel's colour (scaled by the new pixel's alpha) is 'added' to the old pixel. This means the pixel can only get brighter, based on how bright the new pixel is. This might be useful for bright particles like electrical sparks or fire.

_MOD is like _ADD, except the pixels can only get darker, based on how dark the new pixel is. You might use this for dark particles like smoke or flying debris.

There are many other more advanced rendering techniques that use these, and other, blend modes. But usually you will want _NONE or _BLEND.

This topic is closed to new replies.

Advertisement