Skip to main content

render_picture

Function render_picture 

pub fn render_picture(
    scene: &Scene,
    width: u32,
    height: u32,
    bg: AlphaColor<Srgb>,
) -> Result<Vec<u8>, String>
Expand description

What scene draws over bg at width x height, as straight-alpha RGBA8. Drawn on the GPU when a renderer can be built, else on the CPU with tilo-cpu-raster; a browser page, which has no CPU rasterizer, gets an error. Each call builds a fresh renderer: a caller drawing many pictures of one size keeps its own OffscreenRenderer.

§Errors

Returns why neither renderer could draw the picture.

§Panics

Panics if width or height is zero, as OffscreenRenderer::try_new does.