FLTK 1.4.0
|
To send graphical output to a PostScript file. More...
#include <Fl_PostScript.H>
Public Member Functions | |
int | begin_job (FILE *ps_output, int pagecount=0, enum Fl_Paged_Device::Page_Format format=Fl_Paged_Device::A4, enum Fl_Paged_Device::Page_Layout layout=Fl_Paged_Device::PORTRAIT) |
Begins the session where all graphics requests will go to FILE pointer. More... | |
int | begin_job (int pagecount, int *from, int *to, char **perr_message) FL_OVERRIDE |
Don't use with this class. More... | |
int | begin_job (int pagecount=0, enum Fl_Paged_Device::Page_Format format=Fl_Paged_Device::A4, enum Fl_Paged_Device::Page_Layout layout=Fl_Paged_Device::PORTRAIT) |
Begins the session where all graphics requests will go to a local PostScript file. More... | |
int | begin_page (void) FL_OVERRIDE |
Begins a new printed page. More... | |
void | close_command (Fl_PostScript_Close_Command cmd) |
Sets the function end_job() calls to close the file() | |
void | end_current () FL_OVERRIDE |
FLTK calls this each time a surface ceases to be the current drawing surface. More... | |
void | end_job (void) FL_OVERRIDE |
Completes all PostScript output. More... | |
int | end_page (void) FL_OVERRIDE |
To be called at the end of each page. More... | |
FILE * | file () |
Returns the underlying FILE* receiving all PostScript data. | |
Fl_PostScript_File_Device () | |
The constructor. | |
void | margins (int *left, int *top, int *right, int *bottom) FL_OVERRIDE |
Computes the dimensions of margins that lie between the printable page area and the full page. More... | |
void | origin (int *x, int *y) FL_OVERRIDE |
Computes the coordinates of the current origin of graphics functions. More... | |
void | origin (int x, int y) FL_OVERRIDE |
Sets the position of the origin of graphics in the drawable part of the drawing surface. More... | |
int | printable_rect (int *w, int *h) FL_OVERRIDE |
Computes the width and height of the drawable area of the drawing surface. More... | |
void | rotate (float angle) FL_OVERRIDE |
Rotates the graphics operations relatively to paper. More... | |
void | scale (float scale_x, float scale_y=0.) FL_OVERRIDE |
Changes the scaling of page coordinates. More... | |
void | set_current () FL_OVERRIDE |
Make this surface the current drawing surface. More... | |
int | start_job (FILE *ps_output, int pagecount=0, enum Fl_Paged_Device::Page_Format format=Fl_Paged_Device::A4, enum Fl_Paged_Device::Page_Layout layout=Fl_Paged_Device::PORTRAIT) |
Synonym of begin_job(). More... | |
int | start_job (int pagecount=0, enum Fl_Paged_Device::Page_Format format=Fl_Paged_Device::A4, enum Fl_Paged_Device::Page_Layout layout=Fl_Paged_Device::PORTRAIT) |
Synonym of begin_job(). More... | |
void | translate (int x, int y) FL_OVERRIDE |
Translates the current graphics origin accounting for the current rotation. More... | |
void | untranslate (void) FL_OVERRIDE |
Undoes the effect of a previous translate() call. More... | |
~Fl_PostScript_File_Device () | |
The destructor. | |
Public Member Functions inherited from Fl_Paged_Device | |
virtual int | begin_job (int pagecount=0, int *frompage=NULL, int *topage=NULL, char **perr_message=NULL) |
Begins a print job. More... | |
virtual int | begin_page (void) |
Begins a new printed page. More... | |
virtual void | end_job (void) |
To be called at the end of a print job. More... | |
virtual int | end_page (void) |
To be called at the end of each page. More... | |
virtual void | margins (int *left, int *top, int *right, int *bottom) |
Computes the dimensions of margins that lie between the printable page area and the full page. More... | |
void | print_widget (Fl_Widget *widget, int delta_x=0, int delta_y=0) |
Synonym of draw(Fl_Widget*, int, int) | |
void | print_window (Fl_Window *win, int x_off=0, int y_off=0) |
Synonym of draw_decorated_window(Fl_Window*, int, int) | |
virtual void | rotate (float angle) |
Rotates the graphics operations relatively to paper. More... | |
virtual void | scale (float scale_x, float scale_y=0.) |
Changes the scaling of page coordinates. More... | |
int | start_job (int pagecount=0, int *frompage=NULL, int *topage=NULL, char **perr_message=NULL) |
Synonym of begin_job(int pagecount, int *frompage, int *topage, char **perr_message). More... | |
int | start_page () |
Synonym of begin_page(). More... | |
virtual | ~Fl_Paged_Device () |
The destructor. | |
Public Member Functions inherited from Fl_Widget_Surface | |
void | draw (Fl_Widget *widget, int delta_x=0, int delta_y=0) |
Draws the widget on the drawing surface. More... | |
void | draw_decorated_window (Fl_Window *win, int x_offset=0, int y_offset=0) |
Draws a window with its title bar and frame if any. More... | |
virtual void | origin (int *x, int *y) |
Computes the coordinates of the current origin of graphics functions. More... | |
virtual void | origin (int x, int y) |
Sets the position of the origin of graphics in the drawable part of the drawing surface. More... | |
void | print_window_part (Fl_Window *win, int x, int y, int w, int h, int delta_x=0, int delta_y=0) |
Draws a rectangular part of an on-screen window. More... | |
virtual int | printable_rect (int *w, int *h) |
Computes the width and height of the drawable area of the drawing surface. More... | |
virtual void | translate (int x, int y) |
Translates the current graphics origin accounting for the current rotation. More... | |
virtual void | untranslate () |
Undoes the effect of a previous translate() call. More... | |
Public Member Functions inherited from Fl_Surface_Device | |
Fl_Graphics_Driver * | driver () |
Returns the graphics driver of this drawing surface. | |
virtual bool | is_current () |
Is this surface the current drawing surface? More... | |
virtual void | set_current (void) |
Make this surface the current drawing surface. More... | |
virtual | ~Fl_Surface_Device () |
The destructor. | |
Static Public Attributes | |
static const char * | file_chooser_title |
Label of the PostScript file chooser window. | |
Static Public Attributes inherited from Fl_Paged_Device | |
static const page_format | page_formats [NO_PAGE_FORMATS] |
width, height and name of all elements of the enum Page_Format. | |
Protected Member Functions | |
Fl_PostScript_Graphics_Driver * | driver () |
Returns the PostScript driver of this drawing surface. | |
Protected Member Functions inherited from Fl_Paged_Device | |
Fl_Paged_Device () | |
The constructor. | |
Protected Member Functions inherited from Fl_Widget_Surface | |
Fl_Widget_Surface (Fl_Graphics_Driver *d) | |
The constructor. More... | |
Protected Member Functions inherited from Fl_Surface_Device | |
void | driver (Fl_Graphics_Driver *graphics_driver) |
Sets the graphics driver of this drawing surface. | |
virtual void | end_current () |
FLTK calls this each time a surface ceases to be the current drawing surface. More... | |
Fl_Surface_Device (Fl_Graphics_Driver *graphics_driver) | |
Constructor that sets the graphics driver to use for the created surface. | |
Additional Inherited Members | |
Public Types inherited from Fl_Paged_Device | |
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 } |
Possible page formats. More... | |
enum | Page_Layout { PORTRAIT = 0 , LANDSCAPE = 0x100 , REVERSED = 0x200 , ORIENTATION = 0x300 } |
Possible page layouts. More... | |
Static Public Member Functions inherited from Fl_Surface_Device | |
static Fl_Surface_Device * | pop_current () |
Removes the top element from the current drawing surface stack, and makes the new top element current. More... | |
static void | push_current (Fl_Surface_Device *new_current) |
Pushes new_current on top of the stack of current drawing surfaces, and makes it current. More... | |
static Fl_Surface_Device * | surface () |
The current drawing surface. More... | |
Protected Attributes inherited from Fl_Widget_Surface | |
int | x_offset |
horizontal offset to the origin of graphics coordinates | |
int | y_offset |
vertical offset to the origin of graphics coordinates | |
To send graphical output to a PostScript file.
This class is used exactly as the Fl_Printer class except for the begin_job() call, two variants of which are usable and allow to specify what page format and layout are desired.
Processing of text: Text uses vectorial fonts under the X11 + Pango and the Wayland platforms. With other platforms, only text restricted to the Latin alphabet (and a few other characters listed in the table below) and to FLTK standard fonts is vectorized. All other unicode characters or all other fonts (FL_FREE_FONT and above) are output as a bitmap. FLTK standard fonts are output using the corresponding PostScript standard fonts. The latin alphabet means all unicode characters between U+0020 and U+017F, or, in other words, the ASCII, Latin-1 Supplement and Latin Extended-A charts.
Char | Codepoint | Name | Char | Codepoint | Name | Char | Codepoint | Name |
---|---|---|---|---|---|---|---|---|
ƒ | U+0192 | florin | ‚ | U+201A | quotesinglbase | ™ | U+2122 | trademark |
ˆ | U+02C6 | circumflex | “ | U+201C | quotedblleft | ∂ | U+2202 | partialdiff |
ˇ | U+02C7 | caron | ” | U+201D | quotedblright | Δ | U+2206 | Delta |
˘ | U+02D8 | breve | „ | U+201E | quotedblbase | ∑ | U+2211 | summation |
˙ | U+02D9 | dotaccent | † | U+2020 | dagger | √ | U+221A | radical |
˚ | U+02DA | ring | ‡ | U+2021 | daggerdbl | ∞ | U+221E | infinity |
˛ | U+02DB | ogonek | • | U+2022 | bullet | ≠ | U+2260 | notequal |
˜ | U+02DC | tilde | … | U+2026 | ellipsis | ≤ | U+2264 | lessequal |
˝ | U+02DD | hungarumlaut | ‰ | U+2030 | perthousand | ≥ | U+2265 | greaterequal |
– | U+2013 | endash | ‹ | U+2039 | guilsinglleft | ◊ | U+25CA | lozenge |
— | U+2014 | emdash | › | U+203A | guilsinglright | fi | U+FB01 | fi |
‘ | U+2018 | quoteleft | / | U+2044 | fraction | fl | U+FB02 | fl |
’ | U+2019 | quoteright | € | U+20AC | Euro | | U+F8FF | apple (macOS only) |
Processing of transparent Fl_RGB_Image objects: Under the X11 + Pango and the Wayland platforms, these objects are output with their exact transparency. With other platforms, these objects are drawn blended to white color. Class Fl_EPS_File_Surface 's constructor allows to set another background color for blending.
int Fl_PostScript_File_Device::begin_job | ( | FILE * | ps_output, |
int | pagecount = 0 , |
||
enum Fl_Paged_Device::Page_Format | format = Fl_Paged_Device::A4 , |
||
enum Fl_Paged_Device::Page_Layout | layout = Fl_Paged_Device::PORTRAIT |
||
) |
Begins the session where all graphics requests will go to FILE pointer.
This member function prevents end_job() from closing ps_output
, so the user can check with ferror(ps_output)
for output errors.
ps_output | A writable FILE pointer that will receive PostScript output and that should not be closed until after end_job() has been called. |
pagecount | The total number of pages to be created. Use 0 if this number is unknown when this function is called. |
format | Desired page format. |
layout | Desired page layout. |
|
virtual |
Don't use with this class.
Reimplemented from Fl_Paged_Device.
int Fl_PostScript_File_Device::begin_job | ( | int | pagecount = 0 , |
enum Fl_Paged_Device::Page_Format | format = Fl_Paged_Device::A4 , |
||
enum Fl_Paged_Device::Page_Layout | layout = Fl_Paged_Device::PORTRAIT |
||
) |
Begins the session where all graphics requests will go to a local PostScript file.
Opens a file dialog to select an output PostScript file. This member function makes end_job() close the resulting PostScript file and display an alert message with fl_alert() in case of any output error.
pagecount | The total number of pages to be created. Use 0 if this number is unknown when this function is called. |
format | Desired page format. |
layout | Desired page layout. |
|
virtual |
Begins 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. This function also makes this surface the current drawing surface with Fl_Surface_Device::push_current().
Reimplemented from Fl_Paged_Device.
|
virtual |
FLTK calls this each time a surface ceases to be the current drawing surface.
This member function is mostly of interest to developers of new Fl_Surface_Device derived classes. It allows to perform surface-specific operations necessary when this surface ceases to be current. Each implementation should end with a call to Fl_Surface_Device::end_current().
Reimplemented from Fl_Surface_Device.
|
virtual |
Completes all PostScript output.
This also closes with fclose()
the underlying file() unless close_command() was used to set another function.
Reimplemented from Fl_Paged_Device.
|
virtual |
To be called at the end of each page.
This function also stops this surface from being the current drawing surface with Fl_Surface_Device::pop_current().
Reimplemented from Fl_Paged_Device.
|
virtual |
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.
[out] | left | If non-null, *left is set to the left margin size. |
[out] | top | If non-null, *top is set to the top margin size. |
[out] | right | If non-null, *right is set to the right margin size. |
[out] | bottom | If non-null, *bottom is set to the bottom margin size. |
Reimplemented from Fl_Paged_Device.
|
virtual |
Computes the coordinates of the current origin of graphics functions.
[out] | x,y | If non-null, *x and *y are set to the horizontal and vertical coordinates of the graphics origin. |
Reimplemented from Fl_Widget_Surface.
|
virtual |
Sets the position of the origin of graphics in the drawable part of the drawing surface.
Arguments should be expressed relatively to the result of a previous printable_rect() call. That is, printable_rect(&w, &h); origin(w/2, 0);
sets the graphics origin at the top center of the drawable area. Successive origin() calls don't combine their effects. Origin() calls are not affected by rotate() calls (for classes derived from Fl_Paged_Device).
[in] | x,y | Horizontal and vertical positions in the drawing surface of the desired origin of graphics. |
Reimplemented from Fl_Widget_Surface.
|
virtual |
Computes the width and height of the drawable area of the drawing surface.
Values are in the same unit as that used by FLTK drawing functions and are unchanged by calls to origin(). If the object is derived from class Fl_Paged_Device, values account for the user-selected paper type and print orientation and are changed by scale() calls.
Reimplemented from Fl_Widget_Surface.
|
virtual |
Rotates the graphics operations relatively to paper.
The rotation is centered on the current graphics origin. Successive rotate() calls don't combine their effects.
angle | Rotation angle in counter-clockwise degrees. |
Reimplemented from Fl_Paged_Device.
|
virtual |
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.
scale_x | Horizontal dimensions of plot are multiplied by this quantity. |
scale_y | Same as above, vertically. The value 0. is equivalent to setting scale_y = scale_x . Thus, scale(factor); is equivalent to scale(factor, factor); |
Reimplemented from Fl_Paged_Device.
|
virtual |
Make this surface the current drawing surface.
This surface will receive all future graphics requests. Starting
from FLTK 1.4.0, the preferred API to change the current drawing surface is Fl_Surface_Device::push_current( ) / Fl_Surface_Device::pop_current().
Reimplemented from Fl_Surface_Device.
|
inline |
Synonym of begin_job().
For API compatibility with FLTK 1.3.x
|
inline |
Synonym of begin_job().
For API compatibility with FLTK 1.3.x
|
virtual |
Translates the current graphics origin accounting for the current rotation.
Each translate() call must be matched by an untranslate() call. Successive translate() calls add up their effects.
Reimplemented from Fl_Widget_Surface.
|
virtual |
Undoes the effect of a previous translate() call.
Reimplemented from Fl_Widget_Surface.