Available on crate feature canvas only.
Expand description

Data structures and traits to work with paths (vector graphics).

To build and consume paths, see the builder and iterator modules.

This crate is reexported in lyon.

Examples

use lyon_path::Path;
use lyon_path::math::{point};
use lyon_path::builder::*;

// Create a builder object to build the path.
let mut builder = Path::builder();

// Build a simple path.
let mut builder = Path::builder();
builder.begin(point(0.0, 0.0));
builder.line_to(point(1.0, 2.0));
builder.line_to(point(2.0, 0.0));
builder.line_to(point(1.0, 1.0));
builder.close();

// Generate the actual path object.
let path = builder.build();

for event in &path {
    println!("{:?}", event);
}

Modules

  • Path building utilities.
  • A generic representation for paths that allow more control over how endpoints and control points are stored.
  • Simple 2D geometric primitives on top of euclid.
  • Tools to iterate over paths.
  • f32 version of the lyon_geom types used everywhere. Most other lyon crates reexport them.
  • The default path data structure.
  • A container to store multiple paths contiguously.
  • Specific path types for polygons.
  • lyon_path traits reexported here for convenience.

Structs

Enums

  • Represents an event or edge of path.
  • The fill rule defines how to determine what is inside and what is outside of the shape.
  • Line cap as defined by the SVG specification.
  • Line join as defined by the SVG specification.
  • The positive or negative side of a vector or segment.
  • The two possible orientations for the edges of a shape to be built in.

Constants

Traits

  • Interface for objects storing custom attributes associated with endpoints.
  • Interface for types types (typically endpoints and control points) that have a 2D position.
  • Interface for objects storing endpoints and control points positions.

Type Aliases

  • An alias for usize.
  • An alias for a slice of f32 values.
  • A path event representing endpoints and control points as IDs.
  • A path event representing endpoints and control points as positions.