Graphics Library Short Manual


Once you download the graphics library, and load it into STk, a graphics window will appear. This is the canvas in which you will draw graphical objects. The following calls will return a single number, an ID for that particular graphical object (line, oval, rectangle, text, etc.) If you save those IDs, you can change the color of the object, bind a mouse action with it, and so on.
For example,
(define r1 (fill-rectangle 10 10 100 100))
draws a rectangle with upper left coordinate at (10, 10) and lower right coordinate at (100, 100) and fills the rectangle with BLACK color (default)
(set-color! r1 "yellow") will change the color of the rectangle to YELLOW
We will not worry about mouse binding since it is really not part of the curriculum. (This is for those who might want to do more fun stuff.) Neither is the coloring and/or drawing stuff on the canvas. When the canvas is really full of stuff, you might want to erase everything. (clear-graphics!) will clear the canvas.
(delete! r1) will delete the rectangle object from the canvas.
For more information, take a look at the top part of the file