30 releases

0.8.2 Jan 20, 2024
0.8.1 Dec 18, 2023
0.8.0 Nov 2, 2023
0.7.1 Jun 14, 2023
0.1.0 Sep 28, 2020

#27 in Images

Download history 3276/week @ 2023-10-31 3586/week @ 2023-11-07 4224/week @ 2023-11-14 4224/week @ 2023-11-21 4528/week @ 2023-11-28 3611/week @ 2023-12-05 4090/week @ 2023-12-12 3720/week @ 2023-12-19 3189/week @ 2023-12-26 4371/week @ 2024-01-02 5525/week @ 2024-01-09 5391/week @ 2024-01-16 5956/week @ 2024-01-23 5875/week @ 2024-01-30 5669/week @ 2024-02-06 5009/week @ 2024-02-13

23,653 downloads per month
Used in 30 crates (15 directly)

MIT/Apache

315KB
7K SLoC

Crates.io API dependency status rust: 1.65 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
~228K SLoC