From 371319a26055009066d320742934a2c37882de8f Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Mon, 18 Jul 2022 08:45:29 -0500 Subject: [example] showing off bezier curves on canvas --- examples/11-canvas-geometry.lisp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'examples') diff --git a/examples/11-canvas-geometry.lisp b/examples/11-canvas-geometry.lisp index e36df6e..bfc41f7 100644 --- a/examples/11-canvas-geometry.lisp +++ b/examples/11-canvas-geometry.lisp @@ -45,7 +45,7 @@ g (mod (* x x) 256) b (mod (* y x) 256))))) - ;; draw a random pentagonal thing + ;; draw a random thing (let ((path (loop repeat 7 collect (list (+ 10 (random 240)) @@ -56,16 +56,15 @@ g (mod (* 3 x) 256) b (mod (* x y) 256))))) - (let ((path - (loop repeat 20 - collect (list (+ 10 (random 200)) - (+ 260 (random 200)))))) - (ww::with-grid-path (x y) (path :autoclosep t) + (let ((control-points + '((10 490) + (400 400) + (0 400) + (40 250)))) + (ww::with-grid-bezier (x y) (control-points :step 0.001) (ww::with-pixel (r g b a) (ww::pixel canvas x y) - (setf r (mod (* 2 y) 256) - g (mod (* 3 x) 256) - b (mod (* x y) 256))))) - + (ww::setf-many r g b a 255)))) + ;; blit the canvas (ww::blit canvas) -- cgit v1.2.3