As described in the introductory book on Computer Graphics
by Ian Angell, we shall have 3 basic routines in our simple
Calcomp library:
START
initialize all necessary variables and devices.
ENPLOT
flush buffers, ensure device I/O is terminated correctly and
all variables and devices are reset.
PLOT
Routine to position and/or draw a line to a certain point
on the display area.
We can use these routines assured that they are device independent.
There are also several auxiliary routines used to aid in our program development. The code and use of these routines can be found in the programs in the appendices.
The askdev routine is used to determine which device the user wants to plot the graphics image on. It also returns the value of the device chosen either as an enumerated type from the Pascal library or as an integer from the FORTRAN library (see below).
The export routine allows the graphics library to use standard input and output. It is possible to pass file variables or logical unit numbers other than standard input/output to the library via export. This can be used to store the graphical information in a file for example.
START has one parameter which is normally 2 (this is the pen number).
ie call START(2) or start(2);
ENPLOT has no parameters but causes a line to be read from the GIGI or T4010 when called. This enables you to look at your graphics image before it is contaminated by operating system messages. On the plotter, enplot sends the Pen home and resets the plotter interface.
Some Calcomp systems do not have a START or an ENPLOT but rely on the device already being initialised and will call PLOT with an N of 999. This is the same as calling our routine ENPLOT. (See library listing.)
PLOT has 3 parameters - X,Y co-ordinates and also a flag to
indicate what function to perform.
call plot(X,Y,N)
or plot(X,Y,N);
The X,Y co-ordinates are real values not integers. They represent co-ordinates in a WORLD co-ordinate system which is mapped to actual (integer) co-ordinates by device drivers. These values as well as the appropriate escape sequences are then sent to the device. For example if we drew an image with real values lying between 0.0 and 3.5 then for a T4010, the scaling would be 1023/3.5 in the x direction and 780/3.5 in the y direction. These values would then be converted to the nearest integer values - 292 and 222, prefaced by the appropriate command to draw, move, etc and sent to the T4010.