Skip to main content

Crate blockworx_export

Crate blockworx_export 

Source
Expand description

What the app writes out: the diagram as a picture, and the whole thing as a navigable PDF.

The image formats capture one level as the editor renders it — the same render path, pointed at svg::SvgRenderer instead of at a screen — so an export cannot drift from what the user was looking at. PDF is the whole document, one page per scope, with the navigation hierarchy as its outline (pdf).

A picture carries no embedded diagram for import to recover: the document travels as its container, not steganography.

Text layout is the one thing here that needs a host: an exporter borrows the toolkit’s own engine through blockworx_paint::TextLayout, because a diagram exported with different line breaks than the canvas showed is a wrong export.

Modules§

level
One level of the document, rendered to SVG — the entry both the SVG/PNG export and the PDF’s per-scope pages draw through, so a page and a saved picture cannot disagree about what the level looks like.
pdf
The whole document as a PDF: one page per scope, the navigation hierarchy as the PDF outline, and a link annotation over every block that opens a scope — so the diagram navigates inside any ordinary PDF reader, and review rides that reader’s own annotation tools rather than anything the app ships.
svg
SVG export backend.

Enums§

ExportContent
What an export rendered, captured on the UI thread. The variant carries what its format is written from, so a format can never be paired with content of the wrong kind: PNG holds the SVG source it rasterizes from on save, and PDF is already serialized because it needs the whole document.

Functions§

bytes_for
The bytes to write for content: the SVG or PDF source verbatim, or — for PNG — rasterized. A failed rasterization falls back to nothing so the export produces an empty file rather than crashing the worker.
render_png 🔒
Rasterize the captured SVG to PNG bytes, upscaled for a crisp image.