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).
19 #include <lib/base/elock.h>
20 #include <lib/base/message.h>
21 #include <lib/gdi/erect.h>
22 #include <lib/gdi/gpixmap.h>
23 #include <lib/gdi/region.h>
24 #include <lib/gdi/gfont.h>
25 #include <lib/gdi/compositing.h>
38 fill, fillRegion, clear,
49 setBackgroundColorRGB,
50 setForegroundColorRGB,
54 setClip, addClip, popClip,
62 enableSpinner, disableSpinner, incrementSpinner,
153 gCompositingData *setCompositing;
155 struct psetShowHideInfo
161 #ifdef USE_LIBVUGLES2
162 struct psetShowItemInfo
184 /* gRC is the singleton which controls the fifo and dispatches commands */
185 class gRC: public iObject, public Object
188 friend class gPainter;
189 static gRC *instance;
192 static void *thread_wrapper(void *ptr);
193 pthread_t the_thread;
194 pthread_mutex_t mutex;
199 gOpcode queue[MAXSIZE];
202 eFixedMessagePump<int> m_notify_pump;
203 void recv_notify(const int &i);
205 ePtr<gDC> m_spinner_dc;
206 int m_spinner_enabled;
208 void enableSpinner();
209 void disableSpinner();
211 ePtr<gCompositingData> m_compositing;
213 int m_prev_idle_count;
218 void submit(const gOpcode &o);
220 Signal0<void> notify;
222 void setSpinnerDC(gDC *dc) { m_spinner_dc = dc; }
224 static gRC *getInstance();
227 /* gPainter is the user frontend, which in turn sends commands through gRC */
235 void begin(const eRect &rect);
238 gPainter(gDC *dc, eRect rect=eRect());
241 void setBackgroundColor(const gColor &color);
242 void setForegroundColor(const gColor &color);
244 void setBackgroundColor(const gRGB &color);
245 void setForegroundColor(const gRGB &color);
247 void setFont(gFont *font);
248 /* flags only THESE: */
251 // todo, make mask. you cannot align both right AND center AND block ;)
252 RT_HALIGN_LEFT = 0, /* default */
254 RT_HALIGN_CENTER = 2,
257 RT_VALIGN_TOP = 0, /* default */
258 RT_VALIGN_CENTER = 8,
259 RT_VALIGN_BOTTOM = 16,
263 void renderText(const eRect &position, const std::string &string, int flags=0, gRGB bordercolor=gRGB(), int border=0);
265 void renderPara(eTextPara *para, ePoint offset=ePoint(0, 0));
267 void fill(const eRect &area);
268 void fill(const gRegion &area);
276 BT_SCALE = 4 /* will be automatically set by blitScale */
279 void blit(gPixmap *pixmap, ePoint pos, const eRect &clip=eRect(), int flags=0);
280 void blitScale(gPixmap *pixmap, const eRect &pos, const eRect &clip=eRect(), int flags=0, int aflags = BT_SCALE);
282 void setPalette(gRGB *colors, int start=0, int len=256);
283 void setPalette(gPixmap *source);
284 void mergePalette(gPixmap *target);
286 void line(ePoint start, ePoint end);
288 void setOffset(ePoint abs);
289 void moveOffset(ePoint rel);
292 void resetClip(const gRegion &clip);
293 void clip(const gRegion &clip);
299 void setCompositing(gCompositingData *comp);
302 void sendShow(ePoint point, eSize size);
303 void sendHide(ePoint point, eSize size);
304 #ifdef USE_LIBVUGLES2
305 void sendShowItem(long dir, ePoint point, eSize size);
306 void setFlush(bool val);
307 void setView(eSize size);
311 class gDC: public iObject
315 ePtr<gPixmap> m_pixmap;
317 gColor m_foreground_color, m_background_color;
318 gRGB m_foreground_color_rgb, m_background_color_rgb;
319 ePtr<gFont> m_current_font;
320 ePoint m_current_offset;
322 std::stack<gRegion> m_clip_stack;
323 gRegion m_current_clip;
325 ePtr<gPixmap> m_spinner_saved, m_spinner_temp;
326 ePtr<gPixmap> *m_spinner_pic;
328 int m_spinner_num, m_spinner_i;
330 virtual void exec(const gOpcode *opcode);
331 gDC(gPixmap *pixmap);
334 gRegion &getClip() { return m_current_clip; }
335 int getPixmap(ePtr<gPixmap> &pm) { pm = m_pixmap; return 0; }
336 gRGB getRGB(gColor col);
337 virtual eSize size() { return m_pixmap->size(); }
338 virtual int islocked() { return 0; }
340 virtual void enableSpinner();
341 virtual void disableSpinner();
342 virtual void incrementSpinner();
343 virtual void setSpinner(eRect pos, ePtr<gPixmap> *pic, int len);