uzor-export 1.5.0

Headless render-to-file for uzor — render draw code into a PNG at a chosen resolution, no window/GPU dependency.
docs.rs failed to build uzor-export-1.5.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

uzor-export — headless render-to-file for the uzor render stack.

Renders arbitrary uzor draw code into a PNG at a chosen pixel resolution with no window and no GPU dependency: the CPU backend (uzor-render-tiny-skia) rasterizes into an in-memory pixmap, which is then PNG-encoded and returned as bytes or written to disk.

This is the first brick of the uzor data-viz / document engine space (see nemo/docs/uzor-engines/uzor_engine_space_map.md): headless export is how uzor content becomes a report/document delivery artifact, and how a CI job can verify rendering output pixel-for-pixel without a display or GPU (Tier-2 verification tool).

[render_to_svg]/[render_to_svg_file] are the SVG sibling of [render_to_png]/[render_to_png_file] — same ExportSpec contract (background rect painted first, dpr surfaced via ctx.dpr()), but serializing through uzor-render-svg::SvgRenderContext into a standalone, portable SVG document string instead of rasterizing into a tiny-skia pixmap. See nemo/docs/uzor-engines/research_export_sota_2026.md §6 for the SVG backend's own design rationale (outlined text, transform-baked coordinates, base64-embedded raster images).

Example

use uzor_export::{render_to_png, ExportSpec};

let spec = ExportSpec {
    width_px: 200,
    height_px: 100,
    dpr: 1.0,
    background: Some([255, 255, 255, 255]),
};
let png_bytes = render_to_png(&spec, |ctx| {
    ctx.set_fill_color("#ff0000");
    ctx.fill_rect(10.0, 10.0, 50.0, 50.0);
})
.expect("render");
assert!(png_bytes.starts_with(&[0x89, b'P', b'N', b'G']));