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,
151 gCompositingData *setCompositing;
153 struct psetShowHideInfo
158 #ifdef USE_LIBVUGLES2
169 /* gRC is the singleton which controls the fifo and dispatches commands */
170 class gRC: public iObject, public Object
173 friend class gPainter;
174 static gRC *instance;
177 static void *thread_wrapper(void *ptr);
178 pthread_t the_thread;
179 pthread_mutex_t mutex;
184 gOpcode queue[MAXSIZE];
187 eFixedMessagePump<int> m_notify_pump;
188 void recv_notify(const int &i);
190 ePtr<gDC> m_spinner_dc;
191 int m_spinner_enabled;
193 void enableSpinner();
194 void disableSpinner();
196 ePtr<gCompositingData> m_compositing;
198 int m_prev_idle_count;
203 void submit(const gOpcode &o);
205 Signal0<void> notify;
207 void setSpinnerDC(gDC *dc) { m_spinner_dc = dc; }
209 static gRC *getInstance();
212 /* gPainter is the user frontend, which in turn sends commands through gRC */
220 void begin(const eRect &rect);
223 gPainter(gDC *dc, eRect rect=eRect());
226 void setBackgroundColor(const gColor &color);
227 void setForegroundColor(const gColor &color);
229 void setBackgroundColor(const gRGB &color);
230 void setForegroundColor(const gRGB &color);
232 void setFont(gFont *font);
233 /* flags only THESE: */
236 // todo, make mask. you cannot align both right AND center AND block ;)
237 RT_HALIGN_LEFT = 0, /* default */
239 RT_HALIGN_CENTER = 2,
242 RT_VALIGN_TOP = 0, /* default */
243 RT_VALIGN_CENTER = 8,
244 RT_VALIGN_BOTTOM = 16,
248 void renderText(const eRect &position, const std::string &string, int flags=0, gRGB bordercolor=gRGB(), int border=0);
250 void renderPara(eTextPara *para, ePoint offset=ePoint(0, 0));
252 void fill(const eRect &area);
253 void fill(const gRegion &area);
261 BT_SCALE = 4 /* will be automatically set by blitScale */
264 void blit(gPixmap *pixmap, ePoint pos, const eRect &clip=eRect(), int flags=0);
265 void blitScale(gPixmap *pixmap, const eRect &pos, const eRect &clip=eRect(), int flags=0, int aflags = BT_SCALE);
267 void setPalette(gRGB *colors, int start=0, int len=256);
268 void setPalette(gPixmap *source);
269 void mergePalette(gPixmap *target);
271 void line(ePoint start, ePoint end);
273 void setOffset(ePoint abs);
274 void moveOffset(ePoint rel);
277 void resetClip(const gRegion &clip);
278 void clip(const gRegion &clip);
284 void setCompositing(gCompositingData *comp);
287 void sendShow(ePoint point, eSize size);
288 void sendHide(ePoint point, eSize size);
289 #ifdef USE_LIBVUGLES2
290 void setView(eSize size);
294 class gDC: public iObject
298 ePtr<gPixmap> m_pixmap;
300 gColor m_foreground_color, m_background_color;
301 gRGB m_foreground_color_rgb, m_background_color_rgb;
302 ePtr<gFont> m_current_font;
303 ePoint m_current_offset;
305 std::stack<gRegion> m_clip_stack;
306 gRegion m_current_clip;
308 ePtr<gPixmap> m_spinner_saved, m_spinner_temp;
309 ePtr<gPixmap> *m_spinner_pic;
311 int m_spinner_num, m_spinner_i;
313 virtual void exec(const gOpcode *opcode);
314 gDC(gPixmap *pixmap);
317 gRegion &getClip() { return m_current_clip; }
318 int getPixmap(ePtr<gPixmap> &pm) { pm = m_pixmap; return 0; }
319 gRGB getRGB(gColor col);
320 virtual eSize size() { return m_pixmap->size(); }
321 virtual int islocked() { return 0; }
323 virtual void enableSpinner();
324 virtual void disableSpinner();
325 virtual void incrementSpinner();
326 virtual void setSpinner(eRect pos, ePtr<gPixmap> *pic, int len);