DOCUMENTATION FOR UNIT LINEDRAW
Written By Tim Schempp October 21, 1993
Unit LINEDRAW is a simple unit for drawing single and double lines
on the screen. The unit simply allows the programmer to draw line and
rectangles on the screen using the ASCII character set. The unit
automatically detects where line will intersect, and replace the characters
at the intersection with the proper character. This is accomplished by a
rather slow algorithm that creates a code for each line drawing character in
the ASCII set. The demo program will make it very clear how to use the
procedures in this unit. The source code is provided and you are welcome to
make any changes you see fit.
Although these procedures are not particularly fast, you can speed
them up by setting the variable WRITETOMEMORY to TRUE in your program.
(The default value is FALSE.) This will write the characters directly to
Video Memory causing a 15 to 20% improvement in speed. There is on drawback,
in that characters written directly to video memory are written in the current
screen colors at that memory address. Attempts to change the text attributes
through TEXTCOLOR and TEXTBACKGROUND make no changes in the actual output.
I urge you to step through the demo program with F8 and Alt-F5 to see
what each statement of the demo does. Notice how the computer chooses the
appropriate character when any kind of intersection (or corner) is reached.
There is one shortcoming to the drawing characters in the ASCII set.
In some instances, there is no ASCII character to connect a given line.
Consider the following two situations:
|
------X------ -------X--------
| |
| |
There is no ASCII character to fill in the missing X. This is really
a minor shortcoming, because situations like this almost never arise.
This program makes it easy to "dress u
|