aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-07-20 10:04:59 -0500
committerColin Okay <colin@cicadas.surf>2022-07-20 10:04:59 -0500
commit613f3381583537033e03285ab3f9242bbfbeba65 (patch)
treeedea9934e89bd5288d6de5d899b2514f52394e8a
parentfdd4275c181fbf86c9cac01eb651fb6885cdf371 (diff)
[modify] how apply-pen-at handles pen width
-rw-r--r--examples/12-canvas-drawing-language.lisp2
-rw-r--r--src/canvas-language.lisp4
2 files changed, 3 insertions, 3 deletions
diff --git a/examples/12-canvas-drawing-language.lisp b/examples/12-canvas-drawing-language.lisp
index b4a621b..43d2dea 100644
--- a/examples/12-canvas-drawing-language.lisp
+++ b/examples/12-canvas-drawing-language.lisp
@@ -70,7 +70,7 @@
(list 0 0))
do
(ww::fill-rel-bezier ls 12)
- (ww::with-pen (:color (list 0 0 0 255))
+ (ww::with-pen (:color (list 0 0 0 255) :width 1)
(ww::stroke-rel-bezier ls 12)))))
(defun draw-stuff (canvas)
diff --git a/src/canvas-language.lisp b/src/canvas-language.lisp
index 05cddfd..83e510f 100644
--- a/src/canvas-language.lisp
+++ b/src/canvas-language.lisp
@@ -109,14 +109,14 @@ saved by WITH-PEN-STATE"
(defun apply-pen-at (x y)
(let ((w
- (max 0 (floor (* 0.5 *current-pen-width*)))))
+ (max 0 (1- *current-pen-width*))))
(destructuring-bind
(cr cg cb ca)
(etypecase *current-pen-color*
(null (list 0 0 0 255))
(list *current-pen-color*)
(function (funcall *current-pen-color* x y)))
- (with-grid-rect (rx ry) ((- x w) (- y w) (+ x w) (+ y w))
+ (with-grid-rect (rx ry) (x y (+ x w) (+ y w))
(when (can-fill-canvas-at-p rx ry)
(with-pixel (r g b a) (pixel *current-canvas* rx ry)
(setf r cr g cg b cb a ca)))))))