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).
14 #include <lib/base/estring.h>
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>
45 setClip, addClip, popClip,
119 /* gRC is the singleton which controls the fifo and dispatches commands */
120 class gRC: public iObject
124 static gRC *instance;
126 static void *thread_wrapper(void *ptr);
127 pthread_t the_thread;
130 queueRingBuffer<gOpcode> queue;
136 void submit(const gOpcode &o)
138 static int collected=0;
141 // if (o.opcode==gOpcode::end||o.opcode==gOpcode::shutdown)
143 queuelock.unlock(collected);
151 static gRC *getInstance();
154 /* gPainter is the user frontend, which in turn sends commands through gRC */
162 void begin(const eRect &rect);
165 gPainter(gDC *dc, eRect rect=eRect());
168 void setBackgroundColor(const gColor &color);
169 void setForegroundColor(const gColor &color);
171 void setFont(gFont *font);
172 void renderText(const eRect &position, const std::string &string, int flags=0);
173 void renderPara(eTextPara *para, ePoint offset=ePoint(0, 0));
175 void fill(const eRect &area);
179 void blit(gPixmap *pixmap, ePoint pos, const eRect &what=eRect(), int flags=0);
181 void setPalette(gRGB *colors, int start=0, int len=256);
182 void mergePalette(gPixmap *target);
184 void line(ePoint start, ePoint end);
186 void setOffset(ePoint abs);
187 void moveOffset(ePoint rel);
190 void resetClip(const gRegion &clip);
191 void clip(const gRegion &clip);
197 class gDC: public iObject
201 ePtr<gPixmap> m_pixmap;
203 gColor m_foreground_color, m_background_color;
204 ePtr<gFont> m_current_font;
205 ePoint m_current_offset;
207 std::stack<gRegion> m_clip_stack;
208 gRegion m_current_clip;
211 virtual void exec(gOpcode *opcode);
212 gDC(gPixmap *pixmap);
215 gRegion &getClip() { return m_current_clip; }
216 int getPixmap(ePtr<gPixmap> &pm) { pm = m_pixmap; return 0; }
217 gRGB getRGB(gColor col);
218 virtual eSize getSize() { return m_pixmap->getSize(); }