common shape: support rounded rectangle.
[platform/core/graphics/tizenvg.git] / test / testStroke.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
19     auto shape1 = tvg::ShapeNode::gen();
20     shape1->rect(0, 0, 400, 400, 0.1);     //x, y, w, h, cornerRadius
21     shape1->fill(0, 255, 0, 255);
22
23     //Stroke Style
24     shape1->strokeColor(0, 0, 0, 255);     //r, g, b, a
25     shape1->strokeWidth(1);                //1px
26     shape1->strokeJoin(tvg::StrokeJoin::Miter);
27     shape1->strokeLineCap(tvg::StrokeLineCap::Butt);
28
29     uint32_t dash[] = {3, 1, 5, 1};        //dash pattern
30     shape1->strokeDash(dash, 4);
31
32     //Draw the Shape onto the Canvas
33     canvas->push(move(shape1));
34     canvas->draw();
35     canvas->sync();
36
37     //Terminate TizenVG Engine
38     tvg::Engine::term();
39 }