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,
144 gCompositingData *setCompositing;
150 /* gRC is the singleton which controls the fifo and dispatches commands */
151 class gRC: public iObject, public Object
154 friend class gPainter;
155 static gRC *instance;
158 static void *thread_wrapper(void *ptr);
159 pthread_t the_thread;
160 pthread_mutex_t mutex;
165 gOpcode queue[MAXSIZE];
168 eFixedMessagePump<int> m_notify_pump;
169 void recv_notify(const int &i);
171 ePtr<gDC> m_spinner_dc;
172 int m_spinner_enabled;
174 void enableSpinner();
175 void disableSpinner();
177 ePtr<gCompositingData> m_compositing;
183 void submit(const gOpcode &o);
185 Signal0<void> notify;
187 void setSpinnerDC(gDC *dc) { m_spinner_dc = dc; }
189 static gRC *getInstance();
192 /* gPainter is the user frontend, which in turn sends commands through gRC */
200 void begin(const eRect &rect);
203 gPainter(gDC *dc, eRect rect=eRect());
206 void setBackgroundColor(const gColor &color);
207 void setForegroundColor(const gColor &color);
209 void setBackgroundColor(const gRGB &color);
210 void setForegroundColor(const gRGB &color);
212 void setFont(gFont *font);
213 /* flags only THESE: */
216 // todo, make mask. you cannot align both right AND center AND block ;)
217 RT_HALIGN_LEFT = 0, /* default */
219 RT_HALIGN_CENTER = 2,
222 RT_VALIGN_TOP = 0, /* default */
223 RT_VALIGN_CENTER = 8,
224 RT_VALIGN_BOTTOM = 16,
228 void renderText(const eRect &position, const std::string &string, int flags=0);
230 void renderPara(eTextPara *para, ePoint offset=ePoint(0, 0));
232 void fill(const eRect &area);
233 void fill(const gRegion &area);
241 BT_SCALE = 4 /* will be automatically set by blitScale */
244 void blit(gPixmap *pixmap, ePoint pos, const eRect &clip=eRect(), int flags=0);
245 void blitScale(gPixmap *pixmap, const eRect &pos, const eRect &clip=eRect(), int flags=0, int aflags = BT_SCALE);
247 void setPalette(gRGB *colors, int start=0, int len=256);
248 void setPalette(gPixmap *source);
249 void mergePalette(gPixmap *target);
251 void line(ePoint start, ePoint end);
253 void setOffset(ePoint abs);
254 void moveOffset(ePoint rel);
257 void resetClip(const gRegion &clip);
258 void clip(const gRegion &clip);
264 void setCompositing(gCompositingData *comp);
269 class gDC: public iObject
273 ePtr<gPixmap> m_pixmap;
275 gColor m_foreground_color, m_background_color;
276 gRGB m_foreground_color_rgb, m_background_color_rgb;
277 ePtr<gFont> m_current_font;
278 ePoint m_current_offset;
280 std::stack<gRegion> m_clip_stack;
281 gRegion m_current_clip;
283 ePtr<gPixmap> m_spinner_saved, m_spinner_temp;
284 ePtr<gPixmap> *m_spinner_pic;
286 int m_spinner_num, m_spinner_i;
288 virtual void exec(gOpcode *opcode);
289 gDC(gPixmap *pixmap);
292 gRegion &getClip() { return m_current_clip; }
293 int getPixmap(ePtr<gPixmap> &pm) { pm = m_pixmap; return 0; }
294 gRGB getRGB(gColor col);
295 virtual eSize size() { return m_pixmap->size(); }
296 virtual int islocked() { return 0; }
298 void enableSpinner();
299 void disableSpinner();
300 void incrementSpinner();
301 void setSpinner(eRect pos, ePtr<gPixmap> *pic, int len);