38 releases

new 0.11.2 Nov 17, 2024
0.10.1 Oct 24, 2024
0.9.2 Jun 27, 2024
0.9.0 Feb 27, 2024
0.1.0 Sep 28, 2020

#16 in Graphics APIs

Download history 10677/week @ 2024-08-01 13415/week @ 2024-08-08 12841/week @ 2024-08-15 13453/week @ 2024-08-22 13638/week @ 2024-08-29 14989/week @ 2024-09-05 13716/week @ 2024-09-12 14773/week @ 2024-09-19 15470/week @ 2024-09-26 16108/week @ 2024-10-03 13716/week @ 2024-10-10 16254/week @ 2024-10-17 14469/week @ 2024-10-24 16006/week @ 2024-10-31 10454/week @ 2024-11-07 5021/week @ 2024-11-14

48,713 downloads per month
Used in 34 crates (17 directly)

MIT/Apache

395KB
9K SLoC

Crates.io API dependency status rust: 1.70 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
  • Color fonts

Not supported

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

License

Licensed under either of

Fonts used in examples:

Dependencies

~7–44MB
~665K SLoC