implement basic interfaces
[platform/core/graphics/tizenvg.git] / test / testShape.cpp
1 #include <tizenvg.h>
2
3 using namespace std;
4
5 #define WIDTH 800
6 #define HEIGHT 800
7
8 static uint32_t buffer[WIDTH * HEIGHT];
9
10 int main(int argc, char **argv)
11 {
12     //Initialize TizenVG Engine
13     tvg::Engine::init();
14
15     //Create a Canvas
16     auto canvas = tvg::SwCanvas::gen(buffer, WIDTH, HEIGHT);
17
18     //Prepare a Shape (Rectangle)
19     auto shape1 = tvg::ShapeNode::gen();
20     shape1->appendRect(0, 0, 400, 400, 0);      //x, y, w, h, corner_radius
21     shape1->fill(0, 255, 0, 255);           //r, g, b, a
22
23     /* Push the shape into the Canvas drawing list
24        When this shape is into the canvas list, the shape could update & prepare
25        internal data asynchronously for coming rendering.
26        Canvas keeps this shape node unless user call canvas->clear() */
27     canvas->push(move(shape1));
28
29     canvas->draw();
30     canvas->sync();
31
32     //Terminate TizenVG Engine
33     tvg::Engine::term();
34 }