dont ignore background color when transparent=1 is set.. (needed for font
[enigma2.git] / lib / gui / ecanvas.cpp
1 #include <lib/gui/ecanvas.h>
2
3 eCanvas::eCanvas(eWidget *parent): ePixmap(parent)
4 {
5 }
6
7 void eCanvas::setSize(eSize size)
8 {
9         setPixmap(new gPixmap(size, 32)); /* TODO: do we need 8bit surfaces? */
10 }
11
12 void eCanvas::clear(gRGB color)
13 {
14         if (!m_pixmap)
15                 return;
16
17         ePtr<gDC> d = new gDC(m_pixmap);
18         gPainter p(d, eRect());
19         p.resetClip(eRect(ePoint(0,0), m_pixmap->size()));
20         p.setBackgroundColor(color);
21         p.clear();
22
23         invalidate();
24 }
25
26 void eCanvas::fillRect(eRect rect, gRGB color)
27 {
28         if (!m_pixmap)
29                 return;
30
31         ePtr<gDC> dc = new gDC(m_pixmap);
32
33         gPainter p(dc);
34         p.resetClip(eRect(ePoint(0,0), m_pixmap->size()));
35         p.setForegroundColor(color);
36         p.fill(rect);
37
38         invalidate(rect);
39 }