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>
20 #include <lib/gdi/gfont.h>
33 fill, fillRegion, clear,
46 setClip, addClip, popClip,
127 /* gRC is the singleton which controls the fifo and dispatches commands */
128 class gRC: public iObject
132 static gRC *instance;
134 static void *thread_wrapper(void *ptr);
135 pthread_t the_thread;
138 queueRingBuffer<gOpcode> queue;
144 void submit(const gOpcode &o)
146 static int collected=0;
149 // if (o.opcode==gOpcode::end||o.opcode==gOpcode::shutdown)
151 queuelock.unlock(collected);
159 static gRC *getInstance();
162 /* gPainter is the user frontend, which in turn sends commands through gRC */
170 void begin(const eRect &rect);
173 gPainter(gDC *dc, eRect rect=eRect());
176 void setBackgroundColor(const gColor &color);
177 void setForegroundColor(const gColor &color);
179 void setFont(gFont *font);
180 /* flags only THESE: */
183 // todo, make mask. you cannot align both right AND center AND block ;)
184 RT_HALIGN_LEFT = 0, /* default */
186 RT_HALIGN_CENTER = 2,
189 RT_VALIGN_TOP = 0, /* default */
190 RT_VALIGN_CENTER = 8,
191 RT_VALIGN_BOTTOM = 16,
195 void renderText(const eRect &position, const std::string &string, int flags=0);
197 void renderPara(eTextPara *para, ePoint offset=ePoint(0, 0));
199 void fill(const eRect &area);
200 void fill(const gRegion &area);
204 void blit(gPixmap *pixmap, ePoint pos, const eRect &what=eRect(), int flags=0);
206 void setPalette(gRGB *colors, int start=0, int len=256);
207 void mergePalette(gPixmap *target);
209 void line(ePoint start, ePoint end);
211 void setOffset(ePoint abs);
212 void moveOffset(ePoint rel);
215 void resetClip(const gRegion &clip);
216 void clip(const gRegion &clip);
222 class gDC: public iObject
226 ePtr<gPixmap> m_pixmap;
228 gColor m_foreground_color, m_background_color;
229 ePtr<gFont> m_current_font;
230 ePoint m_current_offset;
232 std::stack<gRegion> m_clip_stack;
233 gRegion m_current_clip;
236 virtual void exec(gOpcode *opcode);
237 gDC(gPixmap *pixmap);
240 gRegion &getClip() { return m_current_clip; }
241 int getPixmap(ePtr<gPixmap> &pm) { pm = m_pixmap; return 0; }
242 gRGB getRGB(gColor col);
243 virtual eSize getSize() { return m_pixmap->getSize(); }