10 releases

0.2.5 Sep 7, 2021
0.2.4 Sep 3, 2021
0.2.2 Jun 28, 2021
0.2.0 May 28, 2021
0.1.0 Sep 28, 2020

#16 in Graphics APIs

Download history 92/week @ 2021-06-01 65/week @ 2021-06-08 30/week @ 2021-06-15 207/week @ 2021-06-22 280/week @ 2021-06-29 314/week @ 2021-07-06 119/week @ 2021-07-13 359/week @ 2021-07-20 392/week @ 2021-07-27 451/week @ 2021-08-03 552/week @ 2021-08-10 288/week @ 2021-08-17 245/week @ 2021-08-24 418/week @ 2021-08-31 439/week @ 2021-09-07 465/week @ 2021-09-14

1,235 downloads per month
Used in 14 crates (6 directly)

MIT/Apache

5MB
6K SLoC

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

In progress

Not supported

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

License

Licensed under either of

Fonts used in examples:

Dependencies

~3–6MB
~115K SLoC