Skip to main content

render_image

Function render_image 

Source
pub fn render_image(
    scene: &Scene,
    fonts: &dyn FontProvider,
    assets: &dyn AssetProvider,
) -> Result<RasterImage, RenderError>
Expand description

Rasterize scene to a RasterImage (straight-alpha RGBA8 pixels).

Useful for pixel-level assertions in tests without decoding a PNG.

The fonts parameter is used to resolve font bytes for any zenith_scene::SceneCommand::DrawGlyphRun commands in the scene; the assets parameter resolves raster image bytes for any zenith_scene::SceneCommand::DrawImage commands. Runs/images whose id cannot be resolved are silently skipped.

ยงErrors

Returns RenderError when the scene dimensions are invalid.