From: Neil Date: Sat, 17 May 2014 21:36:15 +0000 (+0200) Subject: Add PreRenderedImageBox widget X-Git-Tag: 0.1~15^2~7 X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=237c4215b45bde3e5f6fe769f7b8f2955590e34e;p=naja.git Add PreRenderedImageBox widget --- diff --git a/naja/widgets/image_box.py b/naja/widgets/image_box.py index 32787df..e9b4bf3 100644 --- a/naja/widgets/image_box.py +++ b/naja/widgets/image_box.py @@ -22,3 +22,18 @@ class ImageBox(Widget): def draw(self, surface): surface.blit(self.surface, self.rect) + + +class PreRenderedImageBox(Widget): + """Hold an image given as a surface""" + + def __init__(self, pos, image): + super(PreRenderedImageBox, self).__init__(pos) + self.surface = image.copy() + + def prepare(self): + self.size = self.surface.get_rect().size + + def draw(self, surface): + surface.blit(self.surface, self.rect) +