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 function;
23mod geom;
24mod image;
25mod path;
26mod pattern;
27mod png;
28mod raster;
29mod shading;
30mod type1;
31mod walk;
32
33pub use canvas::{Canvas, ClipMask, Color};
34pub use font::{Font, Glyph};
35pub use geom::{Matrix, Point};
36pub use image::Image;
37pub use path::{Cap, Dash, Join, Path, Segment, Subpath};
38pub use pdf2::{Error, Rect, Result};
39pub use png::encode_png;
40pub use raster::{clip_mask, fill_polygons};
41pub use walk::{RenderOptions, RenderedPage, Report, render_page, render_page_number};