FLTK 1.3.4
Fl_Device.H
Go to the documentation of this file.
1 //
2 // "$Id: Fl_Device.H 12030 2016-10-16 15:00:02Z manolo $"
3 //
4 // Definition of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device
5 // for the Fast Light Tool Kit (FLTK).
6 //
7 // Copyright 2010-2014 by Bill Spitzak and others.
8 //
9 // This library is free software. Distribution and use rights are outlined in
10 // the file "COPYING" which should have been included with this file. If this
11 // file is missing or damaged, see the license at:
12 //
13 // http://www.fltk.org/COPYING.php
14 //
15 // Please report all bugs and problems on the following page:
16 //
17 // http://www.fltk.org/str.php
18 //
19 
25 #ifndef Fl_Device_H
26 #define Fl_Device_H
27 
28 #include <FL/x.H>
29 #include <FL/Fl_Plugin.H>
30 #include <FL/Fl_Image.H>
31 #include <FL/Fl_Bitmap.H>
32 #include <FL/Fl_Pixmap.H>
33 #include <FL/Fl_RGB_Image.H>
34 #include <stdlib.h>
35 
36 class Fl_Graphics_Driver;
37 class Fl_Font_Descriptor;
39 FL_EXPORT extern Fl_Graphics_Driver *fl_graphics_driver;
40 
49 typedef void (*Fl_Draw_Image_Cb)(void* data,int x,int y,int w,uchar* buf);
50 
51 // typedef what the x,y fields in a point are:
52 #ifdef WIN32
53 typedef int COORD_T;
54 # define XPOINT XPoint
55 #elif defined(__APPLE__)
56 typedef float COORD_T;
57 typedef struct { float x; float y; } QPoint;
58 # define XPOINT QPoint
59 extern float fl_quartz_line_width_;
60 #else
61 typedef short COORD_T;
62 # define XPOINT XPoint
63 #endif
64 
69 class FL_EXPORT Fl_Device {
70 public:
74  static const char *class_id;
84  virtual const char *class_name() {return class_id;};
91  virtual ~Fl_Device() {};
92 };
93 
94 #define FL_REGION_STACK_SIZE 10
95 #define FL_MATRIX_STACK_SIZE 32
96 
110 class FL_EXPORT Fl_Graphics_Driver : public Fl_Device {
111 public:
114  struct matrix {double a, b, c, d, x, y;};
115 private:
116  static const matrix m0;
117  Fl_Font font_; // current font
118  Fl_Fontsize size_; // current font size
119  Fl_Color color_; // current color
120  int sptr;
121  static const int matrix_stack_size = FL_MATRIX_STACK_SIZE;
122  matrix stack[FL_MATRIX_STACK_SIZE];
123  matrix m;
124  int n, p_size, gap_;
125  XPOINT *p;
126  int what;
127  int fl_clip_state_number;
128  int rstackptr;
129  static const int region_stack_max = FL_REGION_STACK_SIZE - 1;
130  Fl_Region rstack[FL_REGION_STACK_SIZE];
131 #ifdef WIN32
132  int numcount;
133  int counts[20];
134 #endif
135  Fl_Font_Descriptor *font_descriptor_;
136  void transformed_vertex0(COORD_T x, COORD_T y);
137  void fixloop();
138 
139 protected:
140 #ifndef FL_DOXYGEN
141  enum {LINE, LOOP, POLYGON, POINT_};
142  inline int vertex_no() { return n; }
143  inline XPOINT *vertices() {return p;}
144  inline int vertex_kind() {return what;}
145 #endif
146 /* ** \brief red color for background and/or mixing if device does not support masking or alpha *
147  uchar bg_r_;
148  ** \brief green color for background and/or mixing if device does not support masking or alpha *
149  uchar bg_g_;
150  ** \brief blue color for background and/or mixing if device does not support masking or alpha *
151  uchar bg_b_; */
152  friend class Fl_Pixmap;
153  friend class Fl_Bitmap;
154  friend class Fl_RGB_Image;
155  friend void fl_rect(int x, int y, int w, int h);
156  friend void fl_rectf(int x, int y, int w, int h);
157  friend void fl_line_style(int style, int width, char* dashes);
158  friend void fl_xyline(int x, int y, int x1);
159  friend void fl_xyline(int x, int y, int x1, int y2);
160  friend void fl_xyline(int x, int y, int x1, int y2, int x3);
161  friend void fl_yxline(int x, int y, int y1);
162  friend void fl_yxline(int x, int y, int y1, int x2);
163  friend void fl_yxline(int x, int y, int y1, int x2, int y3);
164  friend void fl_line(int x, int y, int x1, int y1);
165  friend void fl_line(int x, int y, int x1, int y1, int x2, int y2);
166  friend void fl_draw(const char *str, int n, int x, int y);
167 #ifdef __APPLE__
168  friend void fl_draw(const char *str, int n, float x, float y);
169 #endif
170  friend void fl_draw(int angle, const char *str, int n, int x, int y);
171  friend void fl_rtl_draw(const char *str, int n, int x, int y);
172  friend void fl_font(Fl_Font face, Fl_Fontsize size);
173  friend void fl_color(Fl_Color c);
174  friend void fl_color(uchar r, uchar g, uchar b);
175  friend void fl_point(int x, int y);
176  friend void fl_loop(int x0, int y0, int x1, int y1, int x2, int y2);
177  friend void fl_loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
178  friend void fl_polygon(int x0, int y0, int x1, int y1, int x2, int y2);
179  friend void fl_polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
180  friend void fl_begin_points();
181  friend void fl_begin_line();
182  friend void fl_begin_loop();
183  friend void fl_begin_polygon();
184  friend void fl_vertex(double x, double y);
185  friend void fl_curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3);
186  friend void fl_circle(double x, double y, double r);
187  friend void fl_arc(double x, double y, double r, double start, double end);
188  friend void fl_arc(int x, int y, int w, int h, double a1, double a2);
189  friend void fl_pie(int x, int y, int w, int h, double a1, double a2);
190  friend void fl_end_points();
191  friend void fl_end_line();
192  friend void fl_end_loop();
193  friend void fl_end_polygon();
194  friend void fl_transformed_vertex(double xf, double yf);
195  friend void fl_push_clip(int x, int y, int w, int h);
196  friend int fl_clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H);
197  friend int fl_not_clipped(int x, int y, int w, int h);
198  friend void fl_push_no_clip();
199  friend void fl_pop_clip();
200  friend void fl_begin_complex_polygon();
201  friend void fl_gap();
202  friend void fl_end_complex_polygon();
203  friend void fl_push_matrix();
204  friend void fl_pop_matrix();
205  friend void fl_mult_matrix(double a, double b, double c, double d, double x, double y);
206  friend void fl_scale(double x, double y);
207  friend void fl_scale(double x);
208  friend void fl_translate(double x, double y);
209  friend void fl_rotate(double d);
210  friend double fl_transform_x(double x, double y);
211  friend double fl_transform_y(double x, double y);
212  friend double fl_transform_dx(double x, double y);
213  friend double fl_transform_dy(double x, double y);
214  friend Fl_Region fl_clip_region();
215  friend void fl_clip_region(Fl_Region r);
216  friend void fl_restore_clip();
217 
218  friend void fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L);
219  friend void fl_draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D, int L);
220  friend void fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D);
221  friend FL_EXPORT void fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D);
222  friend FL_EXPORT void gl_start();
223  friend FL_EXPORT void fl_copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
229  virtual void rect(int x, int y, int w, int h);
231  virtual void rectf(int x, int y, int w, int h);
233  virtual void line_style(int style, int width=0, char* dashes=0);
235  virtual void xyline(int x, int y, int x1);
237  virtual void xyline(int x, int y, int x1, int y2);
239  virtual void xyline(int x, int y, int x1, int y2, int x3);
241  virtual void yxline(int x, int y, int y1);
243  virtual void yxline(int x, int y, int y1, int x2);
245  virtual void yxline(int x, int y, int y1, int x2, int y3);
247  virtual void line(int x, int y, int x1, int y1);
249  virtual void line(int x, int y, int x1, int y1, int x2, int y2);
251  virtual void draw(const char *str, int n, int x, int y) {}
252 #ifdef __APPLE__
253  virtual void draw(const char *str, int n, float x, float y) { draw(str, n, (int)(x+0.5), (int)(y+0.5));}
254 #endif
255 
256  virtual void draw(int angle, const char *str, int n, int x, int y) {}
258  virtual void rtl_draw(const char *str, int n, int x, int y) {};
260  virtual void color(Fl_Color c) {color_ = c;}
262  virtual void color(uchar r, uchar g, uchar b) {}
264  virtual void point(int x, int y);
266  virtual void loop(int x0, int y0, int x1, int y1, int x2, int y2);
268  virtual void loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
270  virtual void polygon(int x0, int y0, int x1, int y1, int x2, int y2);
272  virtual void polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
274  virtual void begin_points();
276  virtual void begin_line();
278  virtual void begin_loop();
280  virtual void begin_polygon();
282  virtual void vertex(double x, double y);
284  virtual void curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3);
286  virtual void circle(double x, double y, double r);
288  virtual void arc(double x, double y, double r, double start, double end);
290  virtual void arc(int x, int y, int w, int h, double a1, double a2);
292  virtual void pie(int x, int y, int w, int h, double a1, double a2);
294  virtual void end_points();
296  virtual void end_line();
298  virtual void end_loop();
300  virtual void end_polygon();
302  virtual void begin_complex_polygon();
304  virtual void gap();
306  virtual void end_complex_polygon();
308  virtual void transformed_vertex(double xf, double yf);
310  virtual void push_clip(int x, int y, int w, int h);
312  virtual int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H);
314  virtual int not_clipped(int x, int y, int w, int h);
316  virtual void push_no_clip();
318  virtual void pop_clip();
319 
321  void push_matrix();
323  void pop_matrix();
325  void mult_matrix(double a, double b, double c, double d, double x, double y);
327  inline void scale(double x, double y) { mult_matrix(x,0,0,y,0,0); }
329  inline void scale(double x) { mult_matrix(x,0,0,x,0,0); }
331  inline void translate(double x,double y) { mult_matrix(1,0,0,1,x,y); }
333  void rotate(double d);
335  double transform_x(double x, double y);
337  double transform_y(double x, double y);
339  double transform_dx(double x, double y);
341  double transform_dy(double x, double y);
343  Fl_Region clip_region();
345  void clip_region(Fl_Region r);
347  void restore_clip();
348 
349  // Images
351  virtual void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0) {}
353  virtual void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0) {}
355  virtual void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3) {}
357  virtual void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1) {}
358  // Image classes
364  virtual void draw(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy) {}
370  virtual void draw(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy) {}
376  virtual void draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) {}
377 #if FLTK_ABI_VERSION >= 10301
378  virtual
379 #endif
380  void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
381 
382 public:
383  static const char *class_id;
384  virtual const char *class_name() {return class_id;};
386  virtual void font(Fl_Font face, Fl_Fontsize fsize) {font_ = face; size_ = fsize;}
388  Fl_Font font() {return font_; }
390  Fl_Fontsize size() {return size_; }
392  virtual double width(const char *str, int n) {return 0;}
394  virtual inline double width(unsigned int c) { char ch = (char)c; return width(&ch, 1); }
396  virtual void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h);
398  virtual int height() {return size();}
400  virtual int descent() {return 0;}
402  Fl_Color color() {return color_;}
404  inline Fl_Font_Descriptor *font_descriptor() { return font_descriptor_;}
406  inline void font_descriptor(Fl_Font_Descriptor *d) { font_descriptor_ = d;}
407 #if FLTK_ABI_VERSION >= 10304 || defined(FL_DOXYGEN)
408  virtual
409 #endif
410  int draw_scaled(Fl_Image *img, int X, int Y, int W, int H);
412  virtual ~Fl_Graphics_Driver() { if (p) free(p); }
413 };
414 
415 #if defined(__APPLE__) || defined(FL_DOXYGEN)
416 
422 public:
423  static const char *class_id;
424  const char *class_name() {return class_id;};
425  void color(Fl_Color c);
426  void color(uchar r, uchar g, uchar b);
427  void draw(const char* str, int n, int x, int y);
428 #ifdef __APPLE__
429  void draw(const char *str, int n, float x, float y);
430 #endif
431  void draw(int angle, const char *str, int n, int x, int y);
432  void rtl_draw(const char* str, int n, int x, int y);
433  void font(Fl_Font face, Fl_Fontsize size);
434  void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
435  void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
436  void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy);
437  int draw_scaled(Fl_Image *img, int XP, int YP, int WP, int HP);
438  void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0);
439  void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3);
440  void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0);
441  void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1);
442  double width(const char *str, int n);
443  double width(unsigned int c);
444  void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h);
445  int height();
446  int descent();
447 #if ! defined(FL_DOXYGEN)
448  static Fl_Offscreen create_offscreen_with_alpha(int w, int h);
449 #endif
450  void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
451 };
452 #endif
453 #if defined(WIN32) || defined(FL_DOXYGEN)
454 
459 class FL_EXPORT Fl_GDI_Graphics_Driver : public Fl_Graphics_Driver {
460 public:
461  static const char *class_id;
462  const char *class_name() {return class_id;};
463  void color(Fl_Color c);
464  void color(uchar r, uchar g, uchar b);
465  void draw(const char* str, int n, int x, int y);
466  void draw(int angle, const char *str, int n, int x, int y);
467  void rtl_draw(const char* str, int n, int x, int y);
468  void font(Fl_Font face, Fl_Fontsize size);
469  void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
470  void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
471  void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy);
472  void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0);
473  void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3);
474  void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0);
475  void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1);
476  double width(const char *str, int n);
477  double width(unsigned int c);
478  void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h);
479  int height();
480  int descent();
481 #if ! defined(FL_DOXYGEN)
482  void copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP bitmap,int srcx,int srcy);
483 #endif
484  void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
485 };
486 
493 public:
494  static const char *class_id;
495  const char *class_name() {return class_id;};
496  void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
497  void draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy);
498  int draw_scaled(Fl_Image *img, int XP, int YP, int WP, int HP);
499 };
500 #endif
501 #if !(defined(__APPLE__) || defined(WIN32))
502 
507 class FL_EXPORT Fl_Xlib_Graphics_Driver : public Fl_Graphics_Driver {
508 public:
509  static const char *class_id;
510  const char *class_name() {return class_id;};
511  void color(Fl_Color c);
512  void color(uchar r, uchar g, uchar b);
513  void draw(const char* str, int n, int x, int y);
514  void draw(int angle, const char *str, int n, int x, int y);
515  void rtl_draw(const char* str, int n, int x, int y);
516  void font(Fl_Font face, Fl_Fontsize size);
517  void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
518  void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
519  void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy);
520  void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0);
521  void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3);
522  void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0);
523  void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1);
524  double width(const char *str, int n);
525  double width(unsigned int c);
526  void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h);
527  int height();
528  int descent();
529  void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
530 #if ! defined(FL_DOXYGEN)
531  void copy_offscreen_with_alpha(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
532 #endif
533 };
534 #endif
535 
556 class FL_EXPORT Fl_Surface_Device : public Fl_Device {
558  Fl_Graphics_Driver *_driver;
559  static Fl_Surface_Device *_surface; // the surface that currently receives graphics output
560  static Fl_Surface_Device *default_surface(); // create surface is none exists yet
561 protected:
563  Fl_Surface_Device(Fl_Graphics_Driver *graphics_driver) {_driver = graphics_driver; };
564 public:
565  static const char *class_id;
566  const char *class_name() {return class_id;};
567  virtual void set_current(void);
569  inline void driver(Fl_Graphics_Driver *graphics_driver) {_driver = graphics_driver;};
571  inline Fl_Graphics_Driver *driver() {return _driver; };
574  static inline Fl_Surface_Device *surface() {
575  return _surface ? _surface : default_surface();
576  };
578  virtual ~Fl_Surface_Device() {}
579 };
580 
586 class FL_EXPORT Fl_Display_Device : public Fl_Surface_Device {
587  static Fl_Display_Device *_display; // the platform display device
588 #ifdef __APPLE__
589  friend class Fl_X;
590  friend class Fl_Graphics_Driver;
591  static bool high_res_window_; //< true when drawing to a window of a retina display (Mac OS X only)
592  static bool high_resolution() {return high_res_window_;}
593 #endif
594 public:
595  static const char *class_id;
596  const char *class_name() {return class_id;};
597  Fl_Display_Device(Fl_Graphics_Driver *graphics_driver);
598  static Fl_Display_Device *display_device();
599 };
600 
608 class FL_EXPORT Fl_Device_Plugin : public Fl_Plugin {
609 public:
611  Fl_Device_Plugin(const char *pluginName)
612  : Fl_Plugin(klass(), pluginName) { }
614  virtual const char *klass() { return "fltk:device"; }
616  virtual const char *name() = 0;
622  virtual int print(Fl_Widget* w, int x, int y, int height) = 0;
626 #ifdef FL_LIBRARY
627  virtual
628 #endif
629  Fl_RGB_Image* rectangle_capture(Fl_Widget *widget, int x, int y, int w, int h) {return NULL;}
630 };
631 
632 #endif // Fl_Device_H
633 
634 //
635 // End of "$Id: Fl_Device.H 12030 2016-10-16 15:00:02Z manolo $".
636 //
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:101
virtual void color(uchar r, uchar g, uchar b)
see fl_color(uchar r, uchar g, uchar b).
Definition: Fl_Device.H:262
void fl_end_complex_polygon()
Ends complex filled polygon, and draws.
Definition: fl_draw.H:466
void fl_loop(int x, int y, int x1, int y1, int x2, int y2)
Outlines a 3-sided polygon with lines.
Definition: fl_draw.H:233
double fl_transform_dx(double x, double y)
Transforms distance using current transformation matrix.
Definition: fl_draw.H:482
virtual const char * klass()
Returns the class name.
Definition: Fl_Device.H:614
virtual ~Fl_Surface_Device()
The destructor.
Definition: Fl_Device.H:578
int fl_clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H)
Intersects the rectangle with the current clip region and returns the bounding box of the result...
Definition: fl_draw.H:126
The Fl_Pixmap class supports caching and drawing of colormap (pixmap) images, including transparency...
Definition: Fl_Pixmap.H:41
void fl_point(int x, int y)
Draws a single pixel at the given coordinates.
Definition: fl_draw.H:147
const char * class_name()
Returns the name of the class of this object.
Definition: Fl_Device.H:566
void fl_clip_region(Fl_Region r)
Replaces the top of the clipping stack with a clipping region of any shape.
Definition: fl_draw.H:136
virtual void text_extents(const char *, int n, int &dx, int &dy, int &w, int &h)
see fl_text_extents(const char*, int n, int& dx, int& dy, int& w, int& h).
Definition: Fl_Device.cxx:68
void fl_push_matrix()
Saves the current transformation matrix on the stack.
Definition: fl_draw.H:326
A drawing surface that's susceptible to receive graphical output.
Definition: Fl_Device.H:556
void fl_transformed_vertex(double xf, double yf)
Adds coordinate pair to the vertex list without further transformations.
Definition: fl_draw.H:492
void fl_gap()
Call fl_gap() to separate loops of the path.
Definition: fl_draw.H:462
int fl_not_clipped(int x, int y, int w, int h)
Does the rectangle intersect the current clip region?
Definition: fl_draw.H:114
static const char * class_id
A string that identifies each subclass of Fl_Device.
Definition: Fl_Device.H:74
void fl_rotate(double d)
Concatenates rotation transformation onto the current one.
Definition: fl_draw.H:350
void fl_draw_image(const uchar *buf, int X, int Y, int W, int H, int D=3, int L=0)
Draws an 8-bit per color RGB or luminance image.
Definition: fl_draw.H:685
void fl_color(Fl_Color c)
Sets the color for all subsequent drawing operations.
Definition: fl_draw.H:52
virtual void draw_image_mono(const uchar *buf, int X, int Y, int W, int H, int D=1, int L=0)
see fl_draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D, int L).
Definition: Fl_Device.H:353
virtual const char * class_name()
Returns the name of the class of this object.
Definition: Fl_Device.H:84
virtual void draw_image_mono(Fl_Draw_Image_Cb cb, void *data, int X, int Y, int W, int H, int D=1)
see fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D)...
Definition: Fl_Device.H:357
Fl_Fontsize size()
see fl_size().
Definition: Fl_Device.H:390
This a structure for an actual system font, with junk to help choose it and info on character sizes...
Definition: Fl_Font.H:41
FL_EXPORT void gl_start()
Creates an OpenGL context.
Definition: gl_start.cxx:56
void(* Fl_Draw_Image_Cb)(void *data, int x, int y, int w, uchar *buf)
signature of image generation callback function.
Definition: Fl_Device.H:49
virtual void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy)
Draws an Fl_Pixmap object to the device.
Definition: Fl_Device.H:370
void fl_begin_polygon()
Starts drawing a convex filled polygon.
Definition: fl_draw.H:374
void fl_begin_complex_polygon()
Starts drawing a complex filled polygon.
Definition: fl_draw.H:455
void fl_pop_clip()
Restores the previous clip region.
Definition: fl_draw.H:103
The Mac OS X-specific graphics class.
Definition: Fl_Device.H:421
void fl_begin_line()
Starts drawing a list of lines.
Definition: fl_draw.H:366
Base class for image caching and drawing.
Definition: Fl_Image.H:55
void driver(Fl_Graphics_Driver *graphics_driver)
Sets the graphics driver of this drawing surface.
Definition: Fl_Device.H:569
Fl_Image, Fl_RGB_Image classes.
void scale(double x)
see fl_scale(double x).
Definition: Fl_Device.H:329
The Fl_RGB_Image class supports caching and drawing of full-color images with 1 to 4 channels of colo...
Definition: Fl_Image.H:202
virtual void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy)
see fl_copy_offscreen()
Definition: Fl_Double_Window.cxx:121
virtual void rtl_draw(const char *str, int n, int x, int y)
see fl_rtl_draw(const char *str, int n, int x, int y).
Definition: Fl_Device.H:258
virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0)
Draws the image with a bounding box.
Definition: Fl_Image.cxx:651
void fl_end_line()
Ends list of lines, and draws.
Definition: fl_draw.H:432
virtual int height()
see fl_height().
Definition: Fl_Device.H:398
Fl_Font_Descriptor * font_descriptor()
Returns a pointer to the current Fl_Font_Descriptor for the graphics driver.
Definition: Fl_Device.H:404
virtual void draw(int angle, const char *str, int n, int x, int y)
see fl_draw(int angle, const char *str, int n, int x, int y).
Definition: Fl_Device.H:256
void fl_end_loop()
Ends closed sequence of lines, and draws.
Definition: fl_draw.H:436
void fl_curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3)
Adds a series of points on a Bezier curve to the path.
Definition: fl_draw.H:388
FL_EXPORT Fl_Graphics_Driver * fl_graphics_driver
Points to the driver that currently receives all graphics requests.
Definition: Fl_Device.cxx:50
The Xlib-specific graphics class.
Definition: Fl_Device.H:507
matrix * fl_matrix
Points to the current coordinate transformation matrix.
Definition: Fl_Device.H:224
virtual int descent()
see fl_descent().
Definition: Fl_Device.H:400
const char * class_name()
Returns the name of the class of this object.
Definition: Fl_Device.H:596
double fl_transform_dy(double x, double y)
Transforms distance using current transformation matrix.
Definition: fl_draw.H:487
Fl_RGB_Image * rectangle_capture(Fl_Widget *widget, int x, int y, int w, int h)
captures a rectangle of a widget as an image
Definition: Fl_Device.H:629
void fl_end_polygon()
Ends convex filled polygon, and draws.
Definition: fl_draw.H:440
void draw(const char *str, int n, int x, int y)
see fl_draw(const char *str, int n, int x, int y).
Fl_Color color()
see fl_color(void).
Definition: Fl_Device.H:402
void fl_mult_matrix(double a, double b, double c, double d, double x, double y)
Concatenates another transformation onto the current one.
Definition: fl_draw.H:357
void fl_begin_points()
Starts drawing a list of points.
Definition: fl_draw.H:362
void fl_line_style(int style, int width=0, char *dashes=0)
Sets how to draw lines (the "pen").
Definition: fl_draw.H:177
double fl_transform_x(double x, double y)
Transforms coordinate using the current transformation matrix.
Definition: fl_draw.H:472
void fl_scale(double x, double y)
Concatenates scaling transformation onto the current one.
Definition: fl_draw.H:335
const char * class_name()
Returns the name of the class of this object.
Definition: Fl_Device.H:462
virtual double width(unsigned int c)
see fl_width(unsigned int n).
Definition: Fl_Device.H:394
void fl_end_points()
Ends list of points, and draws.
Definition: fl_draw.H:428
Fl_Font font()
see fl_font(void).
Definition: Fl_Device.H:388
This plugin socket allows the integration of new device drivers for special window or screen types...
Definition: Fl_Device.H:608
const char *const * data() const
Returns a pointer to the current image data array.
Definition: Fl_Image.H:138
Fl_Surface_Device(Fl_Graphics_Driver *graphics_driver)
Constructor that sets the graphics driver to use for the created surface.
Definition: Fl_Device.H:563
A 2D coordinate transformation matrix.
Definition: Fl_Device.H:114
int Fl_Fontsize
Size of a font in pixels.
Definition: Enumerations.H:906
static Fl_Surface_Device * surface()
The current drawing surface.
Definition: Fl_Device.H:574
Fl_Plugin allows link-time and run-time integration of binary modules.
Definition: Fl_Plugin.H:61
void fl_rectf(int x, int y, int w, int h)
Colors with current color a rectangle that exactly fills the given bounding box.
Definition: fl_draw.H:206
virtual void font(Fl_Font face, Fl_Fontsize fsize)
see fl_font(Fl_Font face, Fl_Fontsize size).
Definition: Fl_Device.H:386
FL_EXPORT void fl_draw(const char *str, int x, int y)
Draws a nul-terminated UTF-8 string starting at the given x, y location.
Definition: fl_font.cxx:70
void translate(double x, double y)
see fl_translate(double x, double y).
Definition: Fl_Device.H:331
void fl_begin_loop()
Starts drawing a closed sequence of lines.
Definition: fl_draw.H:370
virtual ~Fl_Graphics_Driver()
The destructor.
Definition: Fl_Device.H:412
virtual int draw_scaled(Fl_Image *img, int X, int Y, int W, int H)
Draws an Fl_Image scaled to width W & height H with top-left corner at X,Y.
Definition: Fl_Image.cxx:674
virtual ~Fl_Device()
Virtual destructor.
Definition: Fl_Device.H:91
void fl_draw_image_mono(const uchar *buf, int X, int Y, int W, int H, int D=1, int L=0)
Draws a gray-scale (1 channel) image.
Definition: fl_draw.H:692
const char * class_name()
Returns the name of the class of this object.
Definition: Fl_Device.H:495
int d() const
Returns the current image depth.
Definition: Fl_Image.H:121
void fl_yxline(int x, int y, int y1)
Draws a vertical line from (x,y) to (x,y1)
Definition: fl_draw.H:270
unsigned int Fl_Color
An FLTK color value; see also Colors.
Definition: Enumerations.H:934
void fl_push_no_clip()
Pushes an empty clip region onto the stack so nothing will be clipped.
Definition: fl_draw.H:95
double fl_transform_y(double x, double y)
Transforms coordinate using the current transformation matrix.
Definition: fl_draw.H:477
int Fl_Font
A font number is an index into the internal font table.
Definition: Enumerations.H:877
virtual void draw_image(const uchar *buf, int X, int Y, int W, int H, int D=3, int L=0)
see fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L).
Definition: Fl_Device.H:351
A virtual class subclassed for each graphics driver FLTK uses.
Definition: Fl_Device.H:110
void fl_translate(double x, double y)
Concatenates translation transformation onto the current one.
Definition: fl_draw.H:345
int w() const
Returns the current image width in pixels.
Definition: Fl_Image.H:111
void scale(double x, double y)
see fl_scale(double x, double y).
Definition: Fl_Device.H:327
void fl_vertex(double x, double y)
Adds a single vertex to the current path.
Definition: fl_draw.H:379
The Fl_Bitmap class supports caching and drawing of mono-color (bitmap) images.
Definition: Fl_Bitmap.H:33
void fl_pop_matrix()
Restores the current transformation matrix from the stack.
Definition: fl_draw.H:330
void fl_polygon(int x, int y, int x1, int y1, int x2, int y2)
Fills a 3-sided polygon.
Definition: fl_draw.H:244
virtual void color(Fl_Color c)
see fl_color(Fl_Color c).
Definition: Fl_Device.H:260
virtual void draw(Fl_RGB_Image *rgb, int XP, int YP, int WP, int HP, int cx, int cy)
Draws an Fl_RGB_Image object to the device.
Definition: Fl_Device.H:364
void fl_xyline(int x, int y, int x1)
Draws a horizontal line from (x,y) to (x1,y)
Definition: fl_draw.H:255
int h() const
Returns the current image height in pixels.
Definition: Fl_Image.H:115
void fl_restore_clip()
Undoes any clobbering of clip done by your program.
Definition: fl_draw.H:129
void fl_copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy)
Copy a rectangular area of the given offscreen buffer into the current drawing destination.
Definition: Fl_Double_Window.cxx:94
Fl_Device_Plugin(const char *pluginName)
The constructor.
Definition: Fl_Device.H:611
The graphics driver used when printing on MSWindows.
Definition: Fl_Device.H:492
void fl_rtl_draw(const char *str, int n, int x, int y)
Draws a UTF-8 string of length n bytes right to left starting at the given x, y location.
Definition: fl_draw.H:632
void fl_line(int x, int y, int x1, int y1)
Draws a line from (x,y) to (x1,y1)
Definition: fl_draw.H:223
const char * class_name()
Returns the name of the class of this object.
Definition: Fl_Device.H:510
void fl_arc(int x, int y, int w, int h, double a1, double a2)
Draw ellipse sections using integer coordinates.
Definition: fl_draw.H:304
virtual void draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy)
Draws an Fl_Bitmap object to the device.
Definition: Fl_Device.H:376
The MSWindows-specific graphics class.
Definition: Fl_Device.H:459
A display to which the computer can draw.
Definition: Fl_Device.H:586
virtual double width(const char *str, int n)
see fl_width(const char *str, int n).
Definition: Fl_Device.H:392
void font_descriptor(Fl_Font_Descriptor *d)
Sets the current Fl_Font_Descriptor for the graphics driver.
Definition: Fl_Device.H:406
const char * class_name()
Returns the name of the class of this object.
Definition: Fl_Device.H:424
virtual void draw(const char *str, int n, int x, int y)
see fl_draw(const char *str, int n, int x, int y).
Definition: Fl_Device.H:251
unsigned char uchar
unsigned char
Definition: fl_types.h:30
void fl_font(Fl_Font face, Fl_Fontsize fsize)
Sets the current font, which is then used in various drawing routines.
Definition: fl_draw.H:509
void fl_rect(int x, int y, int w, int h)
Draws a 1-pixel border inside the given bounding box.
Definition: fl_draw.H:201
virtual void draw_image(Fl_Draw_Image_Cb cb, void *data, int X, int Y, int W, int H, int D=3)
see fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D).
Definition: Fl_Device.H:355
void fl_push_clip(int x, int y, int w, int h)
Intersects the current clip region with a rectangle and pushes this new region onto the stack...
Definition: fl_draw.H:82
void fl_pie(int x, int y, int w, int h, double a1, double a2)
Draw filled ellipse sections using integer coordinates.
Definition: fl_draw.H:317
Fl_Graphics_Driver * driver()
Returns the graphics driver of this drawing surface.
Definition: Fl_Device.H:571
All graphical output devices and all graphics systems.
Definition: Fl_Device.H:69
virtual const char * class_name()
Returns the name of the class of this object.
Definition: Fl_Device.H:384
void fl_circle(double x, double y, double r)
fl_circle() is equivalent to fl_arc(x,y,r,0,360), but may be faster.
Definition: fl_draw.H:424