1 """ Image transformations for use with the image loader. """
6 class Transform(object):
10 def __init__(self, **kw):
12 setattr(self, k, kw.pop(k))
14 self.hash = "%s: <%s>" % (
15 self.__class__.__name__,
16 ", ".join("%s=%s" % (k, getattr(self, k)) for k in self.ARGS))
19 def apply(self, surface):
20 raise NotImplementedError("Transforms should implement .apply")
23 class NullTransform(Transform):
26 def apply(self, surface):
30 class Overlay(Transform):
31 """ Apply a colour overlay. """
35 def apply(self, surface):
36 over = pygame.surface.Surface(surface.get_size())
37 over = over.convert_alpha()
38 over.fill(self.colour)
39 surface.blit(over, (0, 0), None)