pdf2_render/lib.rs
1//! A rasteriser for the `pdf2` crate: paths, clips, transforms, dashes and the
2//! beginnings of a content-stream interpreter.
3//!
4//! The walker reuses `pdf2`'s tokenizer and document model — there is no second
5//! PDF parser here. What it can draw today:
6//!
7//! - path construction (`m`, `l`, `c`, `v`, `y`, `h`, `re`) in user space, with
8//! the CTM applied at flattening time;
9//! - fills with the non-zero (`f`, `F`, `B`) and even-odd (`f*`, `B*`) rules;
10//! - strokes with butt, round and square caps, round joins, and dash patterns
11//! (`d`) with a phase;
12//! - clipping (`W`, `W*`) as a per-pixel mask that nested `q`/`Q` restores;
13//! - colour operators `g`/`G`, `rg`/`RG` and the naive `k`/`K` conversion.
14//!
15//! Not yet drawn, and reported per page in [`Report::unsupported`] instead of
16//! failing: text and images. Rendering is deliberately without anti-aliasing
17//! for now: coverage is decided at pixel centres, which keeps the golden images
18//! exact and the scanline code small.
19
20mod canvas;
21mod font;
22mod geom;
23mod image;
24mod path;
25mod png;
26mod raster;
27mod walk;
28
29pub use canvas::{Canvas, ClipMask, Color};
30pub use font::{Font, Glyph};
31pub use geom::{Matrix, Point};
32pub use image::Image;
33pub use path::{Cap, Dash, Join, Path, Segment, Subpath};
34pub use pdf2::{Error, Rect, Result};
35pub use png::encode_png;
36pub use raster::{clip_mask, fill_polygons};
37pub use walk::{render_page, render_page_number, RenderOptions, RenderedPage, Report};