lilypond-user
[Top][All Lists]
Advanced

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

Re: a proper whiteout function


From: Paul Morris
Subject: Re: a proper whiteout function
Date: Sun, 17 May 2015 19:18:35 -0400

> On Apr 28, 2015, at 11:57 AM, Kieren MacMillan <address@hidden> wrote:
> 
> What would be involved in making a real stencil whiteout function which could 
> be applicable to all grobs?

Hi all,  I took Kieren up on his offer to sponsor a better whiteout stencil 
function.  It’s attached so that anyone can make use of it.

> 1. follow exactly the grob/glyph outline (i.e., not just a rectangle/box, as 
> currently implemented);

It produces a very close approximation of the stencil outline — not strictly 
exact but close enough that you probably won’t notice.  

> 2. include a parameter to set the thickness of the outline; and

You can set the thickness of the outline.

> 3. include a parameter to determine whether the whiteout was filled 
> throughout, or allowed “holes” inside (as per the grob/glyph outline).

It doesn’t offer this option.

I believe it should work with any glyph/stencil.  In the attached file there's 
one function that just deals with stencils and another that deals with grobs 
(overriding their stencil property).  

The function takes a “brute-force” approach and creates the white background by 
super-imposing/combining a bunch of white copies of the stencil behind it.  
Each copy is systematically offset to make a smooth outline and to fill in any 
gaps due to “holes” in the stencil.  Of course a more elegant approach would be 
to trace the outline of the stencil, but that’s beyond my skills, and the 
results of this function are much better than the current 'white square' option.

If you’re interested in the implementation you can see how it works by playing 
with lower values for “density” and higher for “in-fill-density” particularly 
with a larger outline offset.  These are two properties that can be used to 
“tune" the function, to find a good trade-off between efficiency and quality.  
I think I found pretty good default values for them.  

Cheers,
-Paul



PNG image


Attachment: stencil-whiteout-outline.ly
Description: Binary data




reply via email to

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