NanoCanvas

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

Feartures

1 {c++}
2 
3 canvas.clearColor(Colors::DarkOliveGreen); //Clear canvas with color
4 
5 // Draw a rounded rectangle
6 canvas.beginPath()
7  .roundedRect(50,50,100,100,10)
8  .fillStyle(Colors::Salmon)
9  .fill();
10 
11 // Draw styled text
12 TextStyle textStyle;
13 textStyle.size = 36.0f;
14 textStyle.color = Colors::White;
15 textStyle.face = font.face;
16 canvas.fillStyle(textStyle)
17  .beginPath()
18  .fillText("Hello Canvas",30,190);

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.
    1 {c++}
    2 NVGcontext * nvgCtx = nvgCreateGL3(NVG_ANTIALIAS | NVG_DEBUG |NVG_STENCIL_STROKES);
    3 Canvas canvas(nvgCtx,wndWidth ,wndHeight);
    4 if(canvas.valid()) {
    5  // Everything is OK
    6 }
  4. Draw awesome graphics Draw graphics between begineFrame() and endFrame method. ```c++ // 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.


The documentation was generated by Doxygen

Copyright © 2015 Geequlim. All rights reserved.