Crates.io | zeno |
lib.rs | zeno |
version | 0.3.3 |
created_at | 2020-10-06 08:28:38.648567+00 |
updated_at | 2025-05-08 14:16:57.71521+00 |
description | High performance, low level 2D path rasterization. |
homepage | https://github.com/dfrg/zeno |
repository | https://github.com/dfrg/zeno |
max_upload_size | |
id | 296562 |
size | 224,602 |
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.
Rendering a dashed stroke of a triangle:
use zeno::{Cap, Join, Mask, PathData, Stroke};
// Buffer to store the mask
let mut mask = [0u8; 64 * 64];
/// Create a mask builder with some path data
Mask::new("M 8,56 32,8 56,56 Z")
.style(
// Stroke style with a width of 4
Stroke::new(4.0)
// Round line joins
.join(Join::Round)
// And round line caps
.cap(Cap::Round)
// Dash pattern followed by a dash offset
.dash(&[10.0, 12.0, 0.0], 0.0),
)
// Set the target dimensions
.size(64, 64)
// Render into the target buffer
.render_into(&mut mask, None);
Resulting in the following mask:
For detail on additional features and more advanced usage, see the full API documentation.
Licensed under either of
at your option.
Contributions are welcome by pull request. The Rust code of conduct applies.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.