Git Product home page Git Product logo

femtovg's Introduction

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

femtovg's People

Contributors

adamnemecek avatar albertogp avatar nasso avatar ogoffart avatar ollpu avatar peterprototypes avatar tronical avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

femtovg's Issues

Crash while resizing windows

Environment

Debian stable running X11 with Nvidia drivers

Steps to reproduce

cargo run --example wgpu_demo

Resize the window. Keep resizing until you get this:

reallocating stencil texture Instant { tv_sec: 255277, tv_nsec: 152997264 }
reallocating stencil texture Instant { tv_sec: 255277, tv_nsec: 202835828 }
reallocating stencil texture Instant { tv_sec: 255277, tv_nsec: 245754503 }
reallocating stencil texture Instant { tv_sec: 255277, tv_nsec: 284947364 }
reallocating stencil texture Instant { tv_sec: 255277, tv_nsec: 334616553 }
wgpu error: Validation Error

Caused by:
    In a RenderPass
      note: encoder = `<CommandBuffer-(0, 275, Vulkan)>`
    In a pass parameter
      note: command buffer = `<CommandBuffer-(0, 275, Vulkan)>`
    attachments have differing sizes: ("depth", Extent3d { width: 716, height: 356, depth_or_array_layers: 1 }) is followed by ("color", Extent3d { width: 780, height: 600, depth_or_array_layers: 1 })


thread 'main' panicked at 'Handling wgpu errors as fatal by default', /home/birkett/.cargo/git/checkouts/wgpu-rs-40ea39809c03c5d8/1f8e411/src/backend/direct.rs:1942:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Segmentation fault

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.