14 releases (8 breaking)

Uses old Rust 2015

0.8.0 Sep 27, 2017
0.7.0 Jul 31, 2017
0.6.0 Jul 4, 2017
0.4.0 Feb 28, 2017
0.1.1 Jul 14, 2016

#6 in #lyon

Download history 23/week @ 2024-01-01 87/week @ 2024-01-08 69/week @ 2024-01-15 65/week @ 2024-01-22 26/week @ 2024-01-29 55/week @ 2024-02-05 73/week @ 2024-02-12 77/week @ 2024-02-19 110/week @ 2024-02-26 108/week @ 2024-03-04 124/week @ 2024-03-11 115/week @ 2024-03-18 75/week @ 2024-03-25 142/week @ 2024-04-01 85/week @ 2024-04-08 116/week @ 2024-04-15

433 downloads per month
Used in 2 crates (via lyon_tesselation)


672 lines


A path tessellation library written in rust for GPU-based 2D graphics rendering.

Project logo

crates.io Build Status documentation Gitter Chat


For now the goal is to provide efficient SVG-compliant path tessellation tools to help with rendering vector graphics on the GPU. For now think of this library as a way to turn complex paths into triangles for use in your own rendering engine.

The intent is for this library to be useful in projects like Servo and games.


extern crate lyon;
use lyon::math::point;
use lyon::path::Path;
use lyon::tessellation::*;
fn main() {
    // Build a Path.
    let mut builder = Path::builder();
    builder.begin(point(0.0, 0.0));
    builder.line_to(point(1.0, 0.0));
    builder.quadratic_bezier_to(point(2.0, 0.0), point(2.0, 1.0));
    builder.cubic_bezier_to(point(1.0, 1.0), point(0.0, 1.0), point(0.0, 0.0));
    let path = builder.build();
    // Let's use our own custom vertex type instead of the default one.
    #[derive(Copy, Clone, Debug)]
    struct MyVertex { position: [f32; 2] }
    // Will contain the result of the tessellation.
    let mut geometry: VertexBuffers<MyVertex, u16> = VertexBuffers::new();
    let mut tessellator = FillTessellator::new();
        // Compute the tessellation.
            &mut BuffersBuilder::new(&mut geometry, |vertex: FillVertex| {
                MyVertex {
                    position: vertex.position().to_array(),
    // The tessellated geometry is ready to be uploaded to the GPU.
    println!(" -- {} vertices {} indices",


In a nutshell, what is a tessellator?

Tessellators such as the ones provided by lyon take complex shapes as input and generate geometry made of triangles that can be easily consumed by graphics APIs such as OpenGL, Vulkan or D3D.

How do I render an SVG file with lyon?

Lyon is not an SVG renderer. For now lyon mainly provides primitives to tessellate complex path fills and strokes in a way that is convenient to use with GPU APIs such as gfx-rs, glium, OpenGL, D3D, etc. How the tessellated geometry is rendered is completely up to the user of this crate.

How do I render the output of the tessellators?

Although the format of the output of the tessellators is customizable, the algorithms are designed to generate a vertex and an index buffer. See the lyon::tessellation documentation for more details.

Is anti-aliasing supported?

There is currently no built-in support for antialiasing in the tessellators. Antialiasing can still be achieved by users of this crate using techniques commonly employed in video games (msaa, taa, fxaa, etc.).

I need help!

Don't hesitate to file an issue, ask questions on gitter, or contact @nical by e-mail.

How can I help?



Licensed under either of

at your option.

Dual MIT/Apache2 is strictly more permissive


There is useful information for contributors in the contribution guidelines.


~27K SLoC