By Anders Holst:
[enigma2.git] / lib / python / Components / Sources / CanvasSource.py
1 from Source import Source
2
3 class CanvasSource(Source):
4         def __init__(self):
5                 Source.__init__(self)
6                 self.sequence = 0
7                 self.clear()
8
9         def clear(self):
10                 self.sequence += 1
11                 self._drawlist = (self.sequence, [ ])
12
13         def get_drawlist(self):
14                 return self._drawlist
15
16         drawlist = property(get_drawlist)
17
18         def fill(self, x, y, width, height, color):
19                 self.drawlist[1].append((1, x, y, width, height, color))
20
21         def writeText(self, x, y, width, height, fg, bg, font, text, flags = 0):
22                 self.drawlist[1].append((2, x, y, width, height, fg, bg, font, text, flags))
23
24         def flush(self):
25                 self.changed((self.CHANGED_DEFAULT,))