> On Apr 28, 2015, at 11:57 AM, Kieren MacMillan > <kieren_macmil...@sympatico.ca> 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
stencil-whiteout-outline.ly
Description: Binary data
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user