FLTK 1.3.4
Fl_PostScript_File_Device Class Reference

To send graphical output to a PostScript file. More...

#include <Fl_PostScript.H>

Inheritance diagram for Fl_PostScript_File_Device:
Fl_Paged_Device Fl_Surface_Device Fl_Device Fl_PostScript_Printer

Public Member Functions

const char * class_name ()
 Returns the name of the class of this object. More...
 
void end_job (void)
 To be called at the end of a print job.
 
int end_page (void)
 To be called at the end of each page. More...
 
 Fl_PostScript_File_Device ()
 The constructor.
 
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 origin (int *x, int *y)
 Computes the page coordinates of the current origin of graphics functions. More...
 
void origin (int x, int y)
 Sets the position in page coordinates of the origin of graphics functions. More...
 
int printable_rect (int *w, int *h)
 Computes the width and height of the printable area of the page. More...
 
void rotate (float angle)
 Rotates the graphics operations relatively to paper. More...
 
void scale (float scale_x, float scale_y=0.)
 Changes the scaling of page coordinates. More...
 
int start_job (int pagecount, int *from, int *to)
 Don't use with this class. More...
 
int start_job (int pagecount, 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 start_job (FILE *ps_output, int pagecount, 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 start_page (void)
 Starts a new printed page. More...
 
void translate (int x, int y)
 Translates the current graphics origin accounting for the current rotation. More...
 
void untranslate (void)
 Undoes the effect of a previous translate() call.
 
 ~Fl_PostScript_File_Device ()
 The destructor.
 
- Public Member Functions inherited from Fl_Paged_Device
virtual void print_widget (Fl_Widget *widget, int delta_x=0, int delta_y=0)
 Draws the widget on the printed page. More...
 
void print_window (Fl_Window *win, int x_offset=0, int y_offset=0)
 Prints a window with its title bar and frame if any. More...
 
virtual void print_window_part (Fl_Window *win, int x, int y, int w, int h, int delta_x=0, int delta_y=0)
 Prints a rectangular part of an on-screen window. More...
 
virtual ~Fl_Paged_Device ()
 The destructor.
 
- Public Member Functions inherited from Fl_Surface_Device
void driver (Fl_Graphics_Driver *graphics_driver)
 Sets the graphics driver of this drawing surface. More...
 
Fl_Graphics_Driverdriver ()
 Returns the graphics driver of this drawing surface. More...
 
virtual void set_current (void)
 Make this surface the current drawing surface. More...
 
virtual ~Fl_Surface_Device ()
 The destructor. More...
 
- Public Member Functions inherited from Fl_Device
virtual ~Fl_Device ()
 Virtual destructor. More...
 

Static Public Attributes

static const char * class_id = "Fl_PostScript_File_Device"
 
static const char * file_chooser_title = "Select a .ps file"
 Label of the PostScript file chooser window.
 
- Static Public Attributes inherited from Fl_Paged_Device
static const char * class_id = "Fl_Paged_Device"
 
static const page_format page_formats [NO_PAGE_FORMATS]
 width, height and name of all elements of the enum Page_Format.
 
- Static Public Attributes inherited from Fl_Surface_Device
static const char * class_id = "Fl_Surface_Device"
 
- Static Public Attributes inherited from Fl_Device
static const char * class_id = "Fl_Device"
 A string that identifies each subclass of Fl_Device. More...
 

Protected Member Functions

Fl_PostScript_Graphics_Driverdriver ()
 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_Surface_Device
 Fl_Surface_Device (Fl_Graphics_Driver *graphics_driver)
 Constructor that sets the graphics driver to use for the created surface. More...
 

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_Devicesurface ()
 The current drawing surface. More...
 
- Protected Attributes inherited from Fl_Paged_Device
int x_offset
 horizontal offset to the origin of graphics coordinates
 
int y_offset
 vertical offset to the origin of graphics coordinates
 

Detailed Description

To send graphical output to a PostScript file.

This class is used exactly as the Fl_Printer class except for the start_job() call, two variants of which are usable and allow to specify what page format and layout are desired.

Member Function Documentation

const char* Fl_PostScript_File_Device::class_name ( )
inlinevirtual

Returns the name of the class of this object.

Use of the class_name() function is discouraged because it will be removed from future FLTK versions.

The class of an instance of an Fl_Device subclass can be checked with code such as:

if ( instance->class_name() == Fl_Printer::class_id ) { ... }

Reimplemented from Fl_Paged_Device.

Reimplemented in Fl_PostScript_Printer.

int Fl_PostScript_File_Device::end_page ( void  )
virtual

To be called at the end of each page.

Returns
0 if OK, non-zero if any error.

Reimplemented from Fl_Paged_Device.

void Fl_PostScript_File_Device::margins ( int *  left,
int *  top,
int *  right,
int *  bottom 
)
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.

Parameters
[out]leftIf non-null, *left is set to the left margin size.
[out]topIf non-null, *top is set to the top margin size.
[out]rightIf non-null, *right is set to the right margin size.
[out]bottomIf non-null, *bottom is set to the bottom margin size.

Reimplemented from Fl_Paged_Device.

void Fl_PostScript_File_Device::origin ( int *  x,
int *  y 
)
virtual

Computes the page coordinates of the current origin of graphics functions.

Parameters
[out]xIf non-null, *x is set to the horizontal page offset of graphics origin.
[out]ySame as above, vertically.

Reimplemented from Fl_Paged_Device.

void Fl_PostScript_File_Device::origin ( int  x,
int  y 
)
virtual

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(&w, &h); origin(w/2, 0); 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.

Parameters
[in]xHorizontal position in page coordinates of the desired origin of graphics functions.
[in]ySame as above, vertically.

Reimplemented from Fl_Paged_Device.

int Fl_PostScript_File_Device::printable_rect ( int *  w,
int *  h 
)
virtual

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.

Returns
0 if OK, non-zero if any error

Reimplemented from Fl_Paged_Device.

void Fl_PostScript_File_Device::rotate ( float  angle)
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.

Parameters
angleRotation angle in counter-clockwise degrees.

Reimplemented from Fl_Paged_Device.

void Fl_PostScript_File_Device::scale ( float  scale_x,
float  scale_y = 0. 
)
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.

Parameters
scale_xHorizontal dimensions of plot are multiplied by this quantity.
scale_ySame 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.

int Fl_PostScript_File_Device::start_job ( int  pagecount,
int *  from,
int *  to 
)
virtual

Don't use with this class.

Reimplemented from Fl_Paged_Device.

Reimplemented in Fl_PostScript_Printer.

int Fl_PostScript_File_Device::start_job ( int  pagecount,
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 entitled with Fl_PostScript_File_Device::file_chooser_title to select an output PostScript file.

Parameters
pagecountThe total number of pages to be created. Use 0 if this number is unknown when this function is called.
formatDesired page format.
layoutDesired page layout.
Returns
0 if OK, 1 if user cancelled the file dialog, 2 if fopen failed on user-selected output file.
int Fl_PostScript_File_Device::start_job ( FILE *  ps_output,
int  pagecount,
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.

Parameters
ps_outputA writable FILE pointer that will receive PostScript output and that should not be closed until after end_job() has been called.
pagecountThe total number of pages to be created. Use 0 if this number is unknown when this function is called.
formatDesired page format.
layoutDesired page layout.
Returns
always 0.
int Fl_PostScript_File_Device::start_page ( void  )
virtual

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.

Returns
0 if OK, non-zero if any error

Reimplemented from Fl_Paged_Device.

void Fl_PostScript_File_Device::translate ( int  x,
int  y 
)
virtual

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.

Reimplemented from Fl_Paged_Device.


The documentation for this class was generated from the following files: