• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

renderer/H03-May-2022-264211

src/H03-May-2022-19921

.cargo-checksum.jsonH A D03-May-202289 11

.gitignoreH A D22-Jul-2019338 5554

.travis.ymlH A D26-Apr-2020801 3631

CHANGELOG.mdH A D22-Jul-20197.6 KiB161140

CONTRIBUTING.mdH A D22-Jul-20194.3 KiB8053

Cargo.tomlH A D26-Apr-20201.4 KiB5244

Cargo.toml.orig-cargoH A D26-Apr-20201.4 KiB6354

LICENSE-APACHEH A D02-May-2019554 1410

LICENSE-MITH A D02-May-20191.1 KiB2116

README.mdH A D12-Feb-20204.5 KiB11987

issue-492-2.pathH A D19-Oct-2019133 1613

issue-492.pathH A D19-Oct-2019274 2322

path-benches.mdH A D01-Sep-20191.1 KiB2717

tmp.rsH A D01-Dec-2019730 3223

README.md

1# Lyon
2A path tessellation library written in rust for GPU-based 2D graphics rendering.
3
4<p align="center">
5<img src="https://nical.github.io/lyon-doc/lyon-logo.svg" alt="Project logo">
6</p>
7
8<p align="center">
9  <a href="https://crates.io/crates/lyon">
10      <img src="http://meritbadge.herokuapp.com/lyon" alt="crates.io">
11  </a>
12  <a href="https://travis-ci.org/nical/lyon">
13      <img src="https://img.shields.io/travis/nical/lyon/master.svg" alt="Travis Build Status">
14  </a>
15  <a href="https://docs.rs/lyon">
16      <img src="https://docs.rs/lyon/badge.svg" alt="documentation">
17  </a>
18
19  <a href="https://gitter.im/lyon-rs/Lobby">
20    <img src="https://img.shields.io/badge/GITTER-join%20chat-green.svg" alt="Gitter Chat">
21  </a>
22
23</p>
24
25# Motivation
26
27For 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.
28
29The intent is for this library to be useful in projects like [Servo](https://servo.org/) and games.
30
31## Example
32
33```rust
34extern crate lyon;
35use lyon::math::{point, Point};
36use lyon::path::Path;
37use lyon::path::builder::*;
38use lyon::tessellation::*;
39fn main() {
40    // Build a Path.
41    let mut builder = Path::builder();
42    builder.move_to(point(0.0, 0.0));
43    builder.line_to(point(1.0, 0.0));
44    builder.quadratic_bezier_to(point(2.0, 0.0), point(2.0, 1.0));
45    builder.cubic_bezier_to(point(1.0, 1.0), point(0.0, 1.0), point(0.0, 0.0));
46    builder.close();
47    let path = builder.build();
48    // Let's use our own custom vertex type instead of the default one.
49    #[derive(Copy, Clone, Debug)]
50    struct MyVertex { position: [f32; 2] };
51    // Will contain the result of the tessellation.
52    let mut geometry: VertexBuffers<MyVertex, u16> = VertexBuffers::new();
53    let mut tessellator = FillTessellator::new();
54    {
55        // Compute the tessellation.
56        tessellator.tessellate_path(
57            &path,
58            &FillOptions::default(),
59            &mut BuffersBuilder::new(&mut geometry, |pos: Point, _: FillAttributes| {
60                MyVertex {
61                    position: pos.to_array(),
62                }
63            }),
64        ).unwrap();
65    }
66    // The tessellated geometry is ready to be uploaded to the GPU.
67    println!(" -- {} vertices {} indices",
68        geometry.vertices.len(),
69        geometry.indices.len()
70    );
71}
72```
73
74## FAQ
75
76### In a nutshell, what is a tessellator?
77
78Tessellators 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.
79
80### How do I render an SVG file with lyon?
81
82Lyon 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.
83
84### How do I render the output of the tessellators?
85
86Although 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](https://docs.rs/lyon_tessellation/latest/lyon_tessellation/#the-output-geometry-builders) for more details.
87
88### Is anti-aliasing supported?
89
90There 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.).
91
92### What is left to do before lyon 1.0?
93
94See the [1.0 milestone](https://github.com/nical/lyon/milestone/2) on the github repository.
95
96### I need help!
97
98Don't hesitate to [file an issue](https://github.com/nical/lyon/issues/new), ask questions on [gitter](https://gitter.im/lyon-rs/Lobby), or contact [@nical](https://github.com/nical) by e-mail.
99
100### How can I help?
101
102See [CONTRIBUTING.md](https://github.com/nical/lyon/blob/master/CONTRIBUTING.md).
103
104## License
105
106Licensed under either of
107
108 * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
109 * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
110 * [Mozilla Public License 2.0](https://www.mozilla.org/en-US/MPL/2.0/)
111
112at your option.
113
114Dual MIT/Apache2 is strictly more permissive
115
116### Contribution
117
118There is useful information for contributors in the [contribution guidelines](https://github.com/nical/lyon/blob/master/CONTRIBUTING.md).
119