Model cuts as polylines, not horizontal lines

Page 1 of Engel (Bosse/Partitura) has a boxed VERSE 1 label in the left
margin at the same rows as the preceding system's bass lyric line — ink
on both sides of the page throughout the band, so no horizontal line
separates them. The label belongs to system 2, the lyrics to system 1.

A cut is therefore a polyline spanning the page, two points being the
ordinary straight case. A slice bounded by a non-straight cut is not
rectangular: its image is the region's bounding box with everything
outside made transparent, which composites invisibly on the viewer's
sheet. Masking paints transparency, never white.
This commit is contained in:
Esa Kataja
2026-07-28 22:22:03 +03:00
parent 46ae7e813a
commit 01227b3382
2 changed files with 31 additions and 9 deletions
+16 -1
View File
@@ -89,9 +89,24 @@ cuts at the page edges. Modelling a slice as "the region between two cuts" leaks
page 2 has no header, so it would need an invented top cut whose position depends
on whether that page happens to have one.
Cut placement is forgiving — anywhere inside the whitespace gap yields the same
Cut placement is forgiving — anywhere inside the whitespace yields the same
output, because trim crops to ink afterwards.
**A cut is a polyline, not a line.** Two points — a straight horizontal
boundary — is the ordinary case and what detection proposes. Extra vertices exist
because publishers routinely print a section label in the left margin at the same
height as the *previous* system's lyrics. On page 1 of *Engel* (Bosse/Partitura
edition), the boxed `VERSE 1` label and the preceding system's bass lyric line
occupy the same rows: ink is present on both sides of the page throughout that
band, so no horizontal line separates them. `VERSE 1` belongs to system 2, the
lyrics to system 1. The cut has to step — above the label on the left, below the
lyrics on the right.
A slice bounded by a non-straight cut is **not rectangular**. Its image is the
bounding box of the region, with everything outside the region made transparent.
That composites invisibly on the viewer's sheet, so nothing downstream needs to
know. This is also why masking must paint transparency rather than white.
### Content rectangle
The region of a page that holds music, set per PDF and adjustable per page,