6 gPainter ist die high-level version. die highlevel daten werden zu low level opcodes ueber
7 die gRC-queue geschickt und landen beim gDC der hardwarespezifisch ist, meist aber auf einen
8 gPixmap aufsetzt (und damit unbeschleunigt ist).
20 #include <lib/base/elock.h>
21 #include <lib/base/message.h>
22 #include <lib/gdi/erect.h>
23 #include <lib/gdi/gpixmap.h>
24 #include <lib/gdi/region.h>
25 #include <lib/gdi/gfont.h>
38 fill, fillRegion, clear,
49 setBackgroundColorRGB,
50 setForegroundColorRGB,
54 setClip, addClip, popClip,
144 /* gRC is the singleton which controls the fifo and dispatches commands */
145 class gRC: public iObject, public Object
149 friend class gPainter;
150 static gRC *instance;
153 static void *thread_wrapper(void *ptr);
154 pthread_t the_thread;
155 pthread_mutex_t mutex;
160 gOpcode queue[MAXSIZE];
163 eFixedMessagePump<int> m_notify_pump;
164 void recv_notify(const int &i);
169 void submit(const gOpcode &o);
171 Signal0<void> notify;
173 static gRC *getInstance();
176 /* gPainter is the user frontend, which in turn sends commands through gRC */
184 void begin(const eRect &rect);
187 gPainter(gDC *dc, eRect rect=eRect());
190 void setBackgroundColor(const gColor &color);
191 void setForegroundColor(const gColor &color);
193 void setBackgroundColor(const gRGB &color);
194 void setForegroundColor(const gRGB &color);
196 void setFont(gFont *font);
197 /* flags only THESE: */
200 // todo, make mask. you cannot align both right AND center AND block ;)
201 RT_HALIGN_LEFT = 0, /* default */
203 RT_HALIGN_CENTER = 2,
206 RT_VALIGN_TOP = 0, /* default */
207 RT_VALIGN_CENTER = 8,
208 RT_VALIGN_BOTTOM = 16,
212 void renderText(const eRect &position, const std::string &string, int flags=0);
214 void renderPara(eTextPara *para, ePoint offset=ePoint(0, 0));
216 void fill(const eRect &area);
217 void fill(const gRegion &area);
226 void blit(gPixmap *pixmap, ePoint pos, const eRect &what=eRect(), int flags=0);
228 void setPalette(gRGB *colors, int start=0, int len=256);
229 void setPalette(gPixmap *source);
230 void mergePalette(gPixmap *target);
232 void line(ePoint start, ePoint end);
234 void setOffset(ePoint abs);
235 void moveOffset(ePoint rel);
238 void resetClip(const gRegion &clip);
239 void clip(const gRegion &clip);
249 class gDC: public iObject
253 ePtr<gPixmap> m_pixmap;
255 gColor m_foreground_color, m_background_color;
256 gRGB m_foreground_color_rgb, m_background_color_rgb;
257 ePtr<gFont> m_current_font;
258 ePoint m_current_offset;
260 std::stack<gRegion> m_clip_stack;
261 gRegion m_current_clip;
264 virtual void exec(gOpcode *opcode);
265 gDC(gPixmap *pixmap);
268 gRegion &getClip() { return m_current_clip; }
269 int getPixmap(ePtr<gPixmap> &pm) { pm = m_pixmap; return 0; }
270 gRGB getRGB(gColor col);
271 virtual eSize size() { return m_pixmap->size(); }
272 virtual int islocked() { return 0; }