[Top][All Lists]

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

Re: Feature request: Display bezier control-points

From: Urs Liska
Subject: Re: Feature request: Display bezier control-points
Date: Fri, 04 May 2012 11:15:06 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329 Thunderbird/11.0.1

Am 04.05.2012 03:09, schrieb Thomas Morley:
Hi Urs,

I would be very happy about one or two more features (that I unfortunately
can't implement myself:
- highlight (and separate from the music) the crosses through a color
- possibly adding a connecting (very thin) line, making it even more

how about:

\version "2.14.2"

#(define (make-cross-stencil coords)
    (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 ((stencil (ly:slur::print grob))
          (cps (ly:grob-property grob 'control-points)))

    (ly:stencil-add stencil
          (make-cross-stencil (second cps))
          1 0 0)
          (make-cross-stencil (third cps))
          1 0 0)
      (if (eq? line #t)
          (make-line-stencil 0.05 (car (second cps)) (cdr (second cps))
(car (third cps))  (cdr (third cps)))

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

Hi Harm,

thanks for this.
What I had in mind was to draw lines from control-points 1-2 and 3-4 (as in drawing programs). Your solution is equally intuitive, but I have the impression that 'my' lines are generally smaller and therefore less intrusive, especially with longer curves.

See the attached updated file.
In it you can see also:
- it equally works with broken slurs
- the lines are important: Take the control-point 2 of the slur in m. 2. It is already hard to tell if this belongs to the first or the second line - an ambiguity that isn't present in the second version with the lines.

There are two more issues with this:
- I don't see how to get it working with ties. Which would be nice of course
- It would be nice to be able to pass the color as a (optional) list of values. So one could store the main function in a library file and define the appearance in a 'user space' wrapper function (like in the attached file). And it would make it possible to differentiate colors for slurs, phrasingSlurs and Ties.

If we could continue to get a set of working tools (together with David's shapeXXX functions), I'd try hard to find the time to document it in some kind of tutorial (although currently I have to finish the 'real-life' project I need all this for ...)


Attachment: displayControlPoints_ver_II.ily
Description: Text document

reply via email to

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