GitXplorerGitXplorer
d

zeno

public
101 stars
9 forks
3 issues

Commits

List of commits on branch main.
Verified
3d5282cdc7ff26009e0f1ea5670e390ca0225f6a

Merge pull request #7 from forkgull/uninit

ddfrg committed 7 months ago
Unverified
fe1acd5cf1f1fd3eeef833c85fbfd2d6c351ebe1

add libm feature, update to 0.3.1

ddfrg committed 8 months ago
Verified
6b2efde22a5d5d7fbbc292093747ea9c0e1cce34

Merge pull request #6 from forkgull/ci

ddfrg committed 9 months ago
Verified
e6e48811184cdba867a06e0b90b217bb60a5b5c3

Use default arrays instead of uninit arrays

nnotgull committed 9 months ago
Verified
a4d64340fcce61f650bf80628e1533382688ef08

Add benchmarks

nnotgull committed 9 months ago
Verified
63604e1cd780314b6dc6be5186bd96f7026e6543

Add GitHub Actions workflow for CI

nnotgull committed 9 months ago

README

The README file for this repository.

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.

Crates.io Docs.rs MIT licensed Apache licensed

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

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:

Dashed Triangle

For detail on additional features and more advanced usage, see the full API documentation.