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,
149 gCompositingData *setCompositing;
151 struct psetShowHideInfo
156 #ifdef USE_LIBVUGLES2
167 /* gRC is the singleton which controls the fifo and dispatches commands */
168 class gRC: public iObject, public Object
171 friend class gPainter;
172 static gRC *instance;
175 static void *thread_wrapper(void *ptr);
176 pthread_t the_thread;
177 pthread_mutex_t mutex;
182 gOpcode queue[MAXSIZE];
185 eFixedMessagePump<int> m_notify_pump;
186 void recv_notify(const int &i);
188 ePtr<gDC> m_spinner_dc;
189 int m_spinner_enabled;
191 void enableSpinner();
192 void disableSpinner();
194 ePtr<gCompositingData> m_compositing;
196 int m_prev_idle_count;
201 void submit(const gOpcode &o);
203 Signal0<void> notify;
205 void setSpinnerDC(gDC *dc) { m_spinner_dc = dc; }
207 static gRC *getInstance();
210 /* gPainter is the user frontend, which in turn sends commands through gRC */
218 void begin(const eRect &rect);
221 gPainter(gDC *dc, eRect rect=eRect());
224 void setBackgroundColor(const gColor &color);
225 void setForegroundColor(const gColor &color);
227 void setBackgroundColor(const gRGB &color);
228 void setForegroundColor(const gRGB &color);
230 void setFont(gFont *font);
231 /* flags only THESE: */
234 // todo, make mask. you cannot align both right AND center AND block ;)
235 RT_HALIGN_LEFT = 0, /* default */
237 RT_HALIGN_CENTER = 2,
240 RT_VALIGN_TOP = 0, /* default */
241 RT_VALIGN_CENTER = 8,
242 RT_VALIGN_BOTTOM = 16,
246 void renderText(const eRect &position, const std::string &string, int flags=0);
248 void renderPara(eTextPara *para, ePoint offset=ePoint(0, 0));
250 void fill(const eRect &area);
251 void fill(const gRegion &area);
259 BT_SCALE = 4 /* will be automatically set by blitScale */
262 void blit(gPixmap *pixmap, ePoint pos, const eRect &clip=eRect(), int flags=0);
263 void blitScale(gPixmap *pixmap, const eRect &pos, const eRect &clip=eRect(), int flags=0, int aflags = BT_SCALE);
265 void setPalette(gRGB *colors, int start=0, int len=256);
266 void setPalette(gPixmap *source);
267 void mergePalette(gPixmap *target);
269 void line(ePoint start, ePoint end);
271 void setOffset(ePoint abs);
272 void moveOffset(ePoint rel);
275 void resetClip(const gRegion &clip);
276 void clip(const gRegion &clip);
282 void setCompositing(gCompositingData *comp);
285 void sendShow(ePoint point, eSize size);
286 void sendHide(ePoint point, eSize size);
287 #ifdef USE_LIBVUGLES2
288 void setView(eSize size);
292 class gDC: public iObject
296 ePtr<gPixmap> m_pixmap;
298 gColor m_foreground_color, m_background_color;
299 gRGB m_foreground_color_rgb, m_background_color_rgb;
300 ePtr<gFont> m_current_font;
301 ePoint m_current_offset;
303 std::stack<gRegion> m_clip_stack;
304 gRegion m_current_clip;
306 ePtr<gPixmap> m_spinner_saved, m_spinner_temp;
307 ePtr<gPixmap> *m_spinner_pic;
309 int m_spinner_num, m_spinner_i;
311 virtual void exec(const gOpcode *opcode);
312 gDC(gPixmap *pixmap);
315 gRegion &getClip() { return m_current_clip; }
316 int getPixmap(ePtr<gPixmap> &pm) { pm = m_pixmap; return 0; }
317 gRGB getRGB(gColor col);
318 virtual eSize size() { return m_pixmap->size(); }
319 virtual int islocked() { return 0; }
321 virtual void enableSpinner();
322 virtual void disableSpinner();
323 virtual void incrementSpinner();
324 virtual void setSpinner(eRect pos, ePtr<gPixmap> *pic, int len);