From b5e69cfdb834546c2bfbae910686d42ab5255e78 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Sun, 17 Jul 2022 19:51:45 -0500 Subject: [example] twiddling --- examples/11-canvas-geometry.lisp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'examples') diff --git a/examples/11-canvas-geometry.lisp b/examples/11-canvas-geometry.lisp index 8565eb3..8c8082b 100644 --- a/examples/11-canvas-geometry.lisp +++ b/examples/11-canvas-geometry.lisp @@ -28,9 +28,9 @@ ;; draw a circle (ww::with-grid-circle (x y) (150 50 30 :interiorp t) (ww::with-pixel (r g b a) (ww::pixel canvas x y) - (setf r (mod (* x y) 255) - g x - b y))) + (setf r (mod (* 3 x y) 256) + g (mod (+ x x) 256) + b (mod (* y y) 256)))) ;; draw a bunch of circles (loop @@ -49,8 +49,18 @@ (+ 10 (random 80)))))) (ww::with-grid-path (x y) (path :autoclosep t :interiorp t) (ww::with-pixel (r g b a) (ww::pixel canvas x y) - (setf r (mod y 256) - g (mod x 256) + (setf r (mod (* 2 y) 256) + g (mod (* 3 x) 256) + b (mod (* x y) 256))))) + + (let ((path + (loop repeat 20 + collect (list (+ 10 (random 80)) + (+ 110 (random 80)))))) + (ww::with-grid-path (x y) (path :autoclosep t) + (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))))) ;; blit the canvas @@ -60,11 +70,11 @@ (ww:add-handler app #'quit) (ww:add-handler canvas #'quit))) -(defun start () +(defun start (&optional (side 500)) (ww::start (make-instance 'geo-demo :fps 10 - :width 500 - :height 500 + :width side + :height side :title "Pixels Geometry"))) -- cgit v1.2.3