SvgLoaderCommon: Add initialization in SvgVector
[platform/core/graphics/tizenvg.git] / README.md
1 # ThorVG
2
3 ThorVG is a platform independent standalone C++ library for drawing vector-based shapes and SVG.
4
5 #
6 ## Contents
7 - [Building ThorVG](#building-thorvg)
8         - [Meson Build](#meson-build)
9 - [Quick Start](#quick-start)
10 - [Issues or Feature Requests?](#issues-or-feature-requests)
11 #
12 ## Building ThorVG
13 thorvg supports [meson](https://mesonbuild.com/) build system.
14 #
15 ### Meson Build
16 install [meson](http://mesonbuild.com/Getting-meson.html) and [ninja](https://ninja-build.org/) if not already installed.
17
18 Run meson to configure ThorVG.
19 ```
20 meson build
21 ```
22 Run ninja to build & install ThorVG.
23 ```
24 ninja -C build install
25 ```
26 [Back to contents](#contents)
27 #
28 ## Quick Start
29 ThorVG renders vector shapes on a given canvas buffer.
30
31 You can initialize ThorVG engine first:
32 ```cpp
33 tvg::Initializer::init(tvg::CanvasEngine::Sw);
34 ```
35 You can prepare a empty canvas for drawing on it.
36 ```cpp
37 static uint32_t buffer[WIDTH * HEIGHT];          //canvas target buffer
38
39 auto canvas = tvg::SwCanvas::gen();              //generate a canvas
40 canvas->target(buffer, WIDTH, WIDTH, HEIGHT);    //stride, w, h
41 ```
42
43 Next you can draw shapes onto the canvas.
44 ```cpp
45 auto shape = tvg::Shape::gen();             //generate a shape
46 shape->appendRect(0, 0, 200, 200, 0, 0);    //x, y, w, h, rx, ry
47 shape->appendCircle(400, 400, 100, 100);    //cx, cy, radiusW, radiusH
48 shape->fill(255, 255, 0, 255);              //r, g, b, a
49
50 canvas->push(move(shape));                  //push shape drawing command
51 ```
52 Begin rendering & finish it at a particular time.
53 ```cpp
54 canvas->draw();
55 canvas->sync();
56 ```
57 Lastly, you can acquire the rendered image in buffer memory.
58
59 [Back to contents](#contents)
60 #
61 ## Issues or Feature Requests?
62 For immidiate assistant or support please reach us in [Gitter](https://gitter.im/thorvg/community)