from naja.constants import EIGHT_BIT_SCALE
+from pygame import surface
+import pygame.locals as pgl
+
class Mutator(object):
def __init__(self, func, *args):
return scale(image, size)
+def blend_add(image, colour):
+ """Overlay the image with the given colour using BLEND_ADD"""
+ blend = surface.Surface(image.get_size())
+ blend.fill(colour)
+ # We return a copy
+ blended_image = image.copy()
+ blended_image.blit(blend, (0, 0), special_flags=pgl.BLEND_ADD)
+ return blended_image
+
+
+def blender(colour):
+ return Mutator(blend_add, tuple(colour))
+
+
# Identity mutator
NULL = Mutator(lambda x: x)