zeno
Zeno is a pure Rust crate that provides a high performance, low level 2D rasterization library with support for rendering paths of various styles into alpha or subpixel masks.
Features
- 256x anti-aliased rasterization (8-bit alpha or 32-bit RGBA subpixel alpha)
- Pixel perfect hit testing with customizable coverage threshold
- Non-zero and even-odd fills
- Stroking with the standard set of joins and caps (separate start and end caps are possible)
- Numerically stable dashing for smooth dash offset animation
- Vertex traversal for marker placement
- Stepped distance traversal for animation or text-on-path support
- Abstract representation of path data that imposes no policy on storage
Usage
Add this to your Cargo.toml
:
[]
= "0.2.1"
Rendering a dashed stroke of a triangle:
use ;
// Buffer to store the mask
let mut mask = ;
/// Create a mask builder with some path data
new
.style
// Set the target dimensions
.size
// Render into the target buffer
.render_into;
Resulting in the following mask:
For detail on additional features and more advanced usage, see the full API documentation.