changeset 224:0dfa3f52742b

Support alpha mutating
author Stefano Rivera <stefano@rivera.za.net>
date Wed, 14 Sep 2011 22:43:37 +0200
parents c3018764942a
children af95fbc8ef5c
files mamba/mutators.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mamba/mutators.py	Wed Sep 14 22:29:57 2011 +0200
+++ b/mamba/mutators.py	Wed Sep 14 22:43:37 2011 +0200
@@ -1,7 +1,7 @@
 """Mutations to apply to images when they're loaded."""
 
 from pygame.transform import rotate
-from pygame.locals import BLEND_MULT
+from pygame.locals import BLEND_RGBA_MULT, SRCALPHA
 from pygame.surface import Surface
 
 from mamba.data import load_tile_image
@@ -59,12 +59,12 @@
 class Colour(Mutator):
     """Overlay an image with a colour."""
 
-    def __init__(self, colour, blend=BLEND_MULT):
+    def __init__(self, colour, blend=BLEND_RGBA_MULT):
         super(Colour, self).__init__(self.colour, colour, blend)
 
     def colour(self, image, colour, blend):
         image = image.copy()
-        overlay = Surface(image.get_size(), 0, image)
+        overlay = Surface(image.get_size(), SRCALPHA, image)
         overlay.fill(colour)
         image.blit(overlay, (0, 0), None, blend)
         return image