From 9920cd41fe11871a835ad3f8325d779b172d2c33 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Tue, 19 Jul 2022 10:58:40 -0500 Subject: [example] fiddling with the example --- examples/12-canvas-drawing-language.lisp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'examples/12-canvas-drawing-language.lisp') diff --git a/examples/12-canvas-drawing-language.lisp b/examples/12-canvas-drawing-language.lisp index 526ec2d..d79bc82 100644 --- a/examples/12-canvas-drawing-language.lisp +++ b/examples/12-canvas-drawing-language.lisp @@ -28,14 +28,32 @@ (defun filled-triangle-at (x y) (ww::move-to x y) (ww::fill-rel-path - '((-10 100) - (10 -30)))) + '((100 100) + (100 -100)))) + +(defun lower-the-bluer (x y) + (list (* 256 (/ x 500)) + (* 256 (/ y 500)) + 255 + 255)) + +(defun plaid1 (x y) + (list (mod (* x x) 256) + (mod (* y y) 256) + (mod (* x y) 256) + 255)) (defun draw-stuff (canvas time) (declare (ignorable time)) (ww::with-canvas canvas (triangle-at 100 100) - (filled-triangle-at 200 200))) + (ww::canvas-pen-color-function #'plaid1) + (filled-triangle-at 250 200) + (ww::canvas-pen-color-function #'lower-the-bluer) + (ww::canvas-pen-width 2) + (ww::stroke-bezier + '((0 0) (200 120) (50 350) (200 100) (300 400)) + 1000))) (defmethod ww:boot ((app canvas-lang-demo )) (let ((canvas @@ -50,7 +68,7 @@ (ww:add-unit app canvas) ;; handlers - (ww::add-handler canvas #'clear-and-draw) + (ww:add-handler canvas #'clear-and-draw) (ww:add-handler app #'quit) (ww:add-handler canvas #'quit))) -- cgit v1.2.3