Giter Site home page Giter Site logo

nanocanvas's Introduction

NanoCanvas {#mainpage}

NanoCanvas is the HTML5 Canvas liked antialiased vector graphics rendering library writing in C++11 based on Mikko Mononen's NanoVG .

Feartures

  • Easy to use , with HTML5 Canvas liked API
canvas.clearColor(Colors::DarkOliveGreen); //Clear canvas with color

// Draw a rounded rectangle
canvas.beginPath()
      .roundedRect(50,50,100,100,10)
      .fillStyle(Colors::Salmon)
      .fill();

// Draw styled text
TextStyle textStyle;
textStyle.size = 36.0f;
textStyle.color = Colors::White;
textStyle.face = font.face;
canvas.fillStyle(textStyle)
      .beginPath()
      .fillText("Hello Canvas",30,190);

  • Hardware accelerated so it's fast

    Thanks for backend ports of NanoVG , now we can use NanoCanvas with OpenGL, OpenGL ES, BGFX and D3D.

Integrate to your projects

  1. Add NanoVG code to your projects and add the folder where your nanovg.h file located to your include directory. Be sure #included "nanovg.h" works on your projects.

  2. Add NanoCanvas code files under src folder in to your projects.

  3. Create Canvas with NanoVG context For example,using OpenGL 3.x as the backend renderer.

NVGcontext * nvgCtx = nvgCreateGL3(NVG_ANTIALIAS | NVG_DEBUG |NVG_STENCIL_STROKES);
Canvas canvas(nvgCtx,wndWidth ,wndHeight);
if(canvas.valid()) {
    // Everything is OK
}

4 . Draw awesome graphics Draw graphics between begineFrame() and endFrame method.

// main render loop
while ( appRunning )
{
    canvas.begineFrame(wndWidth,wndHeight);
    // Draw awesome graphics here
    canvas.endFrame();
}

Why not takes NanoVG itself ?

You can use the backend renderer as your like. You have to do that by yourself. :)


For more informations

Documemtations is avaliable.

nanocanvas's People

Contributors

geequlim avatar

Watchers

 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.