diff options
author | Colin Okay <colin@cicadas.surf> | 2022-07-18 08:45:29 -0500 |
---|---|---|
committer | Colin Okay <colin@cicadas.surf> | 2022-07-18 08:45:29 -0500 |
commit | 371319a26055009066d320742934a2c37882de8f (patch) | |
tree | ebaeae10e610cbe118a792ef566fe225a0aa0741 /examples/11-canvas-geometry.lisp | |
parent | a1bfda1b34afffaf3ea757c3720bbc1762c6cd99 (diff) |
[example] showing off bezier curves on canvas
Diffstat (limited to 'examples/11-canvas-geometry.lisp')
-rw-r--r-- | examples/11-canvas-geometry.lisp | 19 |
1 files changed, 9 insertions, 10 deletions
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) |