32 releases

0.9.1 Apr 12, 2024
0.9.0 Feb 27, 2024
0.8.2 Jan 20, 2024
0.8.1 Dec 18, 2023
0.1.0 Sep 28, 2020

#18 in Graphics APIs

Download history 5763/week @ 2024-01-24 5421/week @ 2024-01-31 5194/week @ 2024-02-07 5990/week @ 2024-02-14 6296/week @ 2024-02-21 5126/week @ 2024-02-28 4729/week @ 2024-03-06 5863/week @ 2024-03-13 5525/week @ 2024-03-20 5464/week @ 2024-03-27 4925/week @ 2024-04-03 5782/week @ 2024-04-10 6316/week @ 2024-04-17 5909/week @ 2024-04-24 6497/week @ 2024-05-01 6709/week @ 2024-05-08

26,594 downloads per month
Used in 31 crates (15 directly)

MIT/Apache

315KB
7K SLoC

Crates.io API dependency status rust: 1.66 Discord

femtovg

GPU 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–21MB
~231K SLoC