bug-lilypond
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Feature request: Display bezier control-points


From: Thomas Morley
Subject: Re: Feature request: Display bezier control-points
Date: Fri, 4 May 2012 12:32:12 +0200

Hi Urs,

> There are two more issues with this:
> - I don't see how to get it working with ties. Which would be nice of course

works with Ties now. Can't do more for now. I have to go to my regular job. :(

\version "2.14.2"

#(define (make-cross-stencil coords)
 (ly:stencil-add
   (make-line-stencil 0.1 (- (car coords) 0.2) (- (cdr coords) 0.2)
  (+ (car coords) 0.2) (+ (cdr coords) 0.2))
   (make-line-stencil 0.1 (- (car coords) 0.2) (+ (cdr coords) 0.2)
  (+ (car coords) 0.2) (- (cdr coords) 0.2))))

#(define (display-control-points line)
 (lambda (grob)
   (let* ((grob-name (lambda (x) (assq-ref (ly:grob-property x 'meta) 'name)))
          (name (grob-name grob))
          (stil (cond ((or (eq? name 'Slur)(eq? name
'PhrasingSlur))(ly:slur::print grob))
                      ((eq? name 'Tie)(ly:tie::print grob))))
          (cps (ly:grob-property grob 'control-points)))

  (ly:stencil-add stil
    (ly:stencil-in-color
      (ly:stencil-add
         ;(make-cross-stencil (first cps))
         (make-cross-stencil (second cps))
         (make-cross-stencil (third cps))
         ;(make-cross-stencil (fourth cps))
         )
         1 0 0)

     (if (eq? line #t)
         (begin
          (ly:stencil-add
           (make-line-stencil 0.05 (car (first cps)) (cdr (first cps))
(car (second cps))  (cdr (second cps)))
           ;(make-line-stencil 0.05 (car (second cps)) (cdr (second
cps)) (car (third cps))  (cdr (third cps)))
           (make-line-stencil 0.05 (car (third cps)) (cdr (third cps))
(car (fourth cps))  (cdr (fourth cps)))
           ))
         empty-stencil)
     )
     )))

\relative c'' {
 \override Slur #'stencil = #(display-control-points #t)
 c2( d e f)
 \override PhrasingSlur #'stencil = #(display-control-points #t)
 c2\( d e f\)
 \override Tie #'stencil = #(display-control-points #t)
 e2~ e
}

-Harm



reply via email to

[Prev in Thread] Current Thread [Next in Thread]