I'm looking on how to tint an image in Pygame in a similar fashion of how Monogame does it. I've been trying to get custom flags like BLEND_ADD to work but it's been hard to find concise examples of what I'm looking for, it's mostly been people trying to "darken" or work with the alpha levels in a way.
Question: How do I tint an image to a certain RGBA value in the same way that MonoGame does it?
Fill your image with a color and pass one of the BLEND
constants as the special_flags
argument, e.g. your_image.fill((190, 0, 0, 100), special_flags=pygame.BLEND_ADD)
.
Note that BLEND_RGB_ADD
is just an alias for BLEND_ADD
(and the same applies to the other modes). The RGBA
modes will also modify the alpha channel (ADD and MAX make transparent parts visible).
Here's a table that shows you the effects of the different blending modes (I've also added the names of the modes in Photoshop):
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With