Skip to content

adamnemecek/femtovg

Repository files navigation

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. FemtoVG has rendering support via OpenGl (ES) 3.0+ backend and the wgpu backend.

Screenshots

Demo

demo Run with cargo run --example demo for the OpenGL backend and run with cargo run --example wgpu_demo for the wgpu backend. Run with --release for best performance.

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:

Debugging

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published