Skip to main content

render_spread_png

Function render_spread_png 

Source
pub fn render_spread_png(
    left: &Scene,
    right: &Scene,
    gutter_px: u32,
    fonts: &dyn FontProvider,
    assets: &dyn AssetProvider,
) -> Result<Vec<u8>, RenderError>
Expand description

Rasterize two scenes (left, right), composite them SIDE BY SIDE via composite_spread, and encode the result as deterministic PNG bytes.

left is blitted at x = 0 and right at x = left.width + gutter_px. gutter_px transparent columns are inserted between the two pages. When gutter_px = 0 the output is byte-identical to the pre-gutter behavior. The shared fonts/assets providers resolve glyph runs and images for both scenes.

§Errors

Returns RenderError when either scene’s dimensions are invalid, the combined width overflows, or PNG encoding fails.