Skip to main content

Crate stet_render

Crate stet_render 

Source
Expand description

stet-tiny-skia-based rasterizer for stet display lists.

This crate rasterizes any DisplayList to RGBA pixels — whether the list came from the PostScript interpreter (stet-core) or the PDF reader (stet-pdf-reader) makes no difference. Rendering is multi-threaded and banded (sized to fit L2), with mask caching, clip fast paths, and ICC-aware CMYK handling.

§Two ways to render

  • render_to_rgba — one-shot: a DisplayList in, a Vec<u8> of RGBA out. Banded page rasterizer with automatic parallelism.
  • prepare_display_list + render_region_prepared — viewport rendering: pre-compute bounding boxes once, then render any rectangular region at any zoom without reinterpreting or reallocating. Used by the interactive viewer and the WASM frontend.

§Sinks

PngSinkFactory streams banded output straight to a PNG file. Implement stet_graphics::device::PageSink / PageSinkFactory yourself for other streaming destinations.

Most users should use the stet facade crate rather than depending on stet-render directly.

Structs§

ImageCache
Pre-converted RGBA image data cache, indexed by display list element index.
PngSinkFactory
Factory that creates PngSink instances for each page.
PreparedDisplayList
Pre-computed metadata for fast viewport rendering.
SkiaDevice
tiny-skia based raster device.

Functions§

build_icc_cache_for_list
Pre-downsample an image when the transform indicates significant downscaling.
debug_bbox_comparison
prepare_display_list
Precompute display list metadata for fast viewport rendering.
render_region
Render a rectangular viewport region of a display list to RGBA pixels.
render_region_prepared
Render a rectangular viewport region using precomputed metadata.
render_region_prepared_parallel
Render a viewport region using parallel banded rendering via rayon.
render_region_prepared_parallel_cancellable
Like render_region_prepared_parallel() but checks a cancellation flag between band chunks. Returns None if cancelled.
render_region_prepared_parallel_with_progress
Like render_region_prepared_parallel() but with an atomic progress counter.
render_region_single_band
Render a single horizontal band of a viewport region.
render_to_rgba
Render a full-page display list to RGBA pixels using the banded parallel renderer.
render_to_rgba_viewport
Render a display list to RGBA using the viewport code path, with the viewport set to the full page at 1:1 scale.
render_to_rgba_with_layers
Like render_to_rgba but consults the supplied LayerSet when evaluating each OcgGroup’s visibility.
viewport_band_count
Compute the number of bands and band height for viewport banding.