mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-26 02:59:17 -06:00
print/compose.rs turns a layout and its photos into PageRasters: 16-bit interleaved RGB encoded in Rec. 2020 at the job's pixel density. Each cell's photo is rendered with the export pipeline at exactly the size the cell needs, then fitted (whole photo, centred) or zoomed to fill (centre crop), turned a quarter clockwise when Rotate to Fit makes it print larger (or crop less), framed by the Photo Border (package styles only) and finished with the Inner Stroke drawn inside the photo edge. The page background, border and stroke colours are given in sRGB and converted to the page encoding. Photos go to cells by layout style: Single Image and Contact Sheet paginate the selection, Picture Package repeats the first photo, Custom Package prints each cell's own photo. The job is prepared on the session and run off it with progress and cancellation, like the contact sheet; page and job pixel counts and page counts are capped so a hostile resolution or paper cannot exhaust memory. print/output.rs holds the interim PDF writer (Rec. 2020 to 8-bit sRGB JPEG pages sized to the paper in points) through the contact sheet's Pdf, now pub(crate). PrintJob carries the print resolution (72 to 720 ppi, 240 default). Tests draw on synthetic images for exact pixels (borders, strokes, crop, rotation direction, resampling) and on the demo library for whole pages.