| Summary: | Add support for a pre-multiplied alpha blending mode | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Ben Kurtovic <ben.kurtovic> |
| Component: | render | Assignee: | Sam Lantinga <slouken> |
| Status: | WAITING --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | enhancement | ||
| Priority: | P2 | ||
| Version: | HG 2.1 | ||
| Hardware: | All | ||
| OS: | All | ||
| Attachments: |
Adds a SDL_BLENDMODE_PMA blending mode for pre-multiplied alpha blending
Adds a SDL_BLENDMODE_PMA blending mode for pre-multiplied alpha blending |
||
|
Description
Ben Kurtovic
2017-06-26 22:00:46 UTC
Created attachment 2781 [details]
Adds a SDL_BLENDMODE_PMA blending mode for pre-multiplied alpha blending
Realized my original solution didn't support SDL_TEXTUREMODULATE_ALPHA when used without SDL_TEXTUREMODULATE_COLOR because the modulated RGBA value wouldn't account for the pre-multiplied alpha channel. Fixed in the new patch, which pre-multiplies the alpha into the RGB value in SetAlphaMod and does a couple things differently in a few renderers that needed it.
Tested with OpenGL and the software renderer; as before, I don't have the hardware to test the other renderers.
This is partly fixed with this commit: https://hg.libsdl.org/SDL/rev/180e8906dc3c SDL_BLENDMODE_BLEND_PREMULTIPLIED = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD, SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,SDL_BLENDOPERATION_ADD); You elegantly folded that into the software renderer, which still needs to be done here, and this patch doesn't handle the modulation you mentioned. What's a good way to test that? Can you re-base your patch on top of this commit, and change the name to SDL_BLENDMODE_BLEND_PREMULTIPLIED? Thanks! |