From 6fb1344b8004338c96589caa889e65d6d5a414f1 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Wed, 23 Jan 2019 14:21:23 -0800 Subject: [PATCH] leniency --- pitfall/pitfall/vector.rkt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pitfall/pitfall/vector.rkt b/pitfall/pitfall/vector.rkt index 56bcbede..e969a4b9 100644 --- a/pitfall/pitfall/vector.rkt +++ b/pitfall/pitfall/vector.rkt @@ -120,9 +120,12 @@ (define (quadratic-curve-to doc cpx cpy x y) (add-content doc (format "~a v" (string-join (map numberizer (list cpx cpy x y)) " ")))) -(define (rect doc x y w h) +(define (rect doc x y w [h w]) (add-content doc (format "~a re" (string-join (map numberizer (list x y w h)) " ")))) +(define (rect-centered doc x y w [h w]) + (rect doc (- x (/ w 2)) (- y (/ h 2)) w h)) + (define scale (match-lambda* [(list (? pdf? doc) (? number? x-factor)) (scale doc x-factor (mhash))] @@ -137,7 +140,8 @@ (define (shear doc x y) (transform doc 1 y x 1 0 0)) -(define (stroke doc [color #f]) +(define (stroke doc [color #f] [width #f]) + (when width (line-width doc width)) (when color (stroke-color doc color)) (add-content doc "S"))