summaryrefslogtreecommitdiff
path: root/FL
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2010-03-14 18:07:24 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2010-03-14 18:07:24 +0000
commit998cc6df521a115454727d1ecf6bc7d4fee96f68 (patch)
tree70a1c9afffb294a75bd38484c2e6e4a042ac3426 /FL
parent5bc66fafc348c547870bbf51c9c4a7215ad4ff25 (diff)
Merge of branch-1.3-Fl_Printer, with the following main changes:
(1) adding Fl_Device class (and more) for device abstraction (2) adding Fl_Pinter class (and more) for printing support. Todo: Code cleanup, update dependencies, remove/replace test print window. I'm looking into converting the test window popup in a global shortcut that would pop up the print dialog now... git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7263 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL')
-rw-r--r--FL/Fl_Device.H203
-rw-r--r--FL/Fl_Gl_Printer.H33
-rw-r--r--FL/Fl_Printer.H539
-rw-r--r--FL/fl_draw.H153
-rw-r--r--FL/mac.H6
-rw-r--r--FL/win32.H6
6 files changed, 886 insertions, 54 deletions
diff --git a/FL/Fl_Device.H b/FL/Fl_Device.H
new file mode 100644
index 000000000..bf611e1d8
--- /dev/null
+++ b/FL/Fl_Device.H
@@ -0,0 +1,203 @@
+/*
+ * Fl_Device.H
+ *
+ */
+
+#ifndef Fl_Device_H
+#define Fl_Device_H
+
+#include <FL/x.H>
+#ifdef WIN32
+#include <Commdlg.h>
+#elif defined(__APPLE__)
+#else
+#include <stdio.h>
+#endif
+
+class Fl_Image;
+class Fl_RGB_Image;
+class Fl_Pixmap;
+class Fl_Bitmap;
+class Fl_Display;
+extern Fl_Display *fl_display_device;
+typedef void (*Fl_Draw_Image_Cb)(void* ,int,int,int,uchar*);
+
+/**
+ @brief A pure virtual class subclassed to send graphics output to display, local files, or printers.
+ */
+class Fl_Device {
+protected:
+ int type_;
+ uchar bg_r_, bg_g_, bg_b_; // color for background and/or mixing if particular device does not support masking and/or alpha
+ friend void fl_rect(int x, int y, int w, int h);
+ friend void fl_rectf(int x, int y, int w, int h);
+ friend void fl_line_style(int style, int width, char* dashes);
+ friend void fl_xyline(int x, int y, int x1);
+ friend void fl_xyline(int x, int y, int x1, int y2);
+ friend void fl_xyline(int x, int y, int x1, int y2, int x3);
+ friend void fl_yxline(int x, int y, int y1);
+ friend void fl_yxline(int x, int y, int y1, int x2);
+ friend void fl_yxline(int x, int y, int y1, int x2, int y3);
+ friend void fl_line(int x, int y, int x1, int y1);
+ friend void fl_line(int x, int y, int x1, int y1, int x2, int y2);
+ friend void fl_draw(const char *str, int n, int x, int y);
+ friend void fl_draw(int angle, const char *str, int n, int x, int y);
+ friend void fl_font(Fl_Font face, Fl_Fontsize size);
+ friend void fl_color(Fl_Color c);
+ friend void fl_color(uchar r, uchar g, uchar b);
+ friend void fl_point(int x, int y);
+ friend void fl_loop(int x0, int y0, int x1, int y1, int x2, int y2);
+ friend void fl_loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
+ friend void fl_polygon(int x0, int y0, int x1, int y1, int x2, int y2);
+ friend void fl_polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
+ friend void fl_concat();
+ friend void fl_reconcat();
+ friend void fl_begin_points();
+ friend void fl_begin_line();
+ friend void fl_begin_loop();
+ friend void fl_begin_polygon();
+ friend void fl_vertex(double x, double y);
+ friend void fl_curve(double x, double y, double x1, double y1, double x2, double y2, double x3, double y3);
+ friend void fl_circle(double x, double y, double r);
+ friend void fl_arc(double x, double y, double r, double start, double a);
+ friend void fl_arc(int x, int y, int w, int h, double a1, double a2);
+ friend void fl_pie(int x, int y, int w, int h, double a1, double a2);
+ friend void fl_end_points();
+ friend void fl_end_line();
+ friend void fl_end_loop();
+ friend void fl_end_polygon();
+ friend void fl_transformed_vertex(double x, double y);
+ friend void fl_push_clip(int x, int y, int w, int h);
+ friend int fl_clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H);
+ friend int fl_not_clipped(int x, int y, int w, int h);
+ friend void fl_push_no_clip();
+ friend void fl_pop_clip();
+ friend void fl_begin_complex_polygon();
+ friend void fl_gap();
+ friend void fl_end_complex_polygon();
+ friend void fl_draw_image(const uchar*, int,int,int,int, int delta, int ldelta);
+ friend void fl_draw_image_mono(const uchar*, int,int,int,int, int delta, int ld);
+ friend void fl_draw_image(Fl_Draw_Image_Cb, void*, int,int,int,int, int delta);
+ friend void fl_draw_image_mono(Fl_Draw_Image_Cb, void*, int,int,int,int, int delta);
+
+ virtual void rect(int x, int y, int w, int h);
+ virtual void rectf(int x, int y, int w, int h);
+ virtual void line_style(int style, int width=0, char* dashes=0);
+ virtual void xyline(int x, int y, int x1);
+ virtual void xyline(int x, int y, int x1, int y2);
+ virtual void xyline(int x, int y, int x1, int y2, int x3);
+ virtual void yxline(int x, int y, int y1);
+ virtual void yxline(int x, int y, int y1, int x2);
+ virtual void yxline(int x, int y, int y1, int x2, int y3);
+ virtual void line(int x, int y, int x1, int y1);
+ virtual void line(int x, int y, int x1, int y1, int x2, int y2);
+ virtual void draw(const char *str, int n, int x, int y);
+ virtual void draw(int angle, const char *str, int n, int x, int y);
+ virtual void font(Fl_Font face, Fl_Fontsize size);
+ virtual void color(Fl_Color c);
+ virtual void color(uchar r, uchar g, uchar b);
+ virtual void point(int x, int y);
+ virtual void loop(int x0, int y0, int x1, int y1, int x2, int y2);
+ virtual void loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
+ virtual void polygon(int x0, int y0, int x1, int y1, int x2, int y2);
+ virtual void polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
+ virtual void begin_points();
+ virtual void begin_line();
+ virtual void begin_loop();
+ virtual void begin_polygon();
+ virtual void vertex(double x, double y);
+ virtual void curve(double x, double y, double x1, double y1, double x2, double y2, double x3, double y3);
+ virtual void circle(double x, double y, double r);
+ virtual void arc(double x, double y, double r, double start, double a);
+ virtual void arc(int x, int y, int w, int h, double a1, double a2);
+ virtual void pie(int x, int y, int w, int h, double a1, double a2);
+ virtual void end_points();
+ virtual void end_line();
+ virtual void end_loop();
+ virtual void end_polygon();
+ virtual void begin_complex_polygon();
+ virtual void gap();
+ virtual void end_complex_polygon();
+ virtual void transformed_vertex(double x, double y);
+ virtual void push_clip(int x, int y, int w, int h);
+ virtual int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H);
+ virtual int not_clipped(int x, int y, int w, int h);
+ virtual void push_no_clip();
+ virtual void pop_clip();
+ // Images
+ virtual void draw_image(const uchar*, int,int,int,int, int delta=3, int ldelta=0);
+ virtual void draw_image_mono(const uchar*, int,int,int,int, int delta=1, int ld=0);
+ virtual void draw_image(Fl_Draw_Image_Cb, void*, int,int,int,int, int delta=3);
+ virtual void draw_image_mono(Fl_Draw_Image_Cb, void*, int,int,int,int, int delta=1);
+ // Image classes
+ virtual void draw(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy);
+ virtual void draw(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy);
+ virtual void draw(Fl_Bitmap * bmp,int XP, int YP, int WP, int HP, int cx, int cy);
+
+public:
+ enum device_types {
+ xlib_display = 0, quartz_display, gdi_display,
+ gdi_printer = 256, quartz_printer, postscript_device
+ };
+ /**
+ @brief An RTTI emulation of device classes. It returns values < 256 if it is a screen device
+ */
+ int type() {return type_;};
+ /**
+ @brief Sets this device (display, local file, printer) as the target of future graphics calls.
+ *
+ @return The current target device of graphics calls.
+ */
+ virtual Fl_Device *set_current();
+
+ virtual ~Fl_Device() {};
+
+ /**
+ @brief Returns the current target device of graphics calls.
+ */
+ static Fl_Device *current();
+
+ /**
+ @brief Returns the platform's display device.
+ */
+ static Fl_Display *display_device() { return fl_display_device; };
+
+};
+extern Fl_Device *fl_device;
+
+/**
+ @brief A virtual class subclassed for OS-specific display graphics.
+ */
+class Fl_Display : public Fl_Device {
+ friend class Fl_PSfile_Device; //RK: temporary hack for font sizes
+};
+
+#if defined(__APPLE__) || defined(FL_DOXYGEN)
+/**
+ @brief The Mac OS X-specific display graphics class.
+ */
+class Fl_Quartz_Display : public Fl_Display {
+public:
+ Fl_Quartz_Display() { type_ = quartz_display; };
+};
+#endif
+#if defined(WIN32) || defined(FL_DOXYGEN)
+/**
+ @brief The MSWindows-specific display graphics class.
+ */
+class Fl_GDI_Display : public Fl_Display {
+public:
+ Fl_GDI_Display() { type_ = gdi_display; };
+};
+#endif
+#if !( defined(__APPLE__) || defined(WIN32)) || defined(FL_DOXYGEN)
+/**
+ @brief The X11-specific display graphics class.
+ */
+class Fl_Xlib_Display : public Fl_Display {
+public:
+ Fl_Xlib_Display() { type_ = xlib_display; };
+};
+#endif
+
+#endif // Fl_Device_H
diff --git a/FL/Fl_Gl_Printer.H b/FL/Fl_Gl_Printer.H
new file mode 100644
index 000000000..66929c570
--- /dev/null
+++ b/FL/Fl_Gl_Printer.H
@@ -0,0 +1,33 @@
+/*
+ * Fl_Gl_Printer.H
+ *
+ */
+
+#include <FL/Fl_Printer.H>
+#include <FL/Fl_Gl_Window.H>
+
+/**
+ * @brief To print Fl_Gl_Window's.
+ *
+ Because Fl_Printer::print_widget() prints only the background of Fl_Gl_Window's,
+ this class is to be used to print them.
+ */
+class Fl_Gl_Printer : public Fl_Printer {
+ public:
+ /**
+ @brief The constructor.
+ */
+ Fl_Gl_Printer(void) : Fl_Printer() {}
+
+ /**
+ @brief Prints an Fl_Gl_Window.
+ *
+ Under MSWindows, take care to move the print dialog window(s) out of the target OpenGL window(s)
+ before closing them.
+ @param[in] glw an Fl_Gl_Window to be printed.
+ @param[in] delta_x Optional horizontal offset for positioning the window relatively
+ to the current origin of graphics functions.
+ @param[in] delta_y Same as above, vertically.
+ */
+ void print_gl_window(Fl_Gl_Window *glw, int delta_x = 0, int delta_y = 0);
+};
diff --git a/FL/Fl_Printer.H b/FL/Fl_Printer.H
new file mode 100644
index 000000000..a6d7848f3
--- /dev/null
+++ b/FL/Fl_Printer.H
@@ -0,0 +1,539 @@
+#ifndef Fl_Printer_H
+#define Fl_Printer_H
+
+#include <FL/Fl_Device.H>
+#include <FL/fl_draw.H>
+#include <FL/Fl_Pixmap.H>
+#include <FL/Fl_RGB_Image.H>
+#include <FL/Fl_Bitmap.H>
+#include <stdio.h>
+
+/**
+ * @brief Provides an OS-independent interface to printing.
+ *
+ It allows to use all FLTK drawing, color, text, and clip functions, and to have them operate
+ on printed page(s). There are two main, non exclusive, ways to use it.
+ <ul><li>Print any widget (standard, custom, Fl_Window except Fl_Gl_Window) as it appears
+ on screen, with optional translation and scaling. This is done by calling print_widget()
+ or print_window_part().
+ <li>Use a series of FLTK graphics commands (e.g., font, text, lines, colors, clip) to
+ compose a page appropriately shaped for printing.
+ </ul>
+ In both cases, begin by start_job(), start_page(), printable_rect() and origin() calls
+ and finish by end_page() and end_job() calls.
+ \see class Fl_Gl_Printer to print Fl_Gl_Window's.
+ */
+class
+#ifndef FL_DOXYGEN
+ Fl_Virtual_Printer
+#else
+ Fl_Printer
+#endif
+ : public Fl_Device {
+ friend class Fl_Pixmap;
+ friend class Fl_RGB_Image;
+ friend class Fl_Bitmap;
+private:
+ struct chain_elt {
+ Fl_Image *image;
+ const uchar *data;
+ struct chain_elt *next;
+ };
+ void add_image(Fl_Image *image, const uchar *data); // adds an image to the page image list
+ void traverse(Fl_Widget *widget); // finds subwindows of widget and prints them
+protected:
+ int y_offset;
+ int x_offset;
+ struct chain_elt *image_list_; // chained list of Fl_Image's used in this page
+ void *gc; // the printer's graphics context, if there's one, NULL otherwise
+ void delete_image_list(); // deletes the page image list
+#ifndef FL_DOXYGEN
+ Fl_Virtual_Printer(void) { gc = NULL; bg_r_ = bg_g_ = bg_b_ = 0; };
+#endif
+public:
+#ifdef FL_DOXYGEN
+ /**
+ @brief The constructor.
+ */
+ Fl_Printer(void);
+
+ /**
+ @brief The destructor.
+ */
+ ~Fl_Printer(void);
+#endif
+
+ /**
+ @brief Starts a print job.
+ *
+ Fully implemented for Mac OS X and MSWindows. For other platforms, temporarily
+ implemented as an Fl_PSfile_Device, that is, graphics go to an A4-sized local PostScript file,
+ and frompage/topage arguments are ignored.
+ @param[in] pagecount the total number of pages of the job
+ @param[out] frompage if non-null, *frompage is set to the first page the user wants printed
+ @param[out] topage if non-null, *topage is set to the last page the user wants printed
+ @return 0 iff OK
+ */
+ virtual int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
+
+ /**
+ @brief Starts a new printed page
+ *
+ The page coordinates are initially in points, i.e., 1/72 inch,
+ and with origin at the top left of the printable page area.
+ @return 0 iff OK
+ */
+ virtual int start_page(void);
+
+ /**
+ @brief Computes the width and height of the printable area of the page.
+ *
+ Values are in the same unit as that used by FLTK drawing functions,
+ are unchanged by calls to origin(), but are changed by scale() calls.
+ Values account for the user-selected paper type and print orientation.
+ @return 0 iff OK.
+ */
+ virtual int printable_rect(int *w, int *h);
+
+ /**
+ @brief Computes the dimensions of margins that lie between the printable page area and
+ the full page.
+ *
+ Values are in the same unit as that used by FLTK drawing functions. They are changed
+ by scale() calls.
+ @param[out] left If non-null, *left is set to the left margin size.
+ @param[out] top If non-null, *top is set to the top margin size.
+ @param[out] right If non-null, *right is set to the right margin size.
+ @param[out] bottom If non-null, *bottom is set to the bottom margin size.
+ */
+ virtual void margins(int *left, int *top, int *right, int *bottom);
+
+ /**
+ @brief Sets the position in page coordinates of the origin of graphics functions.
+ *
+ Arguments should be expressed relatively to the result of a previous printable_rect() call.
+ That is, <tt>printable_rect(&w, &h); origin(w/2, 0);</tt> sets the graphics origin at the
+ top center of the page printable area.
+ Origin() calls are not affected by rotate() calls.
+ Successive origin() calls don't combine their effects.
+ @param[in] x Horizontal position in page coordinates of the desired origin of graphics functions.
+ @param[in] y Same as above, vertically.
+ */
+ virtual void origin(int x, int y);
+
+ /**
+ @brief Computes the page coordinates of the current origin of graphics functions.
+ *
+ @param[out] x If non-null, *x is set to the horizontal page offset of graphics origin.
+ @param[out] y Same as above, vertically.
+ */
+ void origin(int *x, int *y);
+
+ /**
+ @brief Changes the scaling of page coordinates.
+ *
+ This function also resets the origin of graphics functions at top left of printable page area.
+ After a scale() call, do a printable_rect() call to get the new dimensions of the printable page area.
+ Successive scale() calls don't combine their effects.
+ @param scale_x Horizontal dimensions of plot are multiplied by this quantity.
+ @param scale_y Same as above, vertically.
+ */
+ virtual void scale (float scale_x, float scale_y);
+
+ /**
+ @brief Rotates the graphics operations relatively to paper.
+ *
+ The rotation is centered on the current graphics origin. Successive rotate() calls don't combine their effects.
+ On MSWindows, Fl_RGB_Image's don't rotate well; print_window_part() is an efficient workaround.
+ @param angle Rotation angle in counterclockwise degrees.
+ */
+ virtual void rotate(float angle);
+
+ /**
+ @brief Translates the current graphics origin accounting for the current rotation.
+ *
+ This function is only useful after a rotate() call.
+ Each translate() call must be matched by an untranslate() call.
+ Successive translate() calls add up their effects.
+ */
+ virtual void translate(int x, int y);
+
+ /**
+ @brief Undoes the effect of a previous translate() call.
+ */
+ virtual void untranslate(void);
+
+ /**
+ @brief Draws the widget on the printed page.
+ *
+ The widget's position on the printed page is determined by the last call to origin()
+ and by the optional delta_x and delta_y arguments.
+ Its dimensions are in points unless there was a previous call to scale().
+ <br>Under MSWindows, Fl_RGB_Image's are printed without transparency.
+ A workaround is to use the print_window_part() call.
+ @param[in] widget Any FLTK widget (e.g., standard, custom, window).
+ @param[in] delta_x Optional horizontal offset for positioning the widget relatively
+ to the current origin of graphics functions.
+ @param[in] delta_y Same as above, vertically.
+ */
+ void print_widget(Fl_Widget* widget, int delta_x = 0, int delta_y = 0);
+
+ /**
+ @brief Prints a rectangular part of an on-screen window.
+ *
+ @param win The window from where to capture.
+ @param x The rectangle left
+ @param y The rectangle top
+ @param w The rectangle width
+ @param h The rectangle height
+ @param delta_x Optional horizontal offset from current graphics origin where to print the captured rectangle.
+ @param delta_y As above, vertically.
+ */
+ void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x = 0, int delta_y = 0);
+
+ /**
+ @brief To be called at the end of each page.
+ *
+ @return 0 iff OK.
+ */
+ virtual int end_page (void);
+
+ /**
+ @brief To be called at the end of a print job.
+ */
+ virtual void end_job (void);
+
+ /**
+ @brief Sets this printer as the target of future graphics calls.
+ @return The current target device of graphics calls.
+ */
+ Fl_Device *set_current(void);
+ };
+
+#ifdef __APPLE__
+class Fl_Quartz_Printer : public Fl_Virtual_Printer {
+private:
+ float scale_x;
+ float scale_y;
+ float angle; // rotation angle in radians
+ PMPrintSession printSession;
+ PMPageFormat pageFormat;
+ PMPrintSettings printSettings;
+public:
+ Fl_Quartz_Printer(void);
+ int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
+ int start_page (void);
+ int printable_rect(int *w, int *h);
+ void margins(int *left, int *top, int *right, int *bottom);
+ void origin(int x, int y);
+ void scale (float scale_x, float scale_y);
+ void rotate(float angle);
+ void translate(int x, int y);
+ void untranslate(void);
+ int end_page (void);
+ void end_job (void);
+};
+#endif
+
+#ifdef WIN32
+class Fl_GDI_Printer : public Fl_Virtual_Printer {
+private:
+ int abortPrint;
+ PRINTDLG pd;
+ HDC hPr;
+ int prerr;
+ int left_margin;
+ int top_margin;
+ void absolute_printable_rect(int *x, int *y, int *w, int *h);
+public:
+ Fl_GDI_Printer(void);
+ int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
+ int start_page (void);
+ int printable_rect(int *w, int *h);
+ void margins(int *left, int *top, int *right, int *bottom);
+ void origin(int x, int y);
+ void scale (float scale_x, float scale_y);
+ void rotate(float angle);
+ void translate(int x, int y);
+ void untranslate(void);
+ int end_page (void);
+ void end_job (void);
+};
+#endif
+
+
+/**
+ @brief Creates a session where all graphics will go to a local PostScript file. Same API as Fl_Printer class.
+ *
+ This class has the same API as class Fl_Printer except for start_job() member function.
+ \see class Fl_Printer.
+ */
+class Fl_PSfile_Device : public
+#ifndef FL_DOXYGEN
+ Fl_Virtual_Printer
+#else
+ Fl_Device
+#endif
+ { // defined for all 3 platforms
+public:
+ /**
+ @brief Possible page formats.
+ */
+ enum Page_Format{
+ A0 = 0,
+ A1,
+ A2,
+ A3,
+ A4,
+ A5,
+ A6,
+ A7,
+ A8,
+ A9,
+ B0,
+ B1,
+ B2,
+ B3,
+ B4,
+ B5,
+ B6,
+ B7,
+ B8,
+ B9,
+ B10,
+ C5E,
+ DLE,
+ EXECUTIVE,
+ FOLIO,
+ LEDGER,
+ LEGAL,
+ LETTER,
+ TABLOID,
+ ENVELOPE,
+ MEDIA = 0x1000
+ };
+
+ /**
+ @brief Possible page layouts.
+ */
+ enum Page_Layout {PORTRAIT = 0, LANDSCAPE = 0x100, REVERSED = 0x200, ORIENTATION = 0x300};
+
+#ifndef FL_DOXYGEN
+private:
+ enum SHAPE{NONE=0, LINE, LOOP, POLYGON, POINTS};
+
+ class Clip{
+ public:
+ int x, y, w, h;
+ Clip *prev;
+ };
+ Clip * clip_;
+
+ int lang_level_;
+ int font_;
+ int size_;
+ Fl_Color color_;
+ int gap_;
+ int pages_;
+
+ double width_;
+ double height_;
+
+ int shape_;
+ int linewidth_;// need for clipping, lang level 1-2
+ int linestyle_;//
+ int interpolate_; //interpolation of images
+ unsigned char cr_,cg_,cb_;
+ char linedash_[256];//should be enought
+ void concat(); // transform ror scalable dradings...
+ void reconcat(); //invert
+ void recover(); //recovers the state afrer grestore (such as line styles...)
+ void reset();
+
+ uchar * mask;
+ int mx; // width of mask;
+ int my; // mask lines
+ //Fl_Color bg_;
+ int (*close_cmd_)(FILE *);
+ int page_policy_;
+ int nPages;
+ int orientation_;
+
+ float scale_x;
+ float scale_y;
+ float angle;
+ int left_margin;
+ int top_margin;
+
+protected:
+ struct page_format {
+ int width;
+ int height;
+ const char *name;
+ };
+
+ FILE *output;
+ double pw_, ph_;
+ static const int NO_PAGE_FORMATS=30;
+ static const struct page_format page_formats[NO_PAGE_FORMATS];
+
+ uchar bg_r, bg_g, bg_b;
+ int start_postscript (int pagecount, enum Page_Format format, enum Page_Layout layout);
+ /* int alpha_mask(const uchar * data, int w, int h, int D, int LD=0);
+ */
+ void draw(const char* s, int n, int x, int y) {transformed_draw(s,n,x,y); };
+ void draw(int angle, const char *str, int n, int x, int y);
+ void transformed_draw(const char* s, int n, double x, double y); //precise text placing
+ void transformed_draw(const char* s, double x, double y);
+ int alpha_mask(const uchar * data, int w, int h, int D, int LD=0);
+ void draw_scaled_image(const uchar *data, double x, double y, double w, double h, int iw, int ih, int D=3, int LD=0);
+ void draw_scaled_image_mono(const uchar *data, double x, double y, double w, double h, int iw, int ih, int D=3, int LD=0);
+ void draw_scaled_image(Fl_Draw_Image_Cb call, void *data, double x, double y, double w, double h, int iw, int ih, int D);
+ void draw_scaled_image_mono(Fl_Draw_Image_Cb call, void *data, double x, double y, double w, double h, int iw, int ih, int D);
+
+ enum Page_Format page_format_;
+ char *ps_filename_;
+ // implementation of drawing methods
+ void color(Fl_Color c);
+ //void bg_color(Fl_Color bg);
+ void color(uchar r, uchar g, uchar b);
+ Fl_Color color(){return color_;};
+
+ void push_clip(int x, int y, int w, int h);
+ int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H);
+ int not_clipped(int x, int y, int w, int h);
+ void push_no_clip();
+ void pop_clip();
+
+ void line_style(int style, int width=0, char* dashes=0);
+
+ void rect(int x, int y, int w, int h);
+ void rectf(int x, int y, int w, int h);
+
+ void xyline(int x, int y, int x1);
+ void xyline(int x, int y, int x1, int y2);
+ void xyline(int x, int y, int x1, int y2, int x3);
+
+ void yxline(int x, int y, int y1);
+ void yxline(int x, int y, int y1, int x2);
+ void yxline(int x, int y, int y1, int x2, int y3);
+
+ void line(int x1, int y1, int x2, int y2);
+ void line(int x1, int y1, int x2, int y2, int x3, int y3);
+
+ void loop(int x0, int y0, int x1, int y1, int x2, int y2);
+ void loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
+ void polygon(int x0, int y0, int x1, int y1, int x2, int y2);
+ void polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
+ void point(int x, int y);
+
+ void begin_points();
+ void begin_line();
+ void begin_loop();
+ void begin_polygon();
+ void vertex(double x, double y);
+ void curve(double x, double y, double x1, double y1, double x2, double y2, double x3, double y3);
+ void circle(double x, double y, double r);
+ void arc(double x, double y, double r, double start, double a);
+ void arc(int x, int y, int w, int h, double a1, double a2);
+ void pie(int x, int y, int w, int h, double a1, double a2);
+ void end_points();
+ void end_line();
+ void end_loop();
+ void end_polygon();
+ void begin_complex_polygon(){begin_polygon();};
+ void gap(){gap_=1;};
+ void end_complex_polygon(){end_polygon();};
+ void transformed_vertex(double x, double y);
+
+ void font(int face, int size);
+ int font(){return font_;};
+ int size(){return size_;};
+ double width(unsigned c);
+ double width(const char* s, int n);
+ int descent();
+ int height();
+
+ void draw_image(const uchar* d, int x,int y,int w,int h, int delta=3, int ldelta=0){draw_scaled_image(d,x,y,w,h,w,h,delta,ldelta);};
+ void draw_image_mono(const uchar* d, int x,int y,int w,int h, int delta=1, int ld=0){draw_scaled_image_mono(d,x,y,w,h,w,h,delta,ld);};
+ void draw_image(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=3){draw_scaled_image(call,data, x, y, w, h, w, h, delta);};
+ void draw_image_mono(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=1){draw_scaled_image_mono(call, data, x, y, w, h, w, h, delta);};
+
+ void draw(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy);
+ void draw(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy);
+ void draw(Fl_Bitmap * bitmap,int XP, int YP, int WP, int HP, int cx, int cy);
+
+public:
+ void page_policy(int p);
+ int page_policy(){return page_policy_;};
+ void close_command( int (*cmd)(FILE *)){close_cmd_=cmd;};
+ FILE * file() {return output;};
+ //void orientation (int o);
+ //Fl_PSfile_Device(FILE *o, int lang_level, int pages = 0); // ps (also multi-page) constructor
+ //Fl_PSfile_Device(FILE *o, int lang_level, int x, int y, int w, int h); //eps constructor
+ void interpolate(int i){interpolate_=i;};
+ int interpolate(){return interpolate_;}
+
+ void page(double pw, double ph, int media = 0);
+ void page(int format);
+
+ void place(double x, double y, double tx, double ty, double scale = 1);
+ int start_page (void);
+ int printable_rect(int *w, int *h);
+ void margins(int *left, int *top, int *right, int *bottom);
+ void origin(int x, int y);
+ void scale (float scale_x, float scale_y);
+ void rotate(float angle);
+ void translate(int x, int y);
+ void untranslate(void);
+ int end_page (void);
+ void end_job (void);
+
+#endif // FL_DOXYGEN
+
+ /**
+ @brief The constructor.
+ */
+ Fl_PSfile_Device(void);
+
+ /**
+ @brief The destructor.
+ */
+ virtual ~Fl_PSfile_Device();
+
+ /**
+ @brief Begins the session where all graphics will go to a local PostScript file.
+ *
+ Opens a file dialog to select an output PostScript file.
+ @param pagecount The total number of pages to be created.
+ @param format Desired page format.
+ @param layout Desired page layout.
+ @return 0 iff OK
+ */
+ int start_job(int pagecount, enum Page_Format format = A4, enum Page_Layout layout = PORTRAIT);
+ };
+
+#ifndef FL_DOXYGEN
+
+#ifdef __APPLE__
+class Fl_Printer : public Fl_Quartz_Printer {
+};
+#elif defined(WIN32)
+class Fl_Printer : public Fl_GDI_Printer {
+};
+#else
+class Fl_PS_Printer : public Fl_PSfile_Device {
+public:
+ Fl_PS_Printer(void) {};
+ ~Fl_PS_Printer(void) {};
+ int start_job(int pages, int *firstpage = NULL, int *lastpage = NULL);
+};
+class Fl_Printer : public Fl_PS_Printer {
+};
+
+#endif // __APPLE__
+
+#endif // FL_DOXYGEN
+
+#endif // Fl_Printer_H
+
diff --git a/FL/fl_draw.H b/FL/fl_draw.H
index 68ef2878b..4ed13143c 100644
--- a/FL/fl_draw.H
+++ b/FL/fl_draw.H
@@ -35,21 +35,25 @@
#include "Enumerations.H" // for the color names
#include "Fl_Window.H" // for fl_set_spot()
+#include "Fl_Device.H"
// Image class...
class Fl_Image;
// Label flags...
FL_EXPORT extern char fl_draw_shortcut;
+extern Fl_Device *fl_device;
/** \addtogroup fl_attributes
@{
*/
// Colors:
-FL_EXPORT void fl_color(Fl_Color i); // select indexed color
+//FL_EXPORT void fl_color(Fl_Color i); // select indexed color
+inline void fl_color(Fl_Color i) {fl_device->color(i); }; // select indexed color
/** for back compatibility - use fl_color(Fl_Color c) instead */
inline void fl_color(int c) {fl_color((Fl_Color)c);}
-FL_EXPORT void fl_color(uchar r, uchar g, uchar b); // select actual color
+//FL_EXPORT void fl_color(uchar r, uchar g, uchar b); // select actual color
+inline void fl_color(uchar r, uchar g, uchar b) {fl_device->color(r,g,b); }; // select actual color
extern FL_EXPORT Fl_Color fl_color_;
/**
Returns the last fl_color() that was set.
@@ -62,19 +66,27 @@ inline Fl_Color fl_color() {return fl_color_;}
@{
*/
// clip:
-FL_EXPORT void fl_push_clip(int x, int y, int w, int h);
+//FL_EXPORT void fl_push_clip(int x, int y, int w, int h);
+inline void fl_push_clip(int x, int y, int w, int h) {fl_device->push_clip(x,y,w,h); };
/** The fl_clip() name is deprecated and will be removed from future releases */
#define fl_clip fl_push_clip
-FL_EXPORT void fl_push_no_clip();
-FL_EXPORT void fl_pop_clip();
-FL_EXPORT int fl_not_clipped(int x, int y, int w, int h);
-FL_EXPORT int fl_clip_box(int, int, int, int, int& x, int& y, int& w, int& h);
+//FL_EXPORT void fl_push_no_clip();
+inline void fl_push_no_clip() {fl_device->push_no_clip(); };
+//FL_EXPORT void fl_pop_clip();
+inline void fl_pop_clip() {fl_device->pop_clip(); };
+//FL_EXPORT int fl_not_clipped(int x, int y, int w, int h);
+inline int fl_not_clipped(int x, int y, int w, int h) {return fl_device->not_clipped(x,y,w,h); };
+//FL_EXPORT int fl_clip_box(int, int, int, int, int& x, int& y, int& w, int& h);
+inline int fl_clip_box(int x , int y, int w, int h, int& X, int& Y, int& W, int& H)
+ {return fl_device->clip_box(x,y,w,h,X,Y,W,H); };
// points:
-FL_EXPORT void fl_point(int x, int y);
+//FL_EXPORT void fl_point(int x, int y);
+inline void fl_point(int x, int y) { fl_device->point(x,y); };
// line type:
-FL_EXPORT void fl_line_style(int style, int width=0, char* dashes=0);
+//FL_EXPORT void fl_line_style(int style, int width=0, char* dashes=0);
+inline void fl_line_style(int style, int width=0, char* dashes=0) {fl_device->line_style(style,width,dashes); };
enum {
FL_SOLID = 0, ///< line style: <tt>___________</tt>
FL_DASH = 1, ///< line style: <tt>_ _ _ _ _ _</tt>
@@ -92,10 +104,12 @@ enum {
};
// rectangles tweaked to exactly fill the pixel rectangle:
-FL_EXPORT void fl_rect(int x, int y, int w, int h);
+//FL_EXPORT void fl_rect(int x, int y, int w, int h);
+inline void fl_rect(int x, int y, int w, int h) { fl_device->rect(x,y,w,h); };
/** Draws a 1-pixel border \e inside the given bounding box */
inline void fl_rect(int x, int y, int w, int h, Fl_Color c) {fl_color(c); fl_rect(x,y,w,h);}
-FL_EXPORT void fl_rectf(int x, int y, int w, int h);
+//FL_EXPORT void fl_rectf(int x, int y, int w, int h);
+inline void fl_rectf(int x, int y, int w, int h) { fl_device->rectf(x,y,w,h); };
/** Colors a rectangle that exactly fills the given bounding box */
inline void fl_rectf(int x, int y, int w, int h, Fl_Color c) {fl_color(c); fl_rectf(x,y,w,h);}
@@ -109,30 +123,46 @@ inline void fl_rectf(int x, int y, int w, int h, Fl_Color c) {fl_color(c); fl_re
FL_EXPORT void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b);
// line segments:
-FL_EXPORT void fl_line(int x, int y, int x1, int y1);
-FL_EXPORT void fl_line(int x, int y, int x1, int y1, int x2, int y2);
+//FL_EXPORT void fl_line(int x, int y, int x1, int y1);
+inline void fl_line(int x, int y, int x1, int y1) {fl_device->line(x,y,x1,y1); };
+//FL_EXPORT void fl_line(int x, int y, int x1, int y1, int x2, int y2);
+inline void fl_line(int x, int y, int x1, int y1, int x2, int y2) {fl_device->line(x,y,x1,y1,x2,y2); };
// closed line segments:
-FL_EXPORT void fl_loop(int x, int y, int x1, int y1, int x2, int y2);
-FL_EXPORT void fl_loop(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3);
+//FL_EXPORT void fl_loop(int x, int y, int x1, int y1, int x2, int y2);
+inline void fl_loop(int x, int y, int x1, int y1, int x2, int y2) {fl_device->loop(x,y,x1,y1,x2,y2); };
+//FL_EXPORT void fl_loop(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3);
+inline void fl_loop(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3)
+ {fl_device->loop(x,y,x1,y1,x2,y2,x3,y3); };
// filled polygons
-FL_EXPORT void fl_polygon(int x, int y, int x1, int y1, int x2, int y2);
-FL_EXPORT void fl_polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3);
+//FL_EXPORT void fl_polygon(int x, int y, int x1, int y1, int x2, int y2);
+inline void fl_polygon(int x, int y, int x1, int y1, int x2, int y2) {fl_device->polygon(x,y,x1,y1,x2,y2); };
+//FL_EXPORT void fl_polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3);
+inline void fl_polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3)
+ { fl_device->polygon(x,y,x1,y1,x2,y2,x3,y3); };
// draw rectilinear lines, horizontal segment first:
-FL_EXPORT void fl_xyline(int x, int y, int x1);
-FL_EXPORT void fl_xyline(int x, int y, int x1, int y2);
-FL_EXPORT void fl_xyline(int x, int y, int x1, int y2, int x3);
+//FL_EXPORT void fl_xyline(int x, int y, int x1);
+inline void fl_xyline(int x, int y, int x1) {fl_device->xyline(x,y,x1);};
+//FL_EXPORT void fl_xyline(int x, int y, int x1, int y2);
+inline void fl_xyline(int x, int y, int x1, int y2) {fl_device->xyline(x,y,x1,y2);};
+//FL_EXPORT void fl_xyline(int x, int y, int x1, int y2, int x3);
+inline void fl_xyline(int x, int y, int x1, int y2, int x3) {fl_device->xyline(x,y,x1,y2,x3);};
// draw rectilinear lines, vertical segment first:
-FL_EXPORT void fl_yxline(int x, int y, int y1);
-FL_EXPORT void fl_yxline(int x, int y, int y1, int x2);
-FL_EXPORT void fl_yxline(int x, int y, int y1, int x2, int y3);
+//FL_EXPORT void fl_yxline(int x, int y, int y1);
+inline void fl_yxline(int x, int y, int y1) {fl_device->yxline(x,y,y1);};
+//FL_EXPORT void fl_yxline(int x, int y, int y1, int x2);
+inline void fl_yxline(int x, int y, int y1, int x2) {fl_device->yxline(x,y,y1,x2);};
+//FL_EXPORT void fl_yxline(int x, int y, int y1, int x2, int y3);
+inline void fl_yxline(int x, int y, int y1, int x2, int y3) {fl_device->yxline(x,y,y1,x2,y3);};
// circular lines and pie slices (code in fl_arci.C):
-FL_EXPORT void fl_arc(int x, int y, int w, int h, double a1, double a2);
-FL_EXPORT void fl_pie(int x, int y, int w, int h, double a1, double a2);
+//FL_EXPORT void fl_arc(int x, int y, int w, int h, double a1, double a2);
+inline void fl_arc(int x, int y, int w, int h, double a1, double a2) {fl_device->arc(x,y,w,h,a1,a2); };
+//FL_EXPORT void fl_pie(int x, int y, int w, int h, double a1, double a2);
+inline void fl_pie(int x, int y, int w, int h, double a1, double a2) {fl_device->pie(x,y,w,h,a1,a2); };
/** fl_chord declaration is a place holder - the function does not yet exist */
FL_EXPORT void fl_chord(int x, int y, int w, int h, double a1, double a2); // nyi
@@ -144,27 +174,44 @@ FL_EXPORT void fl_scale(double x);
FL_EXPORT void fl_translate(double x, double y);
FL_EXPORT void fl_rotate(double d);
FL_EXPORT void fl_mult_matrix(double a, double b, double c, double d, double x,double y);
-FL_EXPORT void fl_begin_points();
-FL_EXPORT void fl_begin_line();
-FL_EXPORT void fl_begin_loop();
-FL_EXPORT void fl_begin_polygon();
-FL_EXPORT void fl_vertex(double x, double y);
-FL_EXPORT void fl_curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3);
-FL_EXPORT void fl_arc(double x, double y, double r, double start, double a);
-FL_EXPORT void fl_circle(double x, double y, double r);
-FL_EXPORT void fl_end_points();
-FL_EXPORT void fl_end_line();
-FL_EXPORT void fl_end_loop();
-FL_EXPORT void fl_end_polygon();
-FL_EXPORT void fl_begin_complex_polygon();
-FL_EXPORT void fl_gap();
-FL_EXPORT void fl_end_complex_polygon();
+//FL_EXPORT void fl_begin_points();
+inline void fl_begin_points() {fl_device->begin_points(); };
+//FL_EXPORT void fl_begin_line();
+inline void fl_begin_line() {fl_device->begin_line(); };
+//FL_EXPORT void fl_begin_loop();
+inline void fl_begin_loop() {fl_device->begin_loop(); };
+//FL_EXPORT void fl_begin_polygon();
+inline void fl_begin_polygon() {fl_device->begin_polygon(); };
+//FL_EXPORT void fl_vertex(double x, double y);
+inline void fl_vertex(double x, double y) {fl_device->vertex(x,y); };
+//FL_EXPORT void fl_curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3);
+inline void fl_curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3)
+ {fl_device->curve(X0,Y0,X1,Y1,X2,Y2,X3,Y3); };
+//FL_EXPORT void fl_arc(double x, double y, double r, double start, double a);
+inline void fl_arc(double x, double y, double r, double start, double a) {fl_device->arc(x,y,r,start,a); };
+//FL_EXPORT void fl_circle(double x, double y, double r);
+inline void fl_circle(double x, double y, double r) {fl_device->circle(x,y,r); };
+//FL_EXPORT void fl_end_points();
+inline void fl_end_points() {fl_device->end_points(); };
+//FL_EXPORT void fl_end_line();
+inline void fl_end_line() {fl_device->end_line(); };
+//FL_EXPORT void fl_end_loop();
+inline void fl_end_loop() {fl_device->end_loop(); };
+//FL_EXPORT void fl_end_polygon();
+inline void fl_end_polygon() {fl_device->end_polygon(); };
+//FL_EXPORT void fl_begin_complex_polygon();
+inline void fl_begin_complex_polygon() {fl_device->begin_complex_polygon(); };
+//FL_EXPORT void fl_gap();
+inline void fl_gap() {fl_device->gap(); };
+//FL_EXPORT void fl_end_complex_polygon();
+inline void fl_end_complex_polygon() {fl_device->end_complex_polygon(); };
// get and use transformed positions:
FL_EXPORT double fl_transform_x(double x, double y);
FL_EXPORT double fl_transform_y(double x, double y);
FL_EXPORT double fl_transform_dx(double x, double y);
FL_EXPORT double fl_transform_dy(double x, double y);
-FL_EXPORT void fl_transformed_vertex(double x, double y);
+//FL_EXPORT void fl_transformed_vertex(double x, double y);
+inline void fl_transformed_vertex(double x, double y) {fl_device->transformed_vertex(x,y); };
/** @} */
/** \addtogroup fl_attributes
@@ -181,7 +228,8 @@ FL_EXPORT void fl_transformed_vertex(double x, double y);
*/
// Fonts:
-FL_EXPORT void fl_font(Fl_Font face, Fl_Fontsize size);
+//FL_EXPORT void fl_font(Fl_Font face, Fl_Fontsize size);
+inline void fl_font(Fl_Font face, Fl_Fontsize size) { fl_device->font(face,size); };
extern FL_EXPORT Fl_Font fl_font_; ///< current font index
/**
@@ -276,6 +324,7 @@ FL_EXPORT const char *fl_local_to_mac_roman(const char *t, int n=-1);
to control characters.
*/
FL_EXPORT void fl_draw(const char* str, int x, int y);
+FL_EXPORT void fl_draw(int angle, const char* str, int x, int y);
/**
Draws a nul-terminated string starting at the given location and
rotating \p angle degrees counterclockwise.
@@ -283,16 +332,18 @@ FL_EXPORT void fl_draw(const char* str, int x, int y);
function of the underlying OS and suported for Xft, Win32 and MacOS
fltk subset.
*/
-FL_EXPORT void fl_draw(int angle,const char* str, int x, int y);
+//FL_EXPORT void fl_draw(int angle,const char* str, int x, int y);
/**
Draws an array of \p n characters starting at the given location.
*/
-FL_EXPORT void fl_draw(const char* str, int n, int x, int y);
+//FL_EXPORT void fl_draw(const char* str, int n, int x, int y);
+inline void fl_draw(const char* str, int n, int x, int y) {fl_device->draw(str,n,x,y); };
/**
Draws an array of \p n characters starting at the given location,
rotating \p angle degrees counterclockwise.
*/
-FL_EXPORT void fl_draw(int angle,const char* str, int n, int x, int y);
+//FL_EXPORT void fl_draw(int angle,const char* str, int n, int x, int y);
+inline void fl_draw(int angle,const char* str, int n, int x, int y) {fl_device->draw(angle,str,n,x,y); };
/**
Draws an array of \p n characters right to left starting at given location.
*/
@@ -356,13 +407,17 @@ typedef void (*Fl_Draw_Image_Cb)(void* data,int x,int y,int w,uchar* buf);
any visual of 8 bits or less, and all common TrueColor visuals up
to 32 bits.
*/
-FL_EXPORT void fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0);
+//FL_EXPORT void fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0);
+inline void fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0)
+ { fl_device->draw_image(buf, X, Y, W, H, D, L); };
/**
Draw a gray-scale (1 channel) image.
\see fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L)
*/
-FL_EXPORT void fl_draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0);
+//FL_EXPORT void fl_draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0);
+inline void fl_draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0)
+ { fl_device->draw_image_mono(buf, X, Y, W, H, D, L); };
/**
Draw image using callback function to generate image data.
@@ -396,7 +451,9 @@ FL_EXPORT void fl_draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int
If \p D is 4 or more, you must fill in the unused bytes with zero.
*/
-FL_EXPORT void fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3);
+//FL_EXPORT void fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3);
+inline void fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3)
+ { fl_device->draw_image(cb, data, X, Y, W, H, D); };
/**
Draw gray-scale image using callback function to generate image data.
diff --git a/FL/mac.H b/FL/mac.H
index 97fa20d77..05366c23a 100644
--- a/FL/mac.H
+++ b/FL/mac.H
@@ -73,19 +73,19 @@ struct XPoint { int x, y; };
struct XRectangle {int x, y, width, height;};
#ifdef __APPLE_COCOA__
-// necessary so a CGRect matches exactly what is denoted x,y,w,h for clipping purposes
-#define FL_CGRECTMAKE_COCOA(x,y,w,h) CGRectMake(x, y, w > 0 ? w - 0.9 : 0, h > 0 ? h - 0.9 : 0)
typedef void *Window; // this is really a pter to the subclass FLWindow of NSWindow
typedef struct flCocoaRegion {
int count;
CGRect *rects;
} *Fl_Region; // a region is the union of a series of rectangles
+extern CGRect fl_cgrectmake_cocoa(int x, int y, int w, int h);
+
inline Fl_Region XRectangleRegion(int x, int y, int w, int h) {
Fl_Region R = (Fl_Region)malloc(sizeof(*R));
R->count = 1;
R->rects = (CGRect *)malloc(sizeof(CGRect));
- *(R->rects) = FL_CGRECTMAKE_COCOA(x, y, w, h);
+ *(R->rects) = fl_cgrectmake_cocoa(x, y, w, h);
return R;
}
inline void XDestroyRegion(Fl_Region r) {
diff --git a/FL/win32.H b/FL/win32.H
index e04dae712..8ad6ccf45 100644
--- a/FL/win32.H
+++ b/FL/win32.H
@@ -45,15 +45,15 @@
#define VK_APPS 0x5D
#endif
+#include <FL/Fl_Device.H>
+
// some random X equivalents
typedef HWND Window;
typedef POINT XPoint;
struct XRectangle {int x, y, width, height;};
typedef HRGN Fl_Region;
FL_EXPORT void fl_clip_region(Fl_Region);
-inline Fl_Region XRectangleRegion(int x, int y, int w, int h) {
- return CreateRectRgn(x,y,x+w,y+h);
-}
+extern Fl_Region XRectangleRegion(int x, int y, int w, int h);
inline void XDestroyRegion(Fl_Region r) {DeleteObject(r);}
inline void XClipBox(Fl_Region r,XRectangle* rect) {
RECT win_rect; GetRgnBox(r,&win_rect);