2D graphics rendering on the GPU in rust using path tessellation.
Failed to load latest commit information.
algorithms Provide normals in the ray casting result. Aug 19, 2018
assets Add a sample path to use with the cli app. Oct 28, 2017
bench Switch VertexId representation from u16 to u32. Jun 24, 2018
cli Add a rudimentary debugging tool for 2D data. Jul 26, 2018
examples Fix uniform buffer layout for gfx examples Oct 3, 2018
extra lyon_path version 0.12. Jul 27, 2018
geom Handle cubic bézier intersections where one curve is a subcurve of th… Nov 9, 2018
path Improve the documentation a bit. Aug 5, 2018
src Add a simple wasm32-unknown-unknown test. Aug 5, 2018
svg Improve the documentation a bit. Aug 5, 2018
tess2 Use the dyn trait syntax. Jul 10, 2018
tessellation Improve the documentation a bit. Aug 5, 2018
wasm_test Add a simple wasm32-unknown-unknown test. Aug 5, 2018
.gitignore Add Cargo.lock to the repository. Nov 5, 2017
.gitmodules Massive amount of stuff Sep 5, 2014
.travis.yml Add the wasm test to the CI. Aug 5, 2018
CHANGELOG.md Version 0.11.0. Jul 4, 2018
CONTRIBUTING.md Update the license terms to allow MPL2 in the future. Nov 29, 2017
Cargo.lock Update Cargo.lock for the recent lyon_geom version bump. Oct 19, 2018
Cargo.toml Add a simple wasm32-unknown-unknown test. Aug 5, 2018
LICENSE-APACHE Moved the license to MIT/Apache-2.0 Feb 25, 2016
LICENSE-MIT Moved the license to MIT/Apache-2.0 Feb 25, 2016
README.md Switch VertexId representation from u16 to u32. Jun 24, 2018
all.sh Rename lyon_bezier into lyon_geom and cleanup the dependency graph. Nov 25, 2017



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

Project logo

crates.io Travis 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::default::Path;
use lyon::path::builder::*;
use lyon::tessellation::*;

fn main() {
    // Build a Path.
    let mut builder = Path::builder();
    builder.move_to(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], normal: [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(),
                    normal: vertex.normal.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 documentaton for more details.

Is anti-aliasing supported?

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

What is left to do before lyon 1.0?

See the 1.0 milestone on the github repository.

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.