aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/11-canvas-geometry.lisp
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-07-17 19:51:45 -0500
committerColin Okay <colin@cicadas.surf>2022-07-17 19:51:45 -0500
commitb5e69cfdb834546c2bfbae910686d42ab5255e78 (patch)
tree20e2b36214be073c27c08674db3c6f280f4c3321 /examples/11-canvas-geometry.lisp
parent3e85c0806e4ab69fdecf9d2266656c333c17a526 (diff)
[example] twiddling
Diffstat (limited to 'examples/11-canvas-geometry.lisp')
-rw-r--r--examples/11-canvas-geometry.lisp26
1 files changed, 18 insertions, 8 deletions
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")))