29 #include <FL/Fl_Plugin.H>
31 #include <FL/Fl_Bitmap.H>
32 #include <FL/Fl_Pixmap.H>
33 #include <FL/Fl_RGB_Image.H>
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_;
61 typedef short COORD_T;
62 # define XPOINT XPoint
94 #define FL_REGION_STACK_SIZE 10
95 #define FL_MATRIX_STACK_SIZE 32
114 struct matrix {
double a, b, c, d, x, y;};
121 static const int matrix_stack_size = FL_MATRIX_STACK_SIZE;
122 matrix stack[FL_MATRIX_STACK_SIZE];
127 int fl_clip_state_number;
129 static const int region_stack_max = FL_REGION_STACK_SIZE - 1;
130 Fl_Region rstack[FL_REGION_STACK_SIZE];
136 void transformed_vertex0(COORD_T x, COORD_T y);
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;}
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);
168 friend void fl_draw(
const char *str,
int n,
float x,
float y);
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);
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);
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);
196 friend int fl_clip_box(
int x,
int y,
int w,
int h,
int &X,
int &Y,
int &W,
int &H);
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);
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) {}
253 virtual void draw(
const char *str,
int n,
float x,
float y) {
draw(str, n, (
int)(x+0.5), (
int)(y+0.5));}
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) {};
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();
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();
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);
351 virtual void draw_image(
const uchar* buf,
int X,
int Y,
int W,
int H,
int D=3,
int L=0) {}
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
380 void copy_offscreen(
int x,
int y,
int w,
int h, Fl_Offscreen pixmap,
int srcx,
int srcy);
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);
407 #if FLTK_ABI_VERSION >= 10304 || defined(FL_DOXYGEN)
410 int draw_scaled(
Fl_Image *img,
int X,
int Y,
int W,
int H);
415 #if defined(__APPLE__) || defined(FL_DOXYGEN)
423 static const char *class_id;
427 void draw(
const char* str,
int n,
int x,
int y);
429 void draw(
const char *str,
int n,
float x,
float y);
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);
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);
438 void draw_image(
const uchar* buf,
int X,
int Y,
int W,
int H,
int D=3,
int L=0);
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);
447 #if ! defined(FL_DOXYGEN)
448 static Fl_Offscreen create_offscreen_with_alpha(
int w,
int h);
450 void copy_offscreen(
int x,
int y,
int w,
int h, Fl_Offscreen pixmap,
int srcx,
int srcy);
453 #if defined(WIN32) || defined(FL_DOXYGEN)
461 static const char *class_id;
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);
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);
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);
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);
484 void copy_offscreen(
int x,
int y,
int w,
int h, Fl_Offscreen pixmap,
int srcx,
int srcy);
494 static const char *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);
501 #if !(defined(__APPLE__) || defined(WIN32))
509 static const char *class_id;
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);
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);
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);
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);
567 virtual void set_current(
void);
575 return _surface ? _surface : default_surface();
591 static bool high_res_window_;
592 static bool high_resolution() {
return high_res_window_;}
595 static const char *class_id;
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;
632 #endif // Fl_Device_H