21 releases

0.3.5 May 23, 2022
0.3.3 Feb 21, 2022
0.2.8 Sep 30, 2021
0.2.2 Jun 28, 2021
0.1.0 Sep 28, 2020

#33 in Graphics APIs

Download history 665/week @ 2022-06-09 600/week @ 2022-06-16 725/week @ 2022-06-23 826/week @ 2022-06-30 749/week @ 2022-07-07 766/week @ 2022-07-14 719/week @ 2022-07-21 599/week @ 2022-07-28 747/week @ 2022-08-04 785/week @ 2022-08-11 616/week @ 2022-08-18 833/week @ 2022-08-25 1914/week @ 2022-09-01 3420/week @ 2022-09-08 2628/week @ 2022-09-15 575/week @ 2022-09-22

8,579 downloads per month
Used in 23 crates (12 directly)

MIT/Apache

290KB
6.5K SLoC

Crates.io API dependency status rust: 1.54 Discord

femtovg

Join the femtovg Discord channel

Work in progress!

Antialiased 2D vector drawing library written in Rust. Ported from https://github.com/memononen/nanovg

Most of the implementation is the same as the original C code with some bug fixes, some features added and several parts have been made more Rust-y. Rendering is done via one OpenGl (ES) 3.0+ backend.

Screenshots

Demo

demo Run with cargo run --example demo

Breakout

breakout Run with cargo run --example breakout

SVG

svg Run with cargo run --example svg

Text

text Run with cargo run --example text

Features

  • Anti-aliasing
  • Bézier paths filling and stroking
  • Solid color and image pattern fills and strokes
  • Gradients - box, linear and radial
  • Stroke width and miterlimit
  • Stroke caps: butt, round and square
  • Stroke joins: miter, round and bevel
  • Fill rules - EvenOdd/NonZero
  • Rectangle scissoring
  • Composition modes (SourceOver, SourceIn, SourceOut, Atop, etc..)
  • Global alpha
  • Text filling and stroking
  • Text shaping
  • Text alignment: (left center right), (top, middle, alphabetic, bottom)
  • Nearest font matching
  • Path hit testing
  • OpenGl ES2 backend

In progress

Not supported

  • Stroke dashing
  • Path scissoring
  • Custom shaders
  • 3D transforms
  • Color fonts

License

Licensed under either of

Fonts used in examples:

Dependencies

~4–8.5MB
~169K SLoC