#include <Fl_Printer.H>
Public Member Functions | |
| Fl_Printer (void) | |
| The constructor. | |
| int | start_job (int pagecount, int *frompage=NULL, int *topage=NULL) |
| Starts a print job. | |
| int | start_page (void) |
| Starts a new printed page. | |
| int | printable_rect (int *x, int *y, int *w, int *h) |
| Computes the origin and size of the printable area of the page. | |
| void | origin (int x, int y) |
| Sets the position in page coordinates of the origin of graphics functions. | |
| void | origin (int *x, int *y) |
| Computes the page coordinates of the current origin of graphics functions. | |
| void | scale (float scale_x, float scale_y) |
| Changes the scaling of page coordinates. | |
| void | print_widget (Fl_Widget *widget, int delta_x=0, int delta_y=0) |
| Draws the widget on the printed page. | |
| int | end_page (void) |
| To be called at the end of each page. | |
| void | end_job (void) |
| To be called at the end of a print job. | |
At present, this class is only implemented for MSWindows and Mac OS X. 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 ways to use it.
| int Fl_Printer::end_page | ( | void | ) |
To be called at the end of each page.
| void Fl_Printer::origin | ( | int * | x, | |
| int * | y | |||
| ) |
Computes the page coordinates of the current origin of graphics functions.
| [out] | x | If non-null, *x is set to the horizontal page offset of graphics origin. |
| [out] | y | Same as above, vertically. |
| void Fl_Printer::origin | ( | int | x, | |
| int | y | |||
| ) |
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, printable_rect(&x, &y, &w, &h); origin(x, y); sets the graphics origin at the top left of the page printable area. Successive origin() calls don't combine their effects.
| [in] | x | Horizontal position in page coordinates of the desired origin of graphics functions. |
| [in] | y | Same as above, vertically. |
| void Fl_Printer::print_widget | ( | Fl_Widget * | widget, | |
| int | delta_x = 0, |
|||
| int | delta_y = 0 | |||
| ) |
Draws the widget on the printed page.
The widget's position on the printed page is determined by a previous 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().
| [in] | widget | Any FLTK widget (e.g., standard, custom, window). |
| [in] | delta_x | Optional horizontal offset for positioning the widget relatively to the current origin of graphics functions. |
| [in] | delta_y | Same as above, vertically. |
| int Fl_Printer::printable_rect | ( | int * | x, | |
| int * | y, | |||
| int * | w, | |||
| int * | h | |||
| ) |
| void Fl_Printer::scale | ( | float | scale_x, | |
| float | scale_y | |||
| ) |
Changes the scaling of page coordinates.
After a scale() call, do a printable_rect() call to get the new coordinates of the printable page area. Successive scale() calls don't combine their effects.
| scale_x | Horizontal dimensions of plot are multiplied by this quantity. | |
| scale_y | Same as above, vertically. |
| int Fl_Printer::start_job | ( | int | pagecount, | |
| int * | frompage = NULL, |
|||
| int * | topage = NULL | |||
| ) |
Starts a print job.
| [in] | pagecount | the total number of pages of the job |
| [out] | frompage | if non-null, *frompage is set to the first page the user wants printed |
| [out] | topage | if non-null, *topage is set to the last page the user wants printed |
| int Fl_Printer::start_page | ( | void | ) |
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 page or of the printable page area.
1.5.9