The SolCanvas graphics system is implemented as a Sol category. The member-set of the category is the return-type of many member functions.
(define SolGraphics
(category
()
; No parent category
; Set of objects the
; SolGraphics functions will
; manipulate. Starts out
; empty. As new objects are
; created, they are added to
; the set.
(set "SolCanvas: Error")
()
; No set operators
; Define the list of member methods.
;; The newFrame method produces a new AWT frame with the specified
;; title, width, and height, and adds it to the member-set. This
;; method is primarily for creating Sol applications rather than
;; applets (which will inherit a frame from the SolApplet java class).
((newFrame
(function
member-set ((title sstring)
(width integer)
(height integer))
(let ((frame
((primitive-constructor
<java.awt.Frame> (<java.lang.String>)) title)))
(set-set! (union member-set (set frame)))
(setFrameSize frame width height)
(return frame))))
;; The setFrameSize method sets he size of a frame.
(setFrameSize
(function
sol ((frame member-set)
(width integer)
(height integer))
((primitive-virtual-method
<java.awt.Frame> "setSize" <void> (<int> <int>)) frame width height)))
;; The showFrame method displays a frame previously created by
;; newFrame.
(showFrame
(function
sol ((frame sol))
((primitive-virtual-method <java.awt.Frame> "show" <void> ()) frame)))
;; The getCanvas method gets a drawing canvas from a SolApplet
;; subclass instance. This is what Sol applets use to get a drawing
;; context.
(getCanvas
(function
member-set ()
(let ((canvas2
((primitive-get-static
<sol.java.SolApplet> "solCanvas" <sol.java.SolCanvas>))))
(set-set! (union member-set (set canvas2)))
(return canvas2))))
;; The newSolCanvas method creates a new SolCanvas with the specified
;; update delay time (in miliseconds), and adds it to the member-set.
(newSolCanvas
(function
member-set ((delay integer))
(let ((canvas
((primitive-constructor <sol.java.SolCanvas> (<long>)) delay)))
(set-set! (union member-set (set canvas)))
(return canvas))))
;; The updatePosition method changes the x,y location of a drawable
;; and updates the bounding box assuming the size has not changed.
(updatePosition
(function
sol ((drawable sol)
(x integer)
(y integer))
((primitive-virtual-method
<sol.java.Drawable> "updatePosition" <void> (<int> <int>))
drawable x y)))
;; The newCircleDrawable method creates a new CircleDrawable with the
;; specified center, radius, color, and fill-flag.
(newCircleDrawable
(function
sol ((x integer)
(y integer)
(radius integer)
(color sol)
(drawMe boolean))
((primitive-constructor
<sol.java.CircleDrawable>
(<int> <int> <int> <java.awt.Color> <boolean>))
x y radius color drawMe)))
(define SolGraphics
(category
()
; No parent category
; Set of objects the
; SolGraphics functions will
; manipulate. Starts out
; empty. As new objects are
; created, they are added to
; the set.
(set "SolCanvas: Error")
()
; No set operators
; Define the list of member methods.
;; The newFrame method produces a new AWT frame with the specified
;; title, width, and height, and adds it to the member-set. This
;; method is primarily for creating Sol applications rather than
;; applets (which will inherit a frame from the SolApplet java class).
((newFrame
(function
member-set ((title sstring)
(width integer)
(height integer))
(let ((frame
((primitive-constructor
<java.awt.Frame> (<java.lang.String>)) title)))
(set-set! (union member-set (set frame)))
(setFrameSize frame width height)
(return frame))))
;; The setFrameSize method sets he size of a frame.
(setFrameSize
(function
sol ((frame member-set)
(width integer)
(height integer))
((primitive-virtual-method
<java.awt.Frame> "setSize" <void> (<int> <int>)) frame width height)))
;; The showFrame method displays a frame previously created by
;; newFrame.
(showFrame
(function
sol ((frame sol))
((primitive-virtual-method <java.awt.Frame> "show" <void> ()) frame)))
;; The getCanvas method gets a drawing canvas from a SolApplet
;; subclass instance. This is what Sol applets use to get a drawing
;; context.
(getCanvas
(function
member-set ()
(let ((canvas2
((primitive-get-static
<sol.java.SolApplet> "solCanvas" <sol.java.SolCanvas>))))
(set-set! (union member-set (set canvas2)))
(return canvas2))))
;; The newSolCanvas method creates a new SolCanvas with the specified
;; update delay time (in miliseconds), and adds it to the member-set.
(newSolCanvas
(function
member-set ((delay integer))
(let ((canvas
((primitive-constructor <sol.java.SolCanvas> (<long>)) delay)))
(set-set! (union member-set (set canvas)))
(return canvas))))
;; The updatePosition method changes the x,y location of a drawable
;; and updates the bounding box assuming the size has not changed.
(updatePosition
(function
sol ((drawable sol)
(x integer)
(y integer))
((primitive-virtual-method
<sol.java.Drawable> "updatePosition" <void> (<int> <int>))
drawable x y)))
;; The newCircleDrawable method creates a new CircleDrawable with the
;; specified center, radius, color, and fill-flag.
(newCircleDrawable
(function
sol ((x integer)
(y integer)
(radius integer)
(color sol)
(drawMe boolean))
((primitive-constructor
<sol.java.CircleDrawable>
(<int> <int> <int> <java.awt.Color> <boolean>))
x y radius color drawMe)))