invalidate(rect);
}
+
+void eCanvas::writeText(eRect rect, gRGB fg, gRGB bg, gFont *font, const char *string, int flags)
+{
+ ePtr<gDC> dc = new gDC(m_pixmap);
+
+ gPainter p(dc);
+ p.setFont(font);
+ p.resetClip(eRect(ePoint(0,0), m_pixmap->size()));
+ p.setForegroundColor(fg);
+ p.setBackgroundColor(bg);
+ p.renderText(rect, string, flags);
+
+ invalidate(rect);
+}
void clear(gRGB color);
void fillRect(eRect rect, gRGB color);
+ void writeText(eRect where, gRGB fg, gRGB bg, gFont *font, const char *string, int flags);
};
#endif
def draw(self, list):
for l in list:
- self.instance.fillRect(eRect(l[1], l[2], l[3], l[4]), gRGB(l[5]))
+ if l[0] == 1:
+ self.instance.fillRect(eRect(l[1], l[2], l[3], l[4]), gRGB(l[5]))
+ elif l[0] == 2:
+ self.instance.writeText(eRect(l[1], l[2], l[3], l[4]), gRGB(l[5]), gRGB(l[6]), l[7], l[8], l[9])
+ else:
+ print "drawlist entry:", l
+ raise "invalid drawlist entry"
def changed(self, what):
self.pull_updates()
drawlist = property(get_drawlist)
def fill(self, x, y, width, height, color):
- self.drawlist[1].append( (1, x, y, width, height, color) )
- self.changed()
+ self.drawlist[1].append((1, x, y, width, height, color))
+
+ def writeText(self, x, y, width, height, fg, bg, font, text, flags = 0):
+ self.drawlist[1].append((2, x, y, width, height, fg, bg, font, text, flags))
+
+ def flush(self):
+ self.changed((self.CHANGED_DEFAULT,))