Oberon || Library || Module Index || Search Engine || Definition || Module
TYPE Plotter = POINTER TO PlotterRec; TYPE PlotterRec = RECORD (Services.ObjectRec) END;
CONST solid = 0; CONST dotted = 1; CONST dotdashed = 2; CONST shortdashed = 3; CONST longdashed = 4; CONST lineModes = 5; TYPE LineMode = SHORTINT; (* solid ... *)
CONST setspace = 0; CONST erase = 1; CONST string = 2; CONST linemodes = 3; CONST linewidth = 4; TYPE CapabilitySet = SET; (* OF setspace, erase ... *)
TYPE Description = POINTER TO DescriptionRec; TYPE DescriptionRec = RECORD (Objects.ObjectRec) xmin, ymin, xmax, ymax: INTEGER; (* maximal supported range *) END;
TYPE GetSpaceProc = PROCEDURE ( plotter: Plotter; VAR xmin, ymin, xmax, ymax: INTEGER); TYPE SetSpaceProc = PROCEDURE ( plotter: Plotter; xmin, ymin, xmax, ymax: INTEGER); TYPE EraseProc = PROCEDURE (plotter: Plotter); TYPE MoveProc = PROCEDURE (plotter: Plotter; xto, yto: INTEGER); TYPE LineProc = PROCEDURE (plotter: Plotter; xfrom, yfrom, xto, yto: INTEGER); TYPE ArcProc = PROCEDURE ( plotter: Plotter; xcenter, ycenter, xstart, ystart, xend, yend: INTEGER); TYPE CircleProc = PROCEDURE ( plotter: Plotter; xcenter, ycenter, radius: INTEGER); TYPE StringProc = PROCEDURE (plotter: Plotter; str: ARRAY OF CHAR); TYPE SetLineModeProc = PROCEDURE (plotter: Plotter; mode: LineMode); TYPE SetLineWidthProc = PROCEDURE (plotter: Plotter; width: INTEGER); TYPE CloseProc = PROCEDURE (plotter: Plotter); TYPE Interface = POINTER TO InterfaceRec; TYPE InterfaceRec = RECORD (Objects.ObjectRec) setSpace: SetSpaceProc; erase: EraseProc; move: MoveProc; cont: MoveProc; point: MoveProc; line: LineProc; arc: ArcProc; circle: CircleProc; string: StringProc; setLineMode: SetLineModeProc; setLineWidth: SetLineWidthProc; close: CloseProc; END;
PROCEDURE Init(plotter: Plotter; if: Interface; caps: CapabilitySet; desc: Description); PROCEDURE GetCapabilities(plotter: Plotter) : CapabilitySet;
PROCEDURE GetSpace(plotter: Plotter; VAR xmin, ymin, xmax, ymax: INTEGER); PROCEDURE GetMaxSpace(plotter: Plotter; VAR xmin, ymin, xmax, ymax: INTEGER); PROCEDURE SetSpace(plotter: Plotter; xmin, ymin, xmax, ymax: INTEGER);
PROCEDURE Erase(plotter: Plotter);
PROCEDURE Move(plotter: Plotter; xto, yto: INTEGER); PROCEDURE Cont(plotter: Plotter; xto, yto: INTEGER); PROCEDURE Point(plotter: Plotter; xpoint, ypoint: INTEGER); PROCEDURE Line(plotter: Plotter; xfrom, yfrom, xto, yto: INTEGER); PROCEDURE Arc(plotter: Plotter; xcenter, ycenter, xstart, ystart, xend, yend: INTEGER); PROCEDURE Circle(plotter: Plotter; xcenter, ycenter, radius: INTEGER); PROCEDURE String(plotter: Plotter; str: ARRAY OF CHAR); PROCEDURE SetLineMode(plotter: Plotter; mode: LineMode); PROCEDURE SetLineWidth(plotter: Plotter; width: INTEGER);
PROCEDURE Close(plotter: Plotter);
A plotter provides a two-dimensional rectangular discrete space whose dimensions can be retrieved by GetSpace, and, if supported, changed by SetSpace under consideration of the maximal supported space returned by GetMaxSpace. Note that many plotter implementations support square areas only, that means they convert rectangular areas implicitly to the smallest square enclosing them. There is always a current position defined which is initially (0,0) in the lower left corner of the plotting space.
GetSpace, Move, Cont, Point, Line, Arc, Circle, and Close are supported by all implementations. SetSpace, Erase, String, and SetLineMode are permitted by some implementations only. The set of capabilities returned by GetCapabilities tells which of the optional operations are permitted.
Move sets the current position to xto, yto.
Cont draws a line from the current position to xto, yto, and sets the current position to (xto, yto).
Point draws a point at the given position and sets the current point to it.
Line draws a line between the given two points and sets the current point to (xto, yto).
Arc draws an arc of a circle with center point (xcenter, ycenter), beginning at (xstart, ystart) and going counter-clockwise to (xend, yend). The current position is undefined after this operation.
Circle draws a circle with the given center point and radius. The current position is undefined after this operation.
String puts a text string at the current position. The string must not include newlines. This is permitted only if string is in the set of capabilities.
SetLineMode allows to set the line mode to solid, dotted, dotdashed, shortdashed, or longdashed. This is permitted only if linemodes is in the set of capabilities.
SetLineWidth changes the line width to width. This is permitted only if linewidth is in the set of capabilities.
Close allows to finalize a plot. No operation on the plotter is allowed afterwards. This operation is implicitly invoked in case of a termination event (see Resources).
Oberon || Library || Module Index || Search Engine || Definition || Module