fltk 1.3.0rc3
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. Release candidate.
  SfR Fresh Dox: fltk-1.3.0rc3-source.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation)  

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:
Collaboration diagram for Fl_PostScript_File_Device:

List of all members.

Public Member Functions

 Fl_PostScript_File_Device ()
 The constructor.
 ~Fl_PostScript_File_Device ()
 The destructor.
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.
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.
int start_page (void)
 Starts a new printed page.
int printable_rect (int *w, int *h)
 Computes the width and height of the printable area of the page.
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.
void origin (int x, int y)
 Sets the position in page coordinates of the origin of graphics functions.
void scale (float scale_x, float scale_y)
 Changes the scaling of page coordinates.
void rotate (float angle)
 Rotates the graphics operations relatively to paper.
void translate (int x, int y)
 Translates the current graphics origin accounting for the current rotation.
void untranslate (void)
 Undoes the effect of a previous translate() call.
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.

Static Public Attributes

static const char * class_id = "Fl_PostScript_File_Device"
 A string that identifies each subclass of Fl_Device.
static const char * file_chooser_title = "Select a .ps file"
 Label of the PostScript file chooser window.

Protected Member Functions

Fl_PostScript_Graphics_Driverdriver ()
 Returns the PostScript driver of this drawing surface.

Detailed Description

To send graphical output to a PostScript file.

Definition at line 223 of file Fl_PostScript.H.


Constructor & Destructor Documentation

Fl_PostScript_File_Device::Fl_PostScript_File_Device ( void  )

The constructor.

Definition at line 63 of file Fl_PostScript.cxx.

References class_id, Fl_Device::class_name(), driver(), fl_gc, and gc.

Fl_PostScript_File_Device::~Fl_PostScript_File_Device ( )

The destructor.

Definition at line 139 of file Fl_PostScript.cxx.

References driver().


Member Function Documentation

Fl_PostScript_Graphics_Driver * Fl_PostScript_File_Device::driver ( ) [protected]
int Fl_PostScript_File_Device::end_page ( void  ) [virtual]

To be called at the end of each page.

Returns:
0 iff OK.

Reimplemented from Fl_Paged_Device.

Definition at line 1437 of file Fl_PostScript.cxx.

Referenced by Fl_Printer::end_page().

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.

Definition at line 1371 of file Fl_PostScript.cxx.

References driver(), int, Fl_PostScript_Graphics_Driver::left_margin, Fl_PostScript_Graphics_Driver::scale_x, Fl_PostScript_Graphics_Driver::scale_y, and Fl_PostScript_Graphics_Driver::top_margin.

Referenced by Fl_Printer::margins().

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.

Definition at line 1389 of file Fl_PostScript.cxx.

References Fl_PostScript_Graphics_Driver::angle, driver(), Fl_PostScript_Graphics_Driver::left_margin, Fl_PostScript_Graphics_Driver::output, Fl_PostScript_Graphics_Driver::scale_x, Fl_PostScript_Graphics_Driver::scale_y, Fl_PostScript_Graphics_Driver::top_margin, x, Fl_Paged_Device::x_offset, y, and Fl_Paged_Device::y_offset.

Referenced by Fl_Printer::origin().

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 iff OK.

Reimplemented from Fl_Paged_Device.

Definition at line 1380 of file Fl_PostScript.cxx.

References driver(), int, Fl_PostScript_Graphics_Driver::left_margin, Fl_PostScript_Graphics_Driver::ph_, Fl_PostScript_Graphics_Driver::pw_, Fl_PostScript_Graphics_Driver::scale_x, Fl_PostScript_Graphics_Driver::scale_y, and Fl_PostScript_Graphics_Driver::top_margin.

Referenced by Fl_Printer::printable_rect().

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 counterclockwise degrees.

Reimplemented from Fl_Paged_Device.

Definition at line 1407 of file Fl_PostScript.cxx.

References Fl_PostScript_Graphics_Driver::angle, driver(), Fl_PostScript_Graphics_Driver::left_margin, Fl_PostScript_Graphics_Driver::output, Fl_PostScript_Graphics_Driver::scale_x, Fl_PostScript_Graphics_Driver::scale_y, Fl_PostScript_Graphics_Driver::top_margin, Fl_Paged_Device::x_offset, and Fl_Paged_Device::y_offset.

Referenced by Fl_Printer::rotate().

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

Reimplemented from Fl_Paged_Device.

Definition at line 1398 of file Fl_PostScript.cxx.

References Fl_PostScript_Graphics_Driver::angle, driver(), Fl_PostScript_Graphics_Driver::left_margin, Fl_PostScript_Graphics_Driver::output, Fl_PostScript_Graphics_Driver::scale_x, Fl_PostScript_Graphics_Driver::scale_y, and Fl_PostScript_Graphics_Driver::top_margin.

Referenced by Fl_Printer::scale().

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.
formatDesired page format.
layoutDesired page layout.
Returns:
0 iff OK, 1 if user cancelled the file dialog, 2 if fopen failed on user-selected output file.

Definition at line 90 of file Fl_PostScript.cxx.

References Fl_Native_File_Chooser::BROWSE_SAVE_FILE, driver(), file_chooser_title, Fl_Native_File_Chooser::filename(), Fl_Native_File_Chooser::filter(), NULL, Fl_Native_File_Chooser::options(), Fl_PostScript_Graphics_Driver::output, Fl_PostScript_Graphics_Driver::ps_filename_, Fl_Native_File_Chooser::SAVEAS_CONFIRM, Fl_Surface_Device::set_current(), Fl_Native_File_Chooser::show(), Fl_PostScript_Graphics_Driver::start_postscript(), Fl_Native_File_Chooser::title(), and Fl_Native_File_Chooser::type().

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.
formatDesired page format.
layoutDesired page layout.
Returns:
always 0.

Definition at line 124 of file Fl_PostScript.cxx.

References Fl_PostScript_Graphics_Driver::close_command(), driver(), NULL, Fl_PostScript_Graphics_Driver::output, Fl_PostScript_Graphics_Driver::ps_filename_, Fl_Surface_Device::set_current(), and Fl_PostScript_Graphics_Driver::start_postscript().

int Fl_PostScript_File_Device::start_page ( void  ) [virtual]
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.

Definition at line 1415 of file Fl_PostScript.cxx.

References driver().

Referenced by Fl_Printer::translate().

void Fl_PostScript_File_Device::untranslate ( void  ) [virtual]

Undoes the effect of a previous translate() call.

Reimplemented from Fl_Paged_Device.

Definition at line 1420 of file Fl_PostScript.cxx.

References driver().

Referenced by Fl_Printer::untranslate().


Member Data Documentation

const char * Fl_PostScript_File_Device::class_id = "Fl_PostScript_File_Device" [static]

A string that identifies each subclass of Fl_Device.

Function class_name() applied to a device of this class returns this string.

Reimplemented from Fl_Paged_Device.

Reimplemented in Fl_PostScript_Printer.

Definition at line 230 of file Fl_PostScript.H.

Referenced by Fl_PostScript_File_Device().

const char * Fl_PostScript_File_Device::file_chooser_title = "Select a .ps file" [static]

Label of the PostScript file chooser window.

Definition at line 251 of file Fl_PostScript.H.

Referenced by start_job().


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