1 '''Mutations to apply to images'''
3 from pygame.transform import rotate, flip
7 def __init__(self, func, *args):
9 self._args = tuple(args)
11 def __call__(self, image):
12 return self._func(image, *self._args)
15 return hash((self._func, self._args))
17 def __eq__(self, other):
18 if not isinstance(other, Mutator):
20 return (self._func == other._func) and (self._args == other._args)
23 return '<%s %r>' % (self.__class__.__name__, self._args)
27 return Mutator(rotate, angle)
31 NULL = Mutator(lambda x: x)
38 FLIP_H = Mutator(flip, True, False)
39 FLIP_V = Mutator(flip, False, True)