Oberon || Library || Module Index || Search Engine || Definition || Module

Ulm's Oberon Library:


TermLineGraphics - support of line graphics on ASCII terminals


(* graphics characters *)
CONST verticalLine = 0;
CONST horizontalLine = 1;
CONST lowerRightCorner = 2;
CONST upperRightCorner = 3;
CONST upperLeftCorner = 4;
CONST lowerLeftCorner = 5;
CONST cross = 6;
CONST leftTee = 7;
CONST rightTee = 8;
CONST bottomTee = 9;
CONST topTee = 10;
CONST chars = 11;
(* character sets *)
CONST standard = 0; graphics = 1;

TYPE GraphicsChar = RECORD set: SHORTINT; char: CHAR; END; TYPE CharSet = ARRAY chars OF GraphicsChar; (* graphics charset *)

TYPE SetProc = PROCEDURE (s: Streams.Stream; charset: SHORTINT);

PROCEDURE Init(s: Streams.Stream; charset: CharSet; setCharset: SetProc); PROCEDURE Draw(s: Streams.Stream; char: SHORTINT); PROCEDURE HLine(s: Streams.Stream; line, column, length: INTEGER); PROCEDURE VLine(s: Streams.Stream; line, column, length: INTEGER); PROCEDURE Box(s: Streams.Stream; line, column, lines, columns: INTEGER);


TermLineGraphics adds basic line drawing capabilities to ASCII terminals. Terminals that support line graphics usually provide an alternate character set for graphics characters. TermLineGraphics uses only a subset of all the graphics characters that may be supported by a particular terminal. The information for a specific character, i.e. the character set it belongs to and it's ASCII-code, is stored in a record of type GraphicsChar.

Init has to be called by the underlying terminal implementation with the set of graphics characters in charset and a procedure for changing character sets in setCharset. If Init was not called, TermLineGraphics uses a default set of non-graphics characters for drawing.

Draw draws a single graphics character.

HLine draws a horizontal line.

VLine draws a vertical line.

Box draws a rectangle.

The drawing procedures do not test for valid screen coordinates.


Ralf Beck
Edited by: rbeck, last change: 1996/01/09, revision: 1.4, converted to HTML: 1997/04/28

Oberon || Library || Module Index || Search Engine || Definition || Module