SDL/include
Sam Lantinga 981e0d367c Fixed bug 4903 - Lack of color multiply with alpha (SDL_BLENDMODE_MOD + SDL_BLENDMODE_BLEND) blending mode for all renderers
Konrad

This kind of blending is rather quite useful and in my opinion should be available for all renderers. I do need it myself, but since I didn't want to use a custom blending mode which is supported only by certain renderers (e.g. not in software which is quite important for me) I did write implementation of SDL_BLENDMODE_MUL for all renderers altogether.

SDL_BLENDMODE_MUL implements following equation:

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

Background:

https://i.imgur.com/UsYhydP.png

Blended texture:

https://i.imgur.com/0juXQcV.png

Result for SDL_BLENDMODE_MOD:

https://i.imgur.com/wgNSgUl.png

Result for SDL_BLENDMODE_MUL:

https://i.imgur.com/Veokzim.png

I think I did cover all possibilities within included patch, but I didn't write any tests for SDL_BLENDMODE_MUL, so it would be lovely if someone could do it.
2020-01-16 08:52:59 -08:00
..
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-11-21 11:33:50 +03:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-10-11 06:18:24 +02:00
2019-03-19 10:59:41 -07:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-11-02 22:58:52 +00:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-01-04 22:01:14 -08:00
2019-10-15 14:17:32 -04:00