from .rays import RayPolyManager
from .utils import DetailedTimer
from .loader import loader
+from .transforms import Multiply
LIGHT_FILTER = pymunk.ShapeFilter(
mask=pymunk.ShapeFilter.ALL_MASKS ^ (
def get_image(self):
if self._image is None:
- self._image = loader.load_image("64", self.FITTING_IMG).copy()
fitting_colour = self.COLOURS[self.colour]
- self._image.fill(fitting_colour, None, pgl.BLEND_RGBA_MULT)
+ self._image = loader.load_image("64", self.FITTING_IMG, transform=Multiply(colour=fitting_colour))
return self._image
def render_fitting(self, surface):
import pygame.surface
+import pygame.locals as pgl
+
class Transform(object):
over.fill(self.colour)
surface.blit(over, (0, 0), None)
return surface
+
+
+class Multiply(Transform):
+ """ Apply a colour by multiplying. """
+
+ ARGS = ["colour"]
+
+ def apply(self, surface):
+ mult = pygame.surface.Surface(surface.get_size())
+ mult = mult.convert_alpha()
+ mult.fill(self.colour)
+ surface.blit(mult, (0, 0), None, pgl.BLEND_RGBA_MULT)
+ return surface