lilypond-user
[Top][All Lists]
Advanced

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

New "make-path-stencil" function


From: Paul Morris
Subject: New "make-path-stencil" function
Date: Mon, 28 Oct 2013 21:26:08 -0400

Hi all,  

While working on a snippet for the "make-connected-path-stencil" function[1] I 
got to thinking about whether it would be possible to write a function that 
would have all of its benefits but none of its limitations.  A function that 
would combine the benefits of make-connected-path-stencil:

- automatically calculate the stencil extents so you don't have to do this 
manually.

- allow scaling of the stencil.


And the benefits of using "ly:make-stencil" with a "path" expression[2]:

- allow use of all path commands, both relative and absolute, not just lineto 
and curveto.  (i.e. lineto rlineto curveto rcurveto moveto rmoveto closepath)

- allow "unconnected" paths with multiple segments. (i.e. allow (r)moveto in 
the middle of the path expression)

- allow use of different "cap" and "join" styles, not just round.  


By drawing on the "make-connected-path-stencil" code and the "path" code itself 
from "output-svg.scm" I've been able to work up a function that can do all of 
the above, a flexible tool that can handle any "path stencil" job.  See the 
attached file.  

Eventually I could see a version of this making its way into LilyPond (either 
alongside or as a replacement of "make-connected-path-stencil").  In the 
meantime I can put it in the LSR and/or add it to the OpenLilyLib snippet 
collection (although it's kind of long with the helper functions).

If anyone has suggestions for ways to improve the code, I'd be happy to hear 
them.  I'm still learning my way around (often laboriously) with scheme!

Cheers,
-Paul

Here are snippets demonstrating each of the current ways to make a path stencil:
[1] http://lsr.dsi.unimi.it/LSR/Item?id=891
[2] http://lsr.dsi.unimi.it/LSR/Item?id=623


Attachment: make-path-stencil-function.ly
Description: Binary data


reply via email to

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