diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2018-04-06 10:53:13 +0200 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2018-04-06 10:53:13 +0200 |
commit | bf3f57d011b51beb8783e0b0a6bc8c84bb893059 (patch) | |
tree | 1e6752eeda7425a87781b880182b72a3516d6d8c | |
parent | 15164a6f4aae29e8c3df0d21b0ac1d585c286a07 (diff) |
disk, circle: Use size instead of radius.
-rw-r--r-- | pict.scm | 35 |
1 files changed, 18 insertions, 17 deletions
@@ -479,28 +479,29 @@ strings that are built from the list of attributes LST." (define* (filled-octagon size #:key (color "black")) (remove-outline (fill (octagon size) color))) -(define* (circle radius +(define* (circle size #:key (border-color "black") (border-width 1)) - (make-pict - `(svg (@ (width ,(* 2 radius)) - (height ,(* 2 radius)) - (x 0) - (y 0)) - (circle (@ (style ,(style-list->string - `(("fill" "none") - ("stroke" ,border-color) - ("stroke-width" - ,(number->string border-width))))) - (cx ,radius) - (cy ,radius) - (r ,radius)))))) - -(define* (disk radius + (let ((radius (- (/ size 2) border-width))) + (make-pict + `(svg (@ (width ,size) + (height ,size) + (x 0) + (y 0)) + (circle (@ (style ,(style-list->string + `(("fill" "none") + ("stroke" ,border-color) + ("stroke-width" + ,(number->string border-width))))) + (cx ,(+ radius border-width)) + (cy ,(+ radius border-width)) + (r ,radius))))))) + +(define* (disk size #:key (color "black")) - (remove-outline (fill (circle radius) color))) + (fill (circle size #:border-width 0 #:border-color "none") color)) (define* (ellipse w h #:key |