lilypond-user
[Top][All Lists]
Advanced

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

Re: scheme problem: colored background, layers


From: Pierre Perol-Schneider
Subject: Re: scheme problem: colored background, layers
Date: Sat, 29 Nov 2014 10:05:08 +0100

Hi,

2014-11-29 1:15 GMT+01:00 Big Noise <address@hidden>:
 
Here is my problem:
Now the staff lines and the yellow rectangle are located in the same layer, so it's not possible to place the blue cluster between them.
Is there a way to make the scheme function put the staff lines ("StaffSymbol") and the yellow rectangle into different layers?


How about changing the layer value from -10 to -2 ?

bgColor =
#(define-music-function (parser location y-lower y-upper color) (number? number? string?)
   #{
     \stopStaff
     \override Staff.StaffSymbol.stencil =
     $(lambda (grob)
        (let* ((staff (ly:staff-symbol::print grob))
               (X-ext (ly:stencil-extent staff X))
               (Y-ext (ly:stencil-extent staff Y)))
          (set! Y-ext (cons
                       (- (car Y-ext) y-lower)
                       (+ (cdr Y-ext) y-upper)))
          ;; change layer's value to -2
          (ly:grob-set-property! grob 'layer -2)
          (ly:stencil-add
           (ly:make-stencil (list 'color (eval-string color)
                              (ly:stencil-expr (ly:round-filled-box X-ext Y-ext 0))
                              X-ext Y-ext))
           staff)))
     \startStaff
   #})


HTH
Pierre

reply via email to

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