(* Routines to generate Encapsulated Postscript files *) INTERFACE EPSPlot; IMPORT Wr; TYPE Axis = {X, Y}; PROCEDURE BeginFile ( psfile: Wr.T; xmin, xmax, ymin, ymax: LONGREAL; xn, yn: CARDINAL ); (* Initializes an EPS file: writes the header (including the bounding box line), sets the coordinate system, clip path, and caption font, defines new Postscript operators and constants, etc. The plotting area is "[xmin__xmax]x[ymin__ymax]" in client coordinates, and is divided implicitly into a grid of "xn" by "yn" rectangular "cells". *) PROCEDURE BeginSection (psfile: Wr.T; title: TEXT); (* Starts a new section of a plot. The title is a comment *) PROCEDURE SetPen ( psfile: Wr.T; gray: REAL; width: REAL; dashlength: REAL; dashspace: REAL ); (* Sets pen parameters and ink color for line drawing. *) (* Dimensions are in mm *) PROCEDURE DrawSegment (psfile: Wr.T; xa, ya, xb, yb: LONGREAL); (* Draws segment from (xa,ya) to (xb,yb) with current pen and gray *) PROCEDURE DrawRectangle (psfile: Wr.T; xlo, xhi, ylo, yhi: LONGREAL); (* Draws the outline of thegiven rectangle using the current pen. *) PROCEDURE FillRectangle ( psfile: Wr.T; xlo, xhi, ylo, yhi: LONGREAL; gray: REAL ); (* Fills given rectangle with given gray color *) PROCEDURE FillAndDrawRectangle ( psfile: Wr.T; xlo, xhi, ylo, yhi: LONGREAL; gray: REAL ); (* Fills rectangle with given gray, then *) (* draws its outline with current pen. *) PROCEDURE FillTriangle ( psfile: Wr.T; xa, ya, xb, yb, xc, yc: LONGREAL; gray: REAL; ); (* Fills triangle /abc/ with given gray level. *) PROCEDURE FillCircle ( psfile: Wr.T; xc, yc, radius: LONGREAL; gray: REAL ); (* Fills the circle with given center and radius, using the given gray. *) PROCEDURE DrawCircle ( psfile: Wr.T; xc, yc, radius: LONGREAL; ); (* Draws the circle with given center and radius, *) (* using the current pen and gray. *) PROCEDURE FillAndDrawCircle ( psfile: Wr.T; xc, yc, radius: LONGREAL; gray: REAL; ); (* Fills the circle with given center and radius, *) (* using the given gray, then draws its outline, *) (* using the current pen and gray. *) PROCEDURE FillGridCell (psfile: Wr.T; xi, yi: CARDINAL; gray: REAL); (* Fills the given cell of the current cell grid with *) (* the given gray level. *) PROCEDURE DrawCoordLine (psfile: Wr.T; axis: Axis; coord: LONGREAL); (* Draws a reference line perpendicular to the given axis *) (* at the given coordinate value. *) PROCEDURE DrawGridLines (psfile: Wr.T); (* Draws the grid lines with the current pen and gray level. *) PROCEDURE EndSection (psfile: Wr.T); (* Ends a section of a plot. *) PROCEDURE AddCaption (psfile: Wr.T; txt: TEXT); (* Appends a caption line under the drawing. *) (* For multi-line captions, use multiple calls *) (* and/or embedded newlines. *) PROCEDURE DrawFrame (psfile: Wr.T); (* Draws a frame around the plotting area *) PROCEDURE EndFile (psfile: Wr.T); (* Finalizes the file. *) END EPSPlot.