|
From: | Big Noise |
Subject: | Re: scheme problem: colored background, layers |
Date: | Tue, 02 Dec 2014 00:01:32 +0100 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 |
Hi Pierre,
thanks for taking the time to think about it. Meanwhile, after some sleepless nights ;-) I've found another way to get some results: % ------------------------------------------------------- \version "2.18.0" colorSpan = #(define-music-function (parser location y-lower y-upper color) (number? number? color?) #{ \override Staff.HorizontalBracket #'stencil = $(lambda (grob) (let* ( (area (ly:horizontal-bracket::print grob)) (X-ext (ly:stencil-extent area X)) (Y-ext (ly:stencil-extent area Y)) ) (set! Y-ext (cons y-lower y-upper) ) (ly:grob-set-property! grob 'layer -10) (ly:make-stencil (list 'color color (ly:stencil-expr (ly:round-filled-box X-ext Y-ext 0)) X-ext Y-ext)) ))
#}) { << { R1 \colorSpan #-5 #5 #(rgb-color 1.0 0.9 0.5) c'2\startGroup g' c' \stopGroup \colorSpan #0 #5 #(rgb-color 0.5 1.0 0.5) r4\startGroup r \stopGroup \colorSpan #-5 #0 #(rgb-color 0.9 1.0 0.5) r\startGroup r\stopGroup } \\ { \override Voice.ClusterSpanner.color = #(rgb-color 0.5 0.6 1) \override Voice.ClusterSpanner.layer = #-1 \makeClusters { s1 c'2 g' c' s s1 } } >> } \layout { \context { \Voice \consists "Horizontal_bracket_engraver" \override HorizontalBracket #'thickness = #0 \override HorizontalBracket #'bracket-flare = #'(0 . 0) \override HorizontalBracket #'Y-extent = #'(0 . 0) \override HorizontalBracket #'edge-height = #'(0 . 0) \override HorizontalBracket #'Y-offset = #0 \override HorizontalBracket #'shorten-pair = #'(-1 . -0.75) } } % -------------------------------------------------------Result: http://4.bp.blogspot.com/-THmAQWfqDaw/VHztoaE6N2I/AAAAAAAAACs/9Sqgl4ViMBc/s1600/ly-ex3.gif This time, I "abused" the Horizontal_bracket_engraver that is used for \startGroup and \stopGroup and replaced it's stencil by a rectangle. Because it's not attached to the StaffSymbol, it can be placed in a different layer, so the blue cluster and the staff lines both stay visible. Anyway, LilyPond does the horizontal spacing without the need for manual work. This might make life easier for doing crazy things like this: http://4.bp.blogspot.com/-kEXoxAx6HG0/VHzvH9GW9KI/AAAAAAAAAC8/48vNguVdp2A/s1600/ly-ex4.gif http://4.bp.blogspot.com/-ChtL4-lGKoE/VHzvHuNU76I/AAAAAAAAAC4/Do8L81Al19I/s1600/ly-ex5.gif Cheers, Klaus Blum Am 29.11.2014 um 10:43 schrieb Pierre Perol-Schneider:
|
[Prev in Thread] | Current Thread | [Next in Thread] |