Giter Site home page Giter Site logo

nanovg-rs's Introduction

NanoVG Rust wrapper

Now with Cargo!

This is a Rust-language wrapper for the NanoVG vector-graphis library.

NanoVG is C code, and it supports several back-ends: GL2, GL3, GLES...

NanoVG is not an extremely complete or extensive implementation of vector graphics. It is however small and hardware-accelerated, which is what I want.

Screenshot

yay! screenshot works in rust demo!

Dependencies

This build process will produce a Rust library, which includes the Rust wrapper for nanovg functions, and which statically links in those functions. NanoVG only does the graphics drawing, though; you'll need to be getting a GL context from somewhere. The examples use GLFW.

Premake4 is required for building NanoVG itself.

rust-bindgen was used to create the initial ffi binding.

gl-rs, by bjz, is used to grab the GL framebuffer for snapshots.

glfw-rs, also bjz's, is used to create the window and expose events.

Building

The Makefile is probably out of date now. Build using cargo:

  git clone https://github.com/KevinKelley/nanovg-rs
  cd nanovg-rs
  cargo build

To build the demo, then:

  cd example
  cargo build
  ./target/example

(note that font and image resources won't be found if you run from inside the target directory)

In the demo,

  • 'p' switches between pre- and un-premultiplied alpha;
  • 's' saves a screenshot;
  • and 'space' toggles scale/rotate of the pseudo-window stuff.

Used By

License

MIT, for this binding. NanoVG is released under the zlib license.

Links

nanovg-rs's People

Contributors

kevinkelley avatar netvl avatar lordi avatar

Watchers

 avatar James Cloos avatar  avatar

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.