diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/11-canvas-geometry.lisp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/examples/11-canvas-geometry.lisp b/examples/11-canvas-geometry.lisp new file mode 100644 index 0000000..1147ed9 --- /dev/null +++ b/examples/11-canvas-geometry.lisp @@ -0,0 +1,32 @@ +;;;; examples/11-canvas-geometry.lisp + +(defpackage #:ww.examples/11 + (:use #:cl) + (:export #:start)) + +(in-package :ww.examples/11) + +(defclass geo-demo (ww:application) ()) + +(defmethod ww:boot ((app geo-demo)) + (let ((canvas + (make-instance 'ww:canvas + :pixel-width 500 + :pixel-height 500))) + ;; stretch canvas over the whole app + (setf (ww:width canvas) (ww::application-width app) + (ww:height canvas) (ww::application-height app)) + + ;; add it to the display tree + (ww:add-unit app canvas) + + ;; draw a circle + (ww::with-grid-circle (x y) (50 50 30) + (ww::with-pixel (r g b a) (ww::pixel canvas x y) + (setf r (mod (* x y) 255) + g x + b y))) + + + ;; blit the canvas + (ww::blit canvas))) |