summaryrefslogtreecommitdiff
path: root/FL
diff options
context:
space:
mode:
Diffstat (limited to 'FL')
-rw-r--r--FL/Fl_Device.H82
-rw-r--r--FL/Fl_Printer.H22
-rw-r--r--FL/fl_draw.H320
3 files changed, 361 insertions, 63 deletions
diff --git a/FL/Fl_Device.H b/FL/Fl_Device.H
index 237d6b5b9..00e6a4768 100644
--- a/FL/Fl_Device.H
+++ b/FL/Fl_Device.H
@@ -49,12 +49,23 @@ 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.
+ \brief A pure virtual class subclassed to send the output of drawing functions to display, printers, or local files.
+ *
+ The protected virtual methods of this class are those that a device should implement to
+ support all of FLTK drawing functions.
+ <br> The preferred FLTK API for drawing operations is the function collection of the
+ \ref fl_drawings and \ref fl_attributes modules.
+ <br> Alternatively, member functions of the Fl_Device class can be called
+ using global variable Fl_Device *fl_device that points at all time to the single device
+ (an instance of an Fl_Device subclass) that's currently receiving drawing requests:<br>
+ <tt>fl_device->rect(x, y, w, h);</tt>
*/
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
+ /** \brief The device type */
+ int type_;
+ /** \brief color for background and/or mixing if device does not support masking or alpha */
+ uchar bg_r_, bg_g_, bg_b_;
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);
@@ -76,8 +87,6 @@ protected:
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();
@@ -106,58 +115,121 @@ protected:
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);
+ /** \brief see fl_rect(int x, int y, int w, int h). */
virtual void rect(int x, int y, int w, int h);
+ /** \brief see fl_rectf(int x, int y, int w, int h). */
virtual void rectf(int x, int y, int w, int h);
+ /** \brief see fl_line_style(int style, int width, char* dashes). */
virtual void line_style(int style, int width=0, char* dashes=0);
+ /** \brief see fl_xyline(int x, int y, int x1). */
virtual void xyline(int x, int y, int x1);
+ /** \brief see fl_xyline(int x, int y, int x1, int y2). */
virtual void xyline(int x, int y, int x1, int y2);
+ /** \brief see fl_xyline(int x, int y, int x1, int y2, int x3). */
virtual void xyline(int x, int y, int x1, int y2, int x3);
+ /** \brief see fl_yxline(int x, int y, int y1). */
virtual void yxline(int x, int y, int y1);
+ /** \brief see fl_yxline(int x, int y, int y1, int x2). */
virtual void yxline(int x, int y, int y1, int x2);
+ /** \brief see fl_yxline(int x, int y, int y1, int x2, int y3). */
virtual void yxline(int x, int y, int y1, int x2, int y3);
+ /** \brief see fl_line(int x, int y, int x1, int y1). */
virtual void line(int x, int y, int x1, int y1);
+ /** \brief see fl_line(int x, int y, int x1, int y1, int x2, int y2). */
virtual void line(int x, int y, int x1, int y1, int x2, int y2);
+ /** \brief see fl_draw(const char *str, int n, int x, int y). */
virtual void draw(const char *str, int n, int x, int y);
+ /** \brief see fl_draw(int angle, const char *str, int n, int x, int y). */
virtual void draw(int angle, const char *str, int n, int x, int y);
+ /** \brief see fl_font(Fl_Font face, Fl_Fontsize size). */
virtual void font(Fl_Font face, Fl_Fontsize size);
+ /** \brief see fl_color(Fl_Color c). */
virtual void color(Fl_Color c);
+ /** \brief see fl_color(uchar r, uchar g, uchar b). */
virtual void color(uchar r, uchar g, uchar b);
+ /** \brief see fl_point(int x, int y). */
virtual void point(int x, int y);
+ /** \brief see fl_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);
+ /** \brief see fl_loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3). */
virtual void loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
+ /** \brief see fl_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);
+ /** \brief see fl_polygon(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, int x3, int y3);
+ /** \brief see fl_begin_points(). */
virtual void begin_points();
+ /** \brief see fl_begin_line(). */
virtual void begin_line();
+ /** \brief see fl_begin_loop(). */
virtual void begin_loop();
+ /** \brief see fl_begin_polygon(). */
virtual void begin_polygon();
+ /** \brief see fl_vertex(double x, double y). */
virtual void vertex(double x, double y);
+ /** \brief see fl_curve(double x, double y, double x1, double y1, double x2, double y2, double x3, double y3). */
virtual void curve(double x, double y, double x1, double y1, double x2, double y2, double x3, double y3);
+ /** \brief see fl_circle(double x, double y, double r). */
virtual void circle(double x, double y, double r);
+ /** \brief see fl_arc(double x, double y, double r, double start, double a). */
virtual void arc(double x, double y, double r, double start, double a);
+ /** \brief see fl_arc(int x, int y, int w, int h, double a1, double a2). */
virtual void arc(int x, int y, int w, int h, double a1, double a2);
+ /** \brief see fl_pie(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);
+ /** \brief see fl_end_points(). */
virtual void end_points();
+ /** \brief see fl_end_line(). */
virtual void end_line();
+ /** \brief see fl_end_loop(). */
virtual void end_loop();
+ /** \brief see fl_end_polygon(). */
virtual void end_polygon();
+ /** \brief see fl_begin_complex_polygon(). */
virtual void begin_complex_polygon();
+ /** \brief see fl_gap(). */
virtual void gap();
+ /** \brief see fl_end_complex_polygon(). */
virtual void end_complex_polygon();
+ /** \brief see fl_transformed_vertex(double x, double y). */
virtual void transformed_vertex(double x, double y);
+ /** \brief see fl_push_clip(int x, int y, int w, int h). */
virtual void push_clip(int x, int y, int w, int h);
+ /** \brief see fl_clip_box(int x, int y, int w, int h, 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);
+ /** \brief see fl_not_clipped(int x, int y, int w, int h). */
virtual int not_clipped(int x, int y, int w, int h);
+ /** \brief see fl_push_no_clip(). */
virtual void push_no_clip();
+ /** \brief see fl_pop_clip(). */
virtual void pop_clip();
// Images
+ /** \brief see fl_draw_image(const uchar*, int,int,int,int, int delta, int ldelta). */
virtual void draw_image(const uchar*, int,int,int,int, int delta=3, int ldelta=0);
+ /** \brief see fl_draw_image_mono(const uchar*, int,int,int,int, int delta, int ldelta). */
virtual void draw_image_mono(const uchar*, int,int,int,int, int delta=1, int ld=0);
+ /** \brief see fl_draw_image(Fl_Draw_Image_Cb, void*, int,int,int,int, int delta). */
virtual void draw_image(Fl_Draw_Image_Cb, void*, int,int,int,int, int delta=3);
+ /** \brief see fl_draw_image_mono(Fl_Draw_Image_Cb, void*, int,int,int,int, int delta). */
virtual void draw_image_mono(Fl_Draw_Image_Cb, void*, int,int,int,int, int delta=1);
// Image classes
+ /** \brief Draws an Fl_Pixmap object to the device.
+ *
+ Specifies a bounding box for the image, with the origin (upper left-hand corner) of
+ the image offset by the cx and cy arguments.
+ */
virtual void draw(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy);
+ /** \brief Draws an Fl_RGB_Image object to the device.
+ *
+ Specifies a bounding box for the image, with the origin (upper left-hand corner) of
+ the image offset by the cx and cy arguments.
+ */
virtual void draw(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy);
+ /** \brief Draws an Fl_Bitmap object to the device.
+ *
+ Specifies a bounding box for the image, with the origin (upper left-hand corner) of
+ the image offset by the cx and cy arguments.
+ */
virtual void draw(Fl_Bitmap * bmp,int XP, int YP, int WP, int HP, int cx, int cy);
public:
diff --git a/FL/Fl_Printer.H b/FL/Fl_Printer.H
index e958c18e7..2899224c3 100644
--- a/FL/Fl_Printer.H
+++ b/FL/Fl_Printer.H
@@ -36,10 +36,10 @@
#include <stdio.h>
/**
- \brief A virtual class for print support with several platform-dependent implementations.
+ \brief A virtual class for print support with several platform-specific implementations.
*
This class has no public constructor: don't instantiate it; use Fl_Printer instead.
- \see class Fl_Printer for most member functions documentation.
+ \see class Fl_Printer for full documentation of member functions.
*/
class Fl_Abstract_Printer : public Fl_Device {
friend class Fl_Pixmap;
@@ -72,19 +72,33 @@ public:
@return The current target device of graphics calls.
*/
Fl_Device *set_current(void);
+ /** \brief see Fl_Printer::start_job(int pagecount, int *frompage, int *topage) */
virtual int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
+ /** \brief see Fl_Printer::start_page() */
virtual int start_page(void);
+ /** \brief see Fl_Printer::printable_rect(int *w, int *h) */
virtual int printable_rect(int *w, int *h);
+ /** \brief see Fl_Printer::margins(int *left, int *top, int *right, int *bottom) */
virtual void margins(int *left, int *top, int *right, int *bottom);
+ /** \brief see Fl_Printer::origin(int x, int y) */
virtual void origin(int x, int y);
+ /** \brief see Fl_Printer::origin(int *x, int *y) */
void origin(int *x, int *y);
- virtual void scale (float scale_x, float scale_y);
+ /** \brief see Fl_Printer::scale(float scale_x, float scale_y) */
+ virtual void scale(float scale_x, float scale_y);
+ /** \brief see Fl_Printer::rotate(float angle) */
virtual void rotate(float angle);
+ /** \brief see Fl_Printer::translate(int x, int y) */
virtual void translate(int x, int y);
+ /** \brief see Fl_Printer::untranslate(void) */
virtual void untranslate(void);
+ /** \brief see Fl_Printer::print_widget(Fl_Widget* widget, int delta_x, int delta_y) */
void print_widget(Fl_Widget* widget, int delta_x = 0, int delta_y = 0);
+ /** \brief see Fl_Printer::print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x, int delta_y) */
void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x = 0, int delta_y = 0);
+ /** \brief see Fl_Printer::end_page() */
virtual int end_page (void);
+ /** \brief see Fl_Printer::end_job() */
virtual void end_job (void);
};
@@ -230,7 +244,7 @@ public:
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.
+ <br>Under MSWindows and X11, 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
diff --git a/FL/fl_draw.H b/FL/fl_draw.H
index 4ed13143c..fc6b54136 100644
--- a/FL/fl_draw.H
+++ b/FL/fl_draw.H
@@ -47,12 +47,30 @@ extern Fl_Device *fl_device;
/** \addtogroup fl_attributes
@{
*/
+
// Colors:
-//FL_EXPORT void fl_color(Fl_Color i); // select indexed color
+/**
+ Sets the color for all subsequent drawing operations.
+ For colormapped displays, a color cell will be allocated out of
+ \p fl_colormap the first time you use a color. If the colormap fills up
+ then a least-squares algorithm is used to find the closest color.
+ If no valid graphical context (fl_gc) is available,
+ the foreground is not set for the current window.
+ \param[in] i 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
+/**
+ Set the color for all subsequent drawing operations.
+ The closest possible match to the RGB color is used.
+ The RGB color is used directly on TrueColor displays.
+ For colormap visuals the nearest index in the gray
+ ramp or color cube is used.
+ If no valid graphical context (fl_gc) is available,
+ the foreground is not set for the current window.
+ \param[in] r,g,b color components
+ */
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_;
/**
@@ -66,26 +84,102 @@ inline Fl_Color fl_color() {return fl_color_;}
@{
*/
// clip:
-//FL_EXPORT 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.
+ \param[in] x,y,w,h position and size
+ */
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();
+/**
+ Pushes an empty clip region onto the stack so nothing will be clipped.
+ */
inline void fl_push_no_clip() {fl_device->push_no_clip(); };
-//FL_EXPORT void fl_pop_clip();
+/**
+ Restores the previous clip region.
+
+ You must call fl_pop_clip() once for every time you call fl_push_clip().
+ Unpredictable results may occur if the clip stack is not empty when
+ you return to FLTK.
+ */
inline void fl_pop_clip() {fl_device->pop_clip(); };
-//FL_EXPORT int fl_not_clipped(int x, int y, int w, int h);
+/**
+ Does the rectangle intersect the current clip region?
+ \param[in] x,y,w,h position and size of rectangle
+ \returns non-zero if any of the rectangle intersects the current clip
+ region. If this returns 0 you don't have to draw the object.
+
+ \note
+ Under X this returns 2 if the rectangle is partially clipped,
+ and 1 if it is entirely inside the clip region.
+ */
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);
+/**
+ Intersects the rectangle with the current clip region and returns the
+ bounding box of the result.
+
+ Returns non-zero if the resulting rectangle is different to the original.
+ This can be used to limit the necessary drawing to a rectangle.
+ \p W and \p H are set to zero if the rectangle is completely outside
+ the region.
+ \param[in] x,y,w,h position and size of rectangle
+ \param[out] X,Y,W,H position and size of resulting bounding box.
+ \p W and \p H are set to zero if the rectangle is
+ completely outside the region.
+ \returns Non-zero if the resulting rectangle is different to the original.
+ */
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); };
+/** Undoes any clobbering of clip done by your program */
+extern void fl_restore_clip();
+/**
+ Replaces the top of the clipping stack with a clipping region of any shape.
+
+ Fl_Region is an operating system specific type.
+ \param[in] r clipping region
+ */
+extern void fl_clip_region(Fl_Region r);
+/**
+ returns the current clipping region.
+ */
+extern Fl_Region fl_clip_region();
+
// points:
-//FL_EXPORT void fl_point(int x, int y);
+/**
+ Draws a single pixel at the given coordinates
+ */
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);
+/**
+ Sets how to draw lines (the "pen").
+ If you change this it is your responsibility to set it back to the default
+ using \c fl_line_style(0).
+
+ \param[in] style A bitmask which is a bitwise-OR of a line style, a cap
+ style, and a join style. If you don't specify a dash type you
+ will get a solid line. If you don't specify a cap or join type
+ you will get a system-defined default of whatever value is
+ fastest.
+ \param[in] width The thickness of the lines in pixels. Zero results in the
+ system defined default, which on both X and Windows is somewhat
+ different and nicer than 1.
+ \param[in] dashes A pointer to an array of dash lengths, measured in pixels.
+ The first location is how long to draw a solid portion, the next
+ is how long to draw the gap, then the solid, etc. It is terminated
+ with a zero-length entry. A \c NULL pointer or a zero-length
+ array results in a solid line. Odd array sizes are not supported
+ and result in undefined behavior.
+
+ \note Because of how line styles are implemented on Win32 systems,
+ you \e must set the line style \e after setting the drawing
+ color. If you set the color after the line style you will lose
+ the line style settings.
+ \note The \p dashes array does not work under Windows 95, 98 or Me,
+ since those operating systems do not support complex line styles.
+ */
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>
@@ -104,13 +198,15 @@ enum {
};
// rectangles tweaked to exactly fill the pixel rectangle:
-//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_device->rect(x,y,w,h); };
+
+/** Draws with passed color 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);
+/** Colors with current color a rectangle that exactly fills the given bounding box */
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 */
+/** Colors with passsed color 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);}
/**
@@ -123,45 +219,103 @@ 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);
+/**
+ Draws a line from (x,y) to (x1,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);
+/**
+ Draws a line from (x,y) to (x1,y1) and another from (x1,y1) to (x2,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);
+/**
+ Outlines a 3-sided polygon with lines
+ */
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);
+/**
+ Outlines a 4-sided polygon with lines
+ */
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);
+/**
+ Fills a 3-sided polygon. The polygon must be convex.
+ */
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);
+/**
+ Fills a 4-sided polygon. The polygon must be convex.
+ */
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);
+/**
+ Draws a horizontal line from (x,y) to (x1,y)
+ */
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);
+/**
+ Draws a horizontal line from (x,y) to (x1,y), then vertical from (x1,y) to (x1,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);
+/**
+ Draws a horizontal line from (x,y) to (x1,y), then a vertical from (x1,y) to (x1,y2)
+ and then another horizontal from (x1,y2) to (x3,y2)
+ */
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);
+/**
+ Draws a vertical line from (x,y) to (x,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);
+/**
+ Draws a vertical line from (x,y) to (x,y1), then a horizontal from (x,y1) to (x2,y1)
+ */
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);
+/**
+ Draws a vertical line from (x,y) to (x,y1) then a horizontal from (x,y1)
+ to (x2,y1), then another vertical from (x2,y1) to (x2,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);
+/**
+ Draw ellipse sections using integer coordinates.
+
+ These functions match the rather limited circle drawing code provided by X
+ and WIN32. The advantage over using fl_arc with floating point coordinates
+ is that they are faster because they often use the hardware, and they draw
+ much nicer small circles, since the small sizes are often hard-coded bitmaps.
+
+ If a complete circle is drawn it will fit inside the passed bounding box.
+ The two angles are measured in degrees counterclockwise from 3 o'clock and
+ are the starting and ending angle of the arc, \p a2 must be greater or equal
+ to \p a1.
+
+ fl_arc() draws a series of lines to approximate the arc. Notice that the
+ integer version of fl_arc() has a different number of arguments than the
+ double version fl_arc(double x, double y, double r, double start, double a)
+
+ \param[in] x,y,w,h bounding box of complete circle
+ \param[in] a1,a2 start and end angles of arc measured in degrees
+ counter-clockwise from 3 o'clock. \p a2 must be greater
+ than or equal to \p a1.
+ */
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);
+/**
+ Draw filled ellipse sections using integer coordinates.
+
+ Like fl_arc(), but fl_pie() draws a filled-in pie slice.
+ This slice may extend outside the line drawn by fl_arc();
+ to avoid this use w - 1 and h - 1.
+
+ \param[in] x,y,w,h bounding box of complete circle
+ \param[in] a1,a2 start and end angles of arc measured in degrees
+ counter-clockwise from 3 o'clock. \p a2 must be greater
+ than or equal to \p a1.
+ */
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
@@ -174,49 +328,113 @@ 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();
+/**
+ Starts drawing a list of points. Points are added to the list with fl_vertex()
+ */
inline void fl_begin_points() {fl_device->begin_points(); };
-//FL_EXPORT void fl_begin_line();
+/**
+ Starts drawing a list of lines.
+ */
inline void fl_begin_line() {fl_device->begin_line(); };
-//FL_EXPORT void fl_begin_loop();
+/**
+ Starts drawing a closed sequence of lines.
+ */
inline void fl_begin_loop() {fl_device->begin_loop(); };
-//FL_EXPORT void fl_begin_polygon();
+/**
+ Starts drawing a convex filled polygon.
+ */
inline void fl_begin_polygon() {fl_device->begin_polygon(); };
-//FL_EXPORT void fl_vertex(double x, double y);
+/**
+ Adds a single vertex to the current path.
+ \param[in] x,y coordinate
+ */
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);
+/**
+ Add a series of points on a Bezier curve to the path.
+ The curve ends (and two of the points) are at X0,Y0 and X3,Y3.
+ \param[in] X0,Y0 curve start point
+ \param[in] X1,Y1 curve control point
+ \param[in] X2,Y2 curve control point
+ \param[in] X3,Y3 curve end point
+ */
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);
+/**
+ Add a series of points to the current path on the arc of a circle; you
+ can get elliptical paths by using scale and rotate before calling fl_arc().
+ \param[in] x,y,r center and radius of circular arc
+ \param[in] start,end angles of start and end of arc measured in degrees
+ counter-clockwise from 3 o'clock. If \p end is less than \p start
+ then it draws the arc in a clockwise direction.
+ */
+inline void fl_arc(double x, double y, double r, double start, double end) {fl_device->arc(x,y,r,start,end); };
+/**
+ fl_circle() is equivalent to fl_arc(x,y,r,0,360), but may be faster.
+
+ It must be the \e only thing in the path: if you want a circle as part of
+ a complex polygon you must use fl_arc()
+ \param[in] x,y,r center and radius of circle
+ */
inline void fl_circle(double x, double y, double r) {fl_device->circle(x,y,r); };
-//FL_EXPORT void fl_end_points();
+/**
+ Ends list of points, and draws.
+ */
inline void fl_end_points() {fl_device->end_points(); };
-//FL_EXPORT void fl_end_line();
+/**
+ Ends list of lines, and draws.
+ */
inline void fl_end_line() {fl_device->end_line(); };
-//FL_EXPORT void fl_end_loop();
+/**
+ Ends closed sequence of lines, and draws.
+ */
inline void fl_end_loop() {fl_device->end_loop(); };
-//FL_EXPORT void fl_end_polygon();
+/**
+ Ends convex filled polygon, and draws.
+ */
inline void fl_end_polygon() {fl_device->end_polygon(); };
-//FL_EXPORT void fl_begin_complex_polygon();
+/**
+ Starts drawing a complex filled polygon.
+
+ The polygon may be concave, may have holes in it, or may be several
+ disconnected pieces. Call fl_gap() to separate loops of the path.
+
+ To outline the polygon, use fl_begin_loop() and replace each fl_gap()
+ with fl_end_loop();fl_begin_loop() pairs.
+
+ \note
+ For portability, you should only draw polygons that appear the same
+ whether "even/odd" or "non-zero" winding rules are used to fill them.
+ Holes should be drawn in the opposite direction to the outside loop.
+ */
inline void fl_begin_complex_polygon() {fl_device->begin_complex_polygon(); };
-//FL_EXPORT void fl_gap();
+/**
+ Call fl_gap() to separate loops of the path.
+
+ It is unnecessary but harmless to call fl_gap() before the first vertex,
+ after the last vertex, or several times in a row.
+ */
inline void fl_gap() {fl_device->gap(); };
-//FL_EXPORT void fl_end_complex_polygon();
+/**
+ Ends complex filled polygon, and draws.
+ */
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);
-inline void fl_transformed_vertex(double x, double y) {fl_device->transformed_vertex(x,y); };
+/**
+ Adds coordinate pair to the vertex list without further transformations.
+ \param[in] xf,yf transformed coordinate
+ */
+inline void fl_transformed_vertex(double xf, double yf) {fl_device->transformed_vertex(xf,yf); };
/** @} */
/** \addtogroup fl_attributes
@{ */
/* NOTE: doxygen comments here to avoid triplication in os-specific sources */
+
+// Fonts:
/**
Sets the current font, which is then used in various drawing routines.
You may call this outside a draw context if necessary to call fl_width(),
@@ -226,9 +444,6 @@ inline void fl_transformed_vertex(double x, double y) {fl_device->transformed_ve
The size of the font is measured in pixels and not "points".
Lines should be spaced \p size pixels apart or more.
*/
-
-// Fonts:
-//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
@@ -324,25 +539,22 @@ 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.
This version of fl_draw provides direct access to the text drawing
- function of the underlying OS and suported for Xft, Win32 and MacOS
- fltk subset.
+ function of the underlying OS and is supported by Xft, Win32 and MacOS
+ fltk subsets.
*/
-//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);
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);
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.