5 gPainter ist die high-level version. die highlevel daten werden zu low level opcodes ueber
6 die gRC-queue geschickt und landen beim gDC der hardwarespezifisch ist, meist aber auf einen
7 gPixmap aufsetzt (und damit unbeschleunigt ist).
15 #include <lib/base/ringbuffer.h>
16 #include <lib/base/elock.h>
17 #include <lib/gdi/erect.h>
18 #include <lib/gdi/gpixmap.h>
19 #include <lib/gdi/region.h>
32 fill, fillRegion, clear,
45 setClip, addClip, popClip,
124 /* gRC is the singleton which controls the fifo and dispatches commands */
125 class gRC: public iObject
129 static gRC *instance;
131 static void *thread_wrapper(void *ptr);
132 pthread_t the_thread;
135 queueRingBuffer<gOpcode> queue;
141 void submit(const gOpcode &o)
143 static int collected=0;
146 // if (o.opcode==gOpcode::end||o.opcode==gOpcode::shutdown)
148 queuelock.unlock(collected);
156 static gRC *getInstance();
159 /* gPainter is the user frontend, which in turn sends commands through gRC */
167 void begin(const eRect &rect);
170 gPainter(gDC *dc, eRect rect=eRect());
173 void setBackgroundColor(const gColor &color);
174 void setForegroundColor(const gColor &color);
176 void setFont(gFont *font);
177 /* flags only THESE: */
180 // todo, make mask. you cannot align both right AND center AND block ;)
182 RT_HALIGN_CENTER = 2,
186 void renderText(const eRect &position, const std::string &string, int flags=0);
188 void renderPara(eTextPara *para, ePoint offset=ePoint(0, 0));
190 void fill(const eRect &area);
191 void fill(const gRegion &area);
195 void blit(gPixmap *pixmap, ePoint pos, const eRect &what=eRect(), int flags=0);
197 void setPalette(gRGB *colors, int start=0, int len=256);
198 void mergePalette(gPixmap *target);
200 void line(ePoint start, ePoint end);
202 void setOffset(ePoint abs);
203 void moveOffset(ePoint rel);
206 void resetClip(const gRegion &clip);
207 void clip(const gRegion &clip);
213 class gDC: public iObject
217 ePtr<gPixmap> m_pixmap;
219 gColor m_foreground_color, m_background_color;
220 ePtr<gFont> m_current_font;
221 ePoint m_current_offset;
223 std::stack<gRegion> m_clip_stack;
224 gRegion m_current_clip;
227 virtual void exec(gOpcode *opcode);
228 gDC(gPixmap *pixmap);
231 gRegion &getClip() { return m_current_clip; }
232 int getPixmap(ePtr<gPixmap> &pm) { pm = m_pixmap; return 0; }
233 gRGB getRGB(gColor col);
234 virtual eSize getSize() { return m_pixmap->getSize(); }