## CGAL::Postscript_file_stream

#include <CGAL/IO/Postscript_file_stream.h>

### Definition

An object of type Postscript_file_stream provides graphical output in PostScript. Postscript_file_stream is derived from the LEDA class ps_file. Therefore, the functionality of ps_file is available on Postscript_file_stream as well. In addition, the class Postscript_file_stream provides input and output operators for the classes which are defined in the CGAL kernel. The interface of Postscript_file_stream is very similar to the interface of leda_window. To increase similarity, some functions have been added with respect to ps_file. For further information on ps_file, we refer to the LEDA manual.

### Creation

Postscript_file_stream PS;
| creates a postscript file stream. The name of the output file is CGAL_unnamed.ps .
Postscript_file_stream PS ( const char* filename);
| creates a postscript file stream. The name of the output file is filename .
Postscript_file_stream PS ( float w, float h);
| creates a postscript file stream that draws the output to a box of physical size width/40 × height/40 cm. The name of the output file is CGAL_unnamed.ps .
Postscript_file_stream PS ( float w, float h, const char* filename);
| creates a postscript file stream that draws the output to a box of physical size width/40 × height/40 cm. The name of the output file is filename .

### Operations

The drawing region of a postscript file stream is initialized by a part of the object space by

void | PS.init ( double x0, double x1, double y0)
|  | initializes the part of the object space that is mapped to the physical drawing box to [x0,x1] × [y0,y0 + height*width/(x1-x0)], where width and height are the width and the height of the drawing box in cm.

The following functions have been added to give Postscript_file_stream the same interface as Window_stream to allow easily replacement of Window_stream by Postscript_file_stream .

void | PS.display () | does nothing
void | PS.display ( int x, int y)
|  | does nothing
int | PS.read_mouse ( double& x, double& y)
|  | returns 1
leda_color | PS.set_fg_color ( leda_color c)
|  | like set_color(c).

See the LEDA Manual [MNSU] for further operations on ps_file.

### Output Operators

The output operator is defined for all geometric classes in the two-dimensional CGAL kernel.

Postscript_file_stream&
| Postscript_file_stream& PS << Class c
|  | inserts object c into the stream PS.
Postscript_file_stream&
| Postscript_file_stream& PS << Color c
|  | changes the foreground color for the next objects that will be inserted into PS.
void | cgalize ( Postscript_file_stream& ps)
|  | sets a few default values for drawing to ps. In particular, node width is set to 5 and line width to 1.

There are no input operators of course.