aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/11-canvas-geometry.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/11-canvas-geometry.lisp')
-rw-r--r--examples/11-canvas-geometry.lisp23
1 files changed, 13 insertions, 10 deletions
diff --git a/examples/11-canvas-geometry.lisp b/examples/11-canvas-geometry.lisp
index 8c8082b..e36df6e 100644
--- a/examples/11-canvas-geometry.lisp
+++ b/examples/11-canvas-geometry.lisp
@@ -16,8 +16,8 @@
(defmethod ww:boot ((app geo-demo))
(let ((canvas
(make-instance 'ww:canvas
- :pixel-width 200
- :pixel-height 200)))
+ :pixel-width 500
+ :pixel-height 500)))
;; stretch canvas over the whole app
(setf (ww:width canvas) (ww::application-width app)
(ww:height canvas) (ww::application-height app))
@@ -25,8 +25,11 @@
;; add it to the display tree
(ww:add-unit app canvas)
+ (ww::with-pixels-rect (x y r g b a) (canvas)
+ (ww::setf-many r g b 0))
+
;; draw a circle
- (ww::with-grid-circle (x y) (150 50 30 :interiorp t)
+ (ww::with-grid-circle (x y) (350 100 90 :interiorp t)
(ww::with-pixel (r g b a) (ww::pixel canvas x y)
(setf r (mod (* 3 x y) 256)
g (mod (+ x x) 256)
@@ -34,9 +37,9 @@
;; draw a bunch of circles
(loop
- for cx from 0 to 50 by 5
- for cy from 0 to 50 by 5 do
- (ww::with-grid-circle (x y) ((+ 100 cx) (+ 100 cy) 10)
+ for cx from 0 to 50
+ for cy from 0 to 50 do
+ (ww::with-grid-circle (x y) ((+ 300 cx) (+ 300 cy) 80)
(ww::with-pixel (r g b a) (ww::pixel canvas x y)
(setf r (mod (* x y) 256)
g (mod (* x x) 256)
@@ -45,8 +48,8 @@
;; draw a random pentagonal thing
(let ((path
(loop repeat 7
- collect (list (+ 10 (random 80))
- (+ 10 (random 80))))))
+ collect (list (+ 10 (random 240))
+ (+ 10 (random 240))))))
(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 (* 2 y) 256)
@@ -55,8 +58,8 @@
(let ((path
(loop repeat 20
- collect (list (+ 10 (random 80))
- (+ 110 (random 80))))))
+ collect (list (+ 10 (random 200))
+ (+ 260 (random 200))))))
(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)