Skip to main content

stet_render/
lib.rs

1// stet - A PostScript Interpreter
2// Copyright (c) 2026 Scott Bowman
3// SPDX-License-Identifier: Apache-2.0 OR MIT
4
5//! `stet-tiny-skia`-based rasterizer for stet display lists.
6//!
7//! This crate rasterizes any
8//! [`DisplayList`](stet_graphics::display_list::DisplayList) to RGBA pixels
9//! — whether the list came from the PostScript interpreter
10//! ([`stet-core`](https://crates.io/crates/stet-core)) or the PDF reader
11//! ([`stet-pdf-reader`](https://crates.io/crates/stet-pdf-reader)) makes
12//! no difference. Rendering is multi-threaded and banded (sized to fit
13//! L2), with mask caching, clip fast paths, and ICC-aware CMYK handling.
14//!
15//! # Two ways to render
16//!
17//! - [`render_to_rgba`] — one-shot: a `DisplayList` in, a `Vec<u8>` of
18//!   RGBA out. Banded page rasterizer with automatic parallelism.
19//! - [`prepare_display_list`] + [`render_region_prepared`] — viewport
20//!   rendering: pre-compute bounding boxes once, then render any
21//!   rectangular region at any zoom without reinterpreting or
22//!   reallocating. Used by the interactive viewer and the WASM frontend.
23//!
24//! # Sinks
25//!
26//! [`PngSinkFactory`] streams banded output straight to a PNG file.
27//! Implement [`stet_graphics::device::PageSink`] /
28//! [`PageSinkFactory`](stet_graphics::device::PageSinkFactory) yourself
29//! for other streaming destinations.
30//!
31//! Most users should use the [`stet`](https://crates.io/crates/stet)
32//! facade crate rather than depending on `stet-render` directly.
33
34mod png_sink;
35mod skia_device;
36
37pub use png_sink::PngSinkFactory;
38pub use skia_device::ImageCache;
39pub use skia_device::PreparedDisplayList;
40pub use skia_device::SkiaDevice;
41pub use skia_device::build_icc_cache_for_list;
42pub use skia_device::debug_bbox_comparison;
43pub use skia_device::prepare_display_list;
44pub use skia_device::render_region;
45pub use skia_device::render_region_prepared;
46pub use skia_device::render_region_prepared_parallel;
47pub use skia_device::render_region_prepared_parallel_cancellable;
48pub use skia_device::render_region_prepared_parallel_with_progress;
49pub use skia_device::render_region_single_band;
50pub use skia_device::render_to_rgba;
51pub use skia_device::render_to_rgba_viewport;
52pub use skia_device::render_to_rgba_with_layers;
53pub use skia_device::viewport_band_count;