[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Graphics in DOS

William Echard <WECHARD@VM2.YorkU.CA> asked:

> Right now I'm limited to using Clisp under DOS, in text mode
> only.  Are there extensions that I can get that will make it fairly easy to
> switch into graphics mode and draw on the screen?

Yes, there are.

Graphics primitives in CLISP

In CLISP 1994-01-07 or newer,
* DOS version,
* Linux version, installed setuid root,
there are some pixel graphics primitives in the SYSTEM package.
They operate on a VGA card.

Similar pixel graphics primitives can be used in the
* Unix version running under X11
by use of the small XTERM package available on

This is the description of the PC/VGA graphics primitives:

(SYSTEM::GRAPH-INIT [width [height [colors]]])
initializes the graphics system. The width, height parameters are hints for
the size of the desired graphics screen (positive integers). The colors
parameter is a hint for the number of colors. The actual width, height
is implementation dependent, currently up to 640x480 on VGA cards and up to
1024x768 on ET4000 SVGA cards.
Returns an alist ((color-value color-keyword) ...) which lists the available
colours and their numerical equivalents.

switches the graphics hardware so that the graphics screen is visible. The
text screen is activated on any text output.

fills the entire graphics screen with a single color.

returns two values: the actual width and the actual height of the graphics
screen (in pixels).

If (SYSTEM::GRAPH-DIMS) returns the values w and h, then valid screen
coordinates are pairs (x,y) with 0 <= x < w and 0 <= y < h. x=0 denotes the
left edge, y=0 the top edge.

returns the colour of the pixel (x,y).
(SYSTEM::GRAPH-DOT x y color)
sets the colour of the pixel (x,y) to color.

(SYSTEM::GRAPH-BOX x1 y1 x2 y2 color)
draws a box (= filled rectangle) in colour color, the vertices being the pixels
        (x1,y1)   (x2,y1)
        (x1,y2)   (x2,y2)

(SYSTEM::GRAPH-LINE x1 y1 x2 y2 color)
Draws a line in colour color from pixel (x1,y1) to pixel (x2,y2).

This specification is subject to change.

Bruno Haible                                                 January 1994