pygame / pygame

🐍🎮 pygame (the library) is a Free and Open Source python programming language library for making multimedia applications like games built on top of the excellent SDL library. C, Python, Native, OpenGL.
https://www.pygame.org
7.16k stars 3.2k forks source link

pre-multiplied alpha continued #2113

Open notpygame opened 3 years ago

notpygame commented 3 years ago

BLEND_PREMULTIPLIED was implemented in this issue: https://github.com/pygame/pygame/issues/1289

To make it more usable for people, the following could be done:

MyreMylar commented 2 years ago

I think my initial idea for adapting .convert_alpha() was too unfocused and messing with the clarity of an existing function.

Instead I think I should mirror the PR for the Color class and just add a .premul_alpha() method to Surface that begins by erroring out if the surface is not 32bit with an alpha channel.