lenmus / lomse

A C++ library for rendering, editing and playing back music scores.
MIT License
117 stars 28 forks source link

Fix color inheritance for stems, flags and beams #394

Closed cecilios closed 3 months ago

cecilios commented 3 months ago

This PR implements color inheritance for stems, flags and beams (any source format, LDP, MusicXML,...), and closes #393. It also clarifies the color inheritance criteria for stems, flags and beams when color has not been explicitly specified for them in the source file:

Stems and flags are always rendered in the default color (black) unless the source file specifies a color. When the stem color has not been explicitly specified, the stem and the flag are rendered in the same color as the notehead.

For a chord, when color has not been explicitly defined in the source file for the stem and flag, they are rendered in the same color as all the noteheads, but if the noteheads do not all have the same color, stem and flag are rendered in the default color (black).

For the beam that joins a group of notes or chords, the rule is similar: if the beam color has not been specified in the source file, it will be drawn in the same color as all the stems only if they all have the same color; otherwise, in the default color (black).

The following image is the rendering of the LDP code in test score '00301-color-inheritance-stems-beams.lms':

image