mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-14 06:22:24 +00:00
* prepress: separate a page in bands, past the 4 MP plate cap `plates_in_bands` finds a page's inks once, then separates it in row bands of at most MAX_PLATE_PIXELS each, rendering every band through craft-pdf raster's size/offset viewport. A page can now be separated at print resolution with bounded memory: only the renderer's 8192-pixel side limit and a 256 MP per-plate total (MAX_BANDED_PIXELS) lower the resolution. `plates` is unchanged in behaviour: it is the one-band case of the same code. Tests: bands of 7 rows join byte for byte into the whole-page render of an anti-aliased disc under an overprinting spot (fails when the band offset is dropped), and a 40 pt page at 3700 dpi separates at full resolution in bands under the cap (fails when banding uses the plate cap's scale). Refs #838. * prepress: bands pass the renderer's whole-page limits The page's pixel size came from `raster::dimensions` on the whole page, which enforces the renderer's 64 MP and 8192-pixel side limits, so a Letter page past about 830 dpi failed with OutputLimit instead of banding. The size is now computed as the renderer floors it, and only each band's viewport reaches the renderer. Bands are also capped at MAX_SIDE rows, and ink discovery renders within the renderer's limits. A Letter page at 900 dpi now separates in 19 bands at full resolution; across the page the side limit still lowers it, near 960 dpi. Test: a 10 x 2000 pt strip at 600 dpi (16 666 rows) separates in three bands with its black square on the right rows. It fails with either the whole-page dimensions call or the uncapped band height restored. * prepress: check the page before discovery; say what the banded cap bounds The page-size check now runs before ink discovery renders anything. MAX_BANDED_PIXELS bounds pixels, not the number of bands; the doc comment and the README caps table say so. * prepress: count a sub-pixel side as one pixel in the banded cap A side scaled under one pixel still renders one, so a very thin, tall page could pass MAX_BANDED_PIXELS by far. banded_scale now fits the other side alone in that case, and separate() refuses any floored size over the cap before it renders a band. * prepress: keep the banded area scale under the cap after rounding The area scale came from the exact cap, so f32 rounding could floor a page one row past it (17 x 15 058 824 pt at 72 dpi), which then failed with OutputLimit. The same 0.1% margin as the one-pixel branches now applies to the area scale too, with a test on that page. --------- Co-authored-by: KenM76 <KenM76>