lyon_tessellation

2D graphics rendering on the GPU in rust using path tessellation.

Latest version: 1.0.15 registry icon
Maintenance score
100
Safety score
100
Popularity score
75
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High Critical
1.0.15 0 0 0 0 0
1.0.14 0 0 0 0 0
1.0.13 0 0 0 0 0
1.0.12 0 0 0 0 0
1.0.11 0 0 0 0 0
1.0.10 0 0 0 0 0
1.0.9 0 0 0 0 0
1.0.8 0 0 0 0 0
1.0.7 0 0 0 0 0
1.0.6 0 0 0 0 0
1.0.5 0 0 0 0 0
1.0.4 0 0 0 0 0
1.0.3 0 0 0 0 0
1.0.2 0 0 0 0 0
1.0.1 0 0 0 0 0
1.0.0 0 0 0 0 0
0.17.10 0 0 0 0 0
0.17.9 0 0 0 0 0
0.17.8 0 0 0 0 0
0.17.7 0 0 0 0 0
0.17.6 0 0 0 0 0
0.17.5 0 0 0 0 0
0.17.4 0 0 0 0 0
0.17.3 0 0 0 0 0
0.17.2 0 0 0 0 0
0.17.1 0 0 0 0 0
0.17.0 0 0 0 0 0
0.16.2 0 0 0 0 0
0.16.1 0 0 0 0 0
0.16.0 0 0 0 0 0
0.15.9 0 0 0 0 0
0.15.8 0 0 0 0 0
0.15.7 0 0 0 0 0
0.15.6 0 0 0 0 0
0.15.5 0 0 0 0 0
0.15.4 0 0 0 0 0
0.15.3 0 0 0 0 0
0.15.2 0 0 0 0 0
0.15.1 0 0 0 0 0
0.15.0 0 0 0 0 0
0.14.2 0 0 0 0 0
0.14.1 0 0 0 0 0
0.14.0 0 0 0 0 0
0.13.5 0 0 0 0 0
0.13.3 0 0 0 0 0
0.13.2 0 0 0 0 0
0.13.1 0 0 0 0 0
0.13.0 0 0 0 0 0
0.11.0 0 0 0 0 0
0.10.2 0 0 0 0 0
0.10.1 0 0 0 0 0
0.10.0 0 0 0 0 0
0.9.1 0 0 0 0 0
0.9.0 0 0 0 0 0
0.8.8 0 0 0 0 0
0.8.7 0 0 0 0 0
0.8.6 0 0 0 0 0
0.8.5 0 0 0 0 0
0.8.4 0 0 0 0 0
0.8.3 0 0 0 0 0
0.8.2 0 0 0 0 0
0.8.1 0 0 0 0 0
0.8.0 0 0 0 0 0
0.7.4 0 0 0 0 0
0.7.3 0 0 0 0 0
0.7.2 0 0 0 0 0
0.7.1 0 0 0 0 0
0.7.0 0 0 0 0 0
0.6.2 0 0 0 0 0
0.6.1 0 0 0 0 0
0.6.0 0 0 0 0 0
0.5.0 0 0 0 0 0
0.4.1 0 0 0 0 0
0.4.0 0 0 0 0 0
0.3.2 0 0 0 0 0
0.3.1 0 0 0 0 0
0.3.0 0 0 0 0 0
0.2.0 0 0 0 0 0
0.1.1 0 0 0 0 0

Stability
Latest release:

1.0.15 - This version is safe to use because it has no known security vulnerabilities at this time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

Apache-2.0   -   Apache License 2.0

Not a wildcard

Not proprietary

OSI Compliant


MIT   -   MIT License

Not a wildcard

Not proprietary

OSI Compliant



Lyon

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

Project logo

crates.io Build Status documentation Gitter Chat

Motivation

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.

Example

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));
    builder.end(true);
    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.
        tessellator.tessellate_path(
            &path,
            &FillOptions::default(),
            &mut BuffersBuilder::new(&mut geometry, |vertex: FillVertex| {
                MyVertex {
                    position: vertex.position().to_array(),
                }
            }),
        ).unwrap();
    }
    // The tessellated geometry is ready to be uploaded to the GPU.
    println!(" -- {} vertices {} indices",
        geometry.vertices.len(),
        geometry.indices.len()
    );
}

FAQ

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?

See CONTRIBUTING.md.

License

Licensed under either of

at your option.

Dual MIT/Apache2 is strictly more permissive

Contribution

There is useful information for contributors in the contribution guidelines.