ifelse
} bind def
-/draw_oval % filled? x-radius y-radius thickness draw_ellipse
-{
- setlinewidth % f? x-r y-r
- /yrad exch def
- /xrad exch def
- xrad 0 rmoveto
- 0 yrad -2 xrad mul dup yrad exch 0 rcurveto
- 0 yrad neg dup 2 xrad mul dup 3 1 roll 0 rcurveto
- closepath
- { stroke_and_fill}
- { stroke }
- ifelse
-} bind def
-
/draw_ellipse % filled? x-radius y-radius thickness draw_ellipse
{
setlinewidth % f? x-r y-r
(define (no-origin)
"")
-(define (oval x-radius y-radius thick fill)
- (ly:format
- "~a ~4f ~4f ~4f draw_oval"
- (if fill
- "true"
- "false")
- x-radius y-radius thick))
-
(define (placebox x y s)
(if (not (string-null? s))
(ly:format "~4f ~4f moveto ~a\n" x y s)
(define (no-origin)
"")
-(define (oval x-radius y-radius thick is-filled)
- (let ((x-max x-radius)
- (x-min (- x-radius))
- (y-max y-radius)
- (y-min (- y-radius)))
- (entity
- 'path ""
- '(stroke-linejoin . "round")
- '(stroke-linecap . "round")
- `(fill . ,(if is-filled "currentColor" "none"))
- `(stroke . "currentColor")
- `(stroke-width . ,thick)
- `(d . ,(ly:format "M~4f ~4fC~4f ~4f ~4f ~4f ~4f ~4fS~4f ~4f ~4f ~4fz"
- x-max 0
- x-max y-max
- x-min y-max
- x-min 0
- x-max y-min
- x-max 0)))))
-
(define* (path thick commands #:optional (cap 'round) (join 'round) (fill? #f))
(define (convert-path-exps exps)
(if (pair? exps)
defined by @code{fill}."
(let*
((x-out-radius (+ x-radius (/ thickness 2.0)))
- (y-out-radius (+ y-radius (/ thickness 2.0))) )
-
+ (y-out-radius (+ y-radius (/ thickness 2.0)))
+ (x-max x-radius)
+ (x-min (- x-radius))
+ (y-max y-radius)
+ (y-min (- y-radius))
+ (commands `(,(list 'moveto x-max 0)
+ ,(list 'curveto x-max y-max x-min y-max x-min 0)
+ ,(list 'curveto x-min y-min x-max y-min x-max 0)
+ ,(list 'closepath)))
+ (command-list (fold-right append '() commands)))
(ly:make-stencil
- (list 'oval x-radius y-radius thickness fill)
- (cons (- x-out-radius) x-out-radius)
- (cons (- y-out-radius) y-out-radius))))
+ `(path ,thickness `(,@',command-list) 'round 'round ,fill)
+ (cons (- x-out-radius) x-out-radius)
+ (cons (- y-out-radius) y-out-radius))))
(define-public
(make-partial-ellipse-stencil
(append prepend-origin (list 'closepath))
prepend-origin))
(command-list (fold-right append '() final-path)))
-
(ly:make-stencil
`(path ,thickness
`(,@',command-list)