Crate lyon_tessellation [] [src]

Lyon tessellation

This crate implements tools to compute the tessellation of 2d paths fill and stroke operations, in order to render them efficiently on the GPU.

Overview

The most interesting modules of this crate are:

  • path_fill - Implementing the tessellation of complex path fill operations.
  • path_storke - Implementing the tessellation of complex path stroke operations.
  • geometry_builder - Which the above two are built on. It provides traits to facilitate generating arbitrary vertex and index buffers.

The input: iterators

The path tessellators are not tied to a particular data structure. Instead they consume iterators of path events. A Path struct in the crate lyon_path is provided for convenience (but is not mandatory).

The fill tessellator builds a FillEvents object from the iterator. It is an intermediate representation which can be cached if the path needs to be tessellated again.

The output: geometry builders

The tessellators are parametrized over a type implementing the BezierGeometryBuilder trait. This trait provides some simple methods to add vertices and triangles, without enforcing any particular representation for the resulting geometry. This is important because each application has its own internal representation for the vertex and index buffers sent to the GPU, and the tessellator needs to be able to write directly into these buffers without enforcing a particular vertex layout.

Each application will implement the BezierGeometryBuilder<Point> trait in order to generate vertex buffers and index buffers any type of vertex they want taking a 2d Point as input for each vertex. The structs VertexBuffers and geometry_buider::BuffersBuilder are provided for convenience.

Examples

See the examples in the path_fill and path_stroke modules documentation.

Reexports

pub use core::*;

Modules

basic_shapes

Tessellation routines for simple shapes.

geometry_builder
path_fill
path_stroke