2.2 Displaying bitmaps on the screen

2.2.3 Making a window

A window is a viewport that is surrounded by a frame viewport and that is automatically attached to a bitmap, a bitmap output stream, and a mouse input stream. A window can also have scroll bars; see Section 2.5 on page 26 for more information.

The function make-window creates and returns a window of the specified dimensions:

(setq *window* (make-window :inside-width 100
                            :inside-height 100 
                            :title "My Window"))

There is now a cleared window with borders and a title on the screen. Since a window creates an associated bitmap by default, you can perform graphics operations directly to the window's bitmap by using the variable that contains the window in place of the bitmap argument of output functions:

(draw-circle *window* (make-position 50 50) 30 :width 30)
Notice that the width equals the radius of the circle in the previous example, so a solid circle is drawn in the middle of the window.

Since all windows are created with associated bitmap output streams, you can also format text directly onto the window:

(format *window* "Hello Lisp World!")
You can now change the window's output stream position so that the Common Lisp functionformat outputs to another location:

(setf (stream-position *window*) (make-position 10 50))
(format *window* "Here I am.")

The Window Tool Kit - 9 SEP 1996

Generated with Harlequin WebMaker