From 53019e4770d1cf9999201e261fd6d93ab3c0d849 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Sun, 17 Jul 2022 12:42:42 -0500 Subject: [wip] --- examples/11-canvas-geometry.lisp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 examples/11-canvas-geometry.lisp (limited to 'examples/11-canvas-geometry.lisp') 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))) -- cgit v1.2.3