25 unstable releases (5 breaking)

0.6.0 Feb 6, 2023
0.4.0 Jan 27, 2023
0.3.7 Oct 24, 2022
0.3.5 May 23, 2022
0.1.0 Sep 28, 2020

#26 in Graphics APIs

Download history 1067/week @ 2022-12-01 1081/week @ 2022-12-08 650/week @ 2022-12-15 577/week @ 2022-12-22 626/week @ 2022-12-29 567/week @ 2023-01-05 464/week @ 2023-01-12 739/week @ 2023-01-19 861/week @ 2023-01-26 1230/week @ 2023-02-02 860/week @ 2023-02-09 1419/week @ 2023-02-16 1116/week @ 2023-02-23 786/week @ 2023-03-02 1133/week @ 2023-03-09 908/week @ 2023-03-16

4,073 downloads per month
Used in 24 crates (13 directly)

MIT/Apache

300KB
7K SLoC

Crates.io API dependency status rust: 1.63 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

~6–13MB
~245K SLoC