DEFINITION MODULE PSGraphics;

(* simple PostScript Graphics routines *)
(* J. Andrea, May.16/91 *)
(* This code may be freely used and distributed, it may not be sold. *)


EXPORT QUALIFIED
   BeginPS, EndPS,
   GetDimensions,  GetPosition,
   Border, Move, Dot, Line, Circle, Rectangle, VectorMove, VectorLine, Text,
   Command;


PROCEDURE BeginPS( filename :ARRAY OF CHAR );
(* define the output file to hold the graphics commands *)

PROCEDURE EndPS;
(* close the current output file *)


PROCEDURE GetDimensions( VAR x, y :CARDINAL );
(* return the maximum possible dimensions of the display *)

PROCEDURE GetPosition( VAR x, y :CARDINAL );
(* return the current location of the cursor *)


PROCEDURE Border;
(* draw a border around the largest dimensions *)

PROCEDURE Move( x, y :CARDINAL );
(* move to the new location, make it the current point *)

PROCEDURE Dot;
(* draw a dot at the current location *)

PROCEDURE Line( x, y :CARDINAL );
(* draw a line from the current point to the new point,
   and the new point will become the current point *)

PROCEDURE Circle( radius :CARDINAL; filled :BOOLEAN );
(* draw a circle of the given radius from the current point *)

PROCEDURE Rectangle( width, height :CARDINAL; filled :BOOLEAN );
(* draw a rectangle, one corner at current point,
   opposite corner at current+width,current+height *)

PROCEDURE VectorMove( length :CARDINAL; angle :REAL );
(* move from the current location given a length and angle *)

PROCEDURE VectorLine( length :CARDINAL; angle :REAL );
(* draw a line from the current location given a length and angle,
   and the new point will become the current point *)

PROCEDURE Text( string :ARRAY OF CHAR; size :CARDINAL );
(* put some text at the current location *)


PROCEDURE Command( string :ARRAY OF CHAR );
(* put some other PostScript command into the output stream *)


END PSGraphics.
