Skip to main content

laminapdf_render/
lib.rs

1//! The render backend contract ([ADR 0004]): every Lamina PDF surface renders pages through
2//! [`RenderBackend`] and [`RenderDocument`], which draw bounded tiles of a page at a scale into
3//! a caller-supplied straight-alpha RGBA8 buffer.
4//!
5//! - Requests are validated once, by [`TilePlan::new`], so every backend agrees on sizes and
6//!   refuses oversized tiles (`render-too-large`) before allocating.
7//! - The pure-Rust adapter, [`HayroBackend`], is behind the `hayro` feature: ADR 0004's CI
8//!   oracle and debug choice. The PDFium adapter is the edge crate `laminapdf-render-pdfium`.
9//! - Errors follow the ADR 0026 contract ([`RenderError`]).
10//!
11//! [ADR 0004]: https://github.com/laudebugs/laminapdf/blob/main/docs/decisions/0004-render-backend.md
12#![forbid(unsafe_code)]
13
14mod appearance;
15mod backend;
16mod error;
17#[cfg(feature = "export")]
18mod export;
19#[cfg(feature = "hayro")]
20mod hayro;
21mod request;
22mod source;
23#[cfg(feature = "tiff")]
24mod tiff_writer;
25
26pub use appearance::{Annotated, DARK, Kept, PageAppearance, PagePalette, Quad, SEPIA, mostly_changed, recolour_tile};
27pub use backend::{RenderBackend, RenderDocument};
28pub use error::RenderError;
29#[cfg(feature = "export")]
30pub use export::{ExportFormat, ExportOptions, export_pages};
31#[cfg(feature = "hayro")]
32pub use hayro::HayroBackend;
33pub use laminapdf_cos::{ByteSource, SourceError, merge_ranges};
34pub use laminapdf_model::Matrix;
35pub use laminapdf_syntax::{CancelToken, Rotation};
36pub use request::{
37    BYTES_PER_PIXEL, PixelRect, RenderFlags, RenderLimits, RenderOpenOptions, RenderPage, RenderRequest, Rgba8,
38    TilePlan,
39};
40pub use source::read_all;
41#[cfg(feature = "tiff")]
42pub use tiff_writer::TiffWriter;