#define TIZENVG_EXPORT
#endif
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZENVG"
+
+
#ifdef __cplusplus
extern "C" {
#endif
-namespace tizenvg
+#define _TIZENVG_DECLARE_PRIVATE(A) \
+private: \
+ struct Impl; \
+ std::unique_ptr<Impl> pImpl; \
+ A(const A&) = delete; \
+ const A& operator=(const A&) = delete; \
+ A()
+
+#define _TIZENVG_DISABLE_CTOR(A) \
+ A() = delete; \
+ ~A() = delete
+
+namespace tvg
+{
+
+class SceneNode;
+
+
+/**
+ * @class PaintNode
+ *
+ * @ingroup TizenVG
+ *
+ * @brief description...
+ *
+ */
+class TIZENVG_EXPORT PaintNode
+{
+public:
+ virtual ~PaintNode() {}
+ virtual int prepare() = 0;
+};
+
+
+/**
+ * @class ShapeNode
+ *
+ * @ingroup TizenVG
+ *
+ * @brief description...
+ *
+ */
+class TIZENVG_EXPORT ShapeNode final : public PaintNode
+{
+public:
+ ~ShapeNode();
+
+ int prepare() noexcept override;
+
+ static std::unique_ptr<ShapeNode> gen();
+
+ _TIZENVG_DECLARE_PRIVATE(ShapeNode);
+};
+
+
+/**
+ * @class SceneNode
+ *
+ * @ingroup TizenVG
+ *
+ * @brief description...
+ *
+ */
+class TIZENVG_EXPORT SceneNode final : public PaintNode
+{
+public:
+ ~SceneNode();
+
+ int push(std::unique_ptr<ShapeNode> shape) noexcept;
+ int prepare() noexcept override;
+
+ static std::unique_ptr<SceneNode> gen() noexcept;
+
+ _TIZENVG_DECLARE_PRIVATE(SceneNode);
+};
+
+
+/**
+ * @class SwCanvas
+ *
+ * @ingroup TizenVG
+ *
+ @brief description...
+ *
+ */
+class TIZENVG_EXPORT SwCanvas final
{
+public:
+ ~SwCanvas();
+
+ int push(std::unique_ptr<PaintNode> paint) noexcept;
+ int clear() noexcept;
+
+ int draw(bool async = true) noexcept;
+ int drawSync() noexcept;
+
+ int target(uint32_t* buffer, size_t stride, size_t height) noexcept;
+
+ static std::unique_ptr<SwCanvas> gen(uint32_t* buffer = nullptr, size_t stride = 0, size_t height = 0) noexcept;
+
+ _TIZENVG_DECLARE_PRIVATE(SwCanvas);
+};
+
+
+/**
+ * @class GlCanvas
+ *
+ * @ingroup TizenVG
+ *
+ * @brief description...
+ *
+ */
+class TIZENVG_EXPORT GlCanvas final
+{
+public:
+ ~GlCanvas();
+
+ int push(std::unique_ptr<PaintNode> paint) noexcept;
+ int clear() noexcept;
+
+ //TODO: Gl Specific methods. Need gl backend configuration methods as well.
+ int draw(bool async = true) noexcept { return 0; }
+ int drawSync() noexcept { return 0; }
+
+ static std::unique_ptr<GlCanvas> gen() noexcept;
+
+ _TIZENVG_DECLARE_PRIVATE(GlCanvas);
+};
+
/**
* @class Engine
*/
static int init() noexcept;
static int term() noexcept;
+
+ _TIZENVG_DISABLE_CTOR(Engine);
};
} //namespace
source_file = [
- 'TvgEngine.cpp'
+ 'tvgCommon.h',
+ 'tvgEngine.cpp',
+ 'tvgCanvasBase.h',
+ 'tvgSwCanvas.cpp',
+ 'tvgGlCanvas.cpp',
+ 'tvgSceneNode.cpp',
+ 'tvgShapeNode.cpp'
]
src_dep = declare_dependency(
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#ifndef _TVG_CANVAS_CPP_
+#define _TVG_CANVAS_CPP_
+
+#include "tvgCommon.h"
+
+/************************************************************************/
+/* Internal Class Implementation */
+/************************************************************************/
+
+struct CanvasBase
+{
+
+ int push(unique_ptr<PaintNode> paint)
+ {
+ return 0;
+ }
+
+ int clear()
+ {
+ return 0;
+ }
+
+};
+
+
+/************************************************************************/
+/* External Class Implementation */
+/************************************************************************/
+
+#endif /* _TVG_CANVAS_CPP_ */
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#ifndef _TVG_COMMON_H_
+#define _TVG_COMMON_H_
+
+#include <iostream>
+#include <cassert>
+#include <vector>
+#include "tizenvg.h"
+
+using namespace std;
+using namespace tvg;
+using var = float;
+
+#endif //_TVG_COMMON_H_
#ifndef _TVG_ENGINE_CPP_
#define _TVG_ENGINE_CPP_
-#include <iostream>
-#include <cassert>
-#include "tizenvg.h"
-
-using namespace std;
-using namespace tizenvg;
+#include "tvgCommon.h"
/************************************************************************/
/* Internal Class Implementation */
/************************************************************************/
-namespace tizenvg
-{
-
-class EngineImpl
-{
- public:
- static int init() {
- return 0;
- }
- static int term() {
- return 0;
- }
-};
-
-}
/************************************************************************/
/* External Class Implementation */
int Engine::init() noexcept
{
- return EngineImpl::init();
+ return 0;
}
+
int Engine::term() noexcept
{
- return EngineImpl::term();
+ return 0;
}
#endif /* _TVG_ENGINE_CPP_ */
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#ifndef _TVG_GLCANVAS_CPP_
+#define _TVG_GLCANVAS_CPP_
+
+#include "tvgCommon.h"
+#include "tvgCanvasBase.h"
+
+/************************************************************************/
+/* Internal Class Implementation */
+/************************************************************************/
+
+struct GlCanvas::Impl : CanvasBase
+{
+ //...
+};
+
+
+/************************************************************************/
+/* External Class Implementation */
+/************************************************************************/
+
+GlCanvas::GlCanvas() : pImpl(make_unique<Impl>())
+{
+}
+
+
+GlCanvas::~GlCanvas()
+{
+ cout << "GlCanvas(" << this << ") destroyed!" << endl;
+}
+
+
+unique_ptr<GlCanvas> GlCanvas::gen() noexcept
+{
+ auto canvas = unique_ptr<GlCanvas>(new GlCanvas);
+ assert(canvas);
+
+ return canvas;
+}
+
+
+int GlCanvas::push(unique_ptr<PaintNode> paint) noexcept
+{
+ auto impl = pImpl.get();
+ assert(impl);
+ return impl->push(move(paint));
+}
+
+int GlCanvas::clear() noexcept
+{
+ auto impl = pImpl.get();
+ assert(impl);
+ return impl->clear();
+}
+
+#endif /* _TVG_GLCANVAS_CPP_ */
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#ifndef _TVG_SCENE_NODE_CPP_
+#define _TVG_SCENE_NODE_CPP_
+
+#include "tvgCommon.h"
+
+/************************************************************************/
+/* Internal Class Implementation */
+/************************************************************************/
+
+struct SceneNode::Impl
+{
+
+};
+
+
+
+/************************************************************************/
+/* External Class Implementation */
+/************************************************************************/
+
+SceneNode :: SceneNode() : pImpl(make_unique<Impl>())
+{
+
+}
+
+
+SceneNode :: ~SceneNode()
+{
+ cout << "SceneNode(" << this << ") destroyed!" << endl;
+}
+
+
+unique_ptr<SceneNode> SceneNode::gen() noexcept
+{
+ return unique_ptr<SceneNode>(new SceneNode);
+}
+
+int SceneNode :: push(unique_ptr<ShapeNode> shape) noexcept
+{
+ return 0;
+}
+
+
+int SceneNode :: prepare() noexcept
+{
+
+ return 0;
+}
+
+#endif /* _TVG_SCENE_NODE_CPP_ */
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#ifndef _TVG_SHAPE_NODE_CPP_
+#define _TVG_SHAPE_NODE_CPP_
+
+#include "tvgCommon.h"
+
+/************************************************************************/
+/* Internal Class Implementation */
+/************************************************************************/
+
+struct ShapeFill
+{
+};
+
+
+struct ShapeStroke
+{
+};
+
+
+struct ShapePath
+{
+};
+
+
+struct ShapeTransform
+{
+ var e[4*4];
+};
+
+
+struct ShapeChildren
+{
+ vector<unique_ptr<ShapeNode>> v;
+};
+
+
+struct ShapeNode::Impl
+{
+ ShapeChildren *children = nullptr;
+ ShapeTransform *transform = nullptr;
+ ShapeFill *fill = nullptr;
+ ShapeStroke *stroke = nullptr;
+ ShapePath *path = nullptr;
+ uint32_t color = 0;
+ uint32_t id = 0;
+
+
+ ~Impl()
+ {
+ if (path) delete(path);
+ if (stroke) delete(stroke);
+ if (fill) delete(fill);
+ if (transform) delete(transform);
+ if (children) delete(children);
+ }
+
+};
+
+
+/************************************************************************/
+/* External Class Implementation */
+/************************************************************************/
+
+ShapeNode :: ShapeNode() : pImpl(make_unique<Impl>())
+{
+
+}
+
+
+ShapeNode :: ~ShapeNode()
+{
+ cout << "ShapeNode(" << this << ") destroyed!" << endl;
+}
+
+
+unique_ptr<ShapeNode> ShapeNode::gen()
+{
+ return unique_ptr<ShapeNode>(new ShapeNode);
+}
+
+
+int ShapeNode :: prepare() noexcept
+{
+ return 0;
+}
+
+
+#endif //_TVG_SHAPE_NODE_CPP_
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#ifndef _TVG_SWCANVAS_CPP_
+#define _TVG_SWCANVAS_CPP_
+
+#include "tvgCommon.h"
+#include "tvgCanvasBase.h"
+
+/************************************************************************/
+/* Internal Class Implementation */
+/************************************************************************/
+
+struct SwCanvas::Impl : CanvasBase
+{
+ uint32_t* buffer = nullptr;
+ int stride = 0;
+ int height = 0;
+};
+
+
+/************************************************************************/
+/* External Class Implementation */
+/************************************************************************/
+
+int SwCanvas::target(uint32_t* buffer, size_t stride, size_t height) noexcept
+{
+ auto impl = pImpl.get();
+ assert(impl);
+
+ impl->buffer = buffer;
+ impl->stride = stride;
+ impl->height = height;
+
+ return 0;
+}
+
+
+int SwCanvas::draw(bool async) noexcept
+{
+ return 0;
+}
+
+
+int SwCanvas::drawSync() noexcept
+{
+ return 0;
+}
+
+
+int SwCanvas::push(unique_ptr<PaintNode> paint) noexcept
+{
+ auto impl = pImpl.get();
+ assert(impl);
+ return impl->push(move(paint));
+}
+
+
+int SwCanvas::clear() noexcept
+{
+ auto impl = pImpl.get();
+ assert(impl);
+ return impl->clear();
+}
+
+
+SwCanvas::SwCanvas() : pImpl(make_unique<Impl>())
+{
+}
+
+
+SwCanvas::~SwCanvas()
+{
+ cout << "SwCanvas(" << this << ") destroyed!" << endl;
+}
+
+
+unique_ptr<SwCanvas> SwCanvas::gen(uint32_t* buffer, size_t stride, size_t height) noexcept
+{
+ auto canvas = unique_ptr<SwCanvas>(new SwCanvas);
+ assert(canvas);
+
+ int ret = canvas.get()->target(buffer, stride, height);
+ if (ret > 0) return nullptr;
+
+ return canvas;
+}
+
+#endif /* _TVG_SWCANVAS_CPP_ */
all:
- gcc -o test test.cpp -g -lstdc++ `pkg-config --cflags --libs tizenvg`
+ gcc -o tvgDrawShape tvgDrawShape.cpp -g -lstdc++ `pkg-config --cflags --libs tizenvg`
+++ /dev/null
-#include <tizenvg.h>
-
-using namespace std;
-
-int main(int argc, char **argv)
-{
- tizenvg::Engine::init();
-
- //...
-
- tizenvg::Engine::term();
-}
--- /dev/null
+#include <tizenvg.h>
+
+using namespace std;
+
+#define WIDTH 800
+#define HEIGHT 800
+
+static uint32_t buffer[WIDTH * HEIGHT];
+
+int main(int argc, char **argv)
+{
+ //Initialize TizenVG Engine
+ tvg::Engine::init();
+
+ //Create a Canvas
+ auto canvas = tvg::SwCanvas::gen(buffer, WIDTH, HEIGHT);
+
+ //Prepare a Shape
+ auto shape1 = tvg::ShapeNode::gen();
+ shape1->rect(0, 0, 400, 400, 0.1); //x, y, w, h, corner_radius
+ shape1->fill(0, 255, 0, 255);
+
+ //Draw the Shape onto the Canvas
+ canvas->push(move(shape1));
+ canvas->draw();
+ canvas->sync();
+
+ //Terminate TizenVG Engine
+ tvg::Engine::term();
+}
--- /dev/null
+#include <tizenvg.h>
+
+using namespace std;
+
+#define WIDTH 800
+#define HEIGHT 800
+
+static uint32_t buffer[WIDTH * HEIGHT];
+
+int main(int argc, char **argv)
+{
+ //Initialize TizenVG Engine
+ tvg::Engine::init();
+
+ //Create a Canvas
+ auto canvas = tvg::SwCanvas::gen(buffer, WIDTH, HEIGHT);
+
+ //Prepare a Shape
+ auto shape1 = tvg::ShapeNode::gen();
+ shape1->rect(0, 0, 400, 400, 0.1); //x, y, w, h, corner_radius
+
+ //Linear Gradient Fill
+ auto fill1 = tvg::LinearFill::gen();
+ fill1->range(fill1, 0, 0, 400, 400); //from(x, y), to(x, y)
+ fill1->color(0, 255, 0, 0, 255); //color Stop 0: Red
+ fill1->color(0.5, 0, 255, 0, 255); //color Stop 1: Green
+ fill1->color(1, 0, 0, 255, 255); //color Stop 2: Blue
+ shape1.fill(fill1);
+
+ //Draw the Shape onto the Canvas
+ canvas->push(move(shape1));
+
+ //Prepare Circle
+ auto shape2 = tvg::ShapeNode::gen();
+ shape2->circle(400, 400, 200); //cx, cy, radius
+ shape2->fill(255, 255, 0, 255); //r, g, b, a
+ canvas->push(move(shape2));
+
+ //Radial Gradient Fill
+ auto fill2 = tvg::RadialFill::gen();
+ fill2->range(400, 400, 200); //center(x, y), radius
+ fill2->color(0, 255, 0, 0, 255); //color Stop 0: Red
+ fill2->color(0.5, 0, 255, 0, 255); //color Stop 1: Green
+ fill2->color(1, 0, 0, 255, 255); //color Stop 2: Blue
+ shape2.fill(fill2);
+
+ //Draw the Shape onto the Canvas
+ canvas->push(move(shape2));
+
+ canvas->draw();
+ canvas->sync();
+
+ //Terminate TizenVG Engine
+ tvg::Engine::term();
+}
--- /dev/null
+#include <tizenvg.h>
+
+using namespace std;
+
+#define WIDTH 800
+#define HEIGHT 800
+
+static uint32_t buffer[WIDTH * HEIGHT];
+
+int main(int argc, char **argv)
+{
+ //Initialize TizenVG Engine
+ tvg::Engine::init();
+
+ //Create a Canvas
+ auto canvas = tvg::SwCanvas::gen(buffer, WIDTH, HEIGHT);
+
+ //Prepare Rectangle
+ auto shape1 = tvg::ShapeNode::gen();
+ shape1->rect(0, 0, 400, 400, 0.1); //x, y, w, h, corner_radius
+ shape1->fill(0, 255, 0, 255); //r, g, b, a
+ canvas->push(move(shape1));
+
+ //Prepare Circle
+ auto shape2 = tvg::ShapeNode::gen();
+ shape2->circle(400, 400, 200); //cx, cy, radius
+ shape2->fill(255, 255, 0, 255); //r, g, b, a
+ canvas->push(move(shape2));
+
+ //Draw the Shapes onto the Canvas
+ canvas->draw();
+ canvas->sync();
+
+ //Terminate TizenVG Engine
+ tvg::Engine::term();
+}
--- /dev/null
+#include <tizenvg.h>
+
+using namespace std;
+
+#define WIDTH 800
+#define HEIGHT 800
+
+static uint32_t buffer[WIDTH * HEIGHT];
+
+int main(int argc, char **argv)
+{
+ //Initialize TizenVG Engine
+ tvg::Engine::init();
+
+ //Create a Canvas
+ auto canvas = tvg::SwCanvas::gen(buffer, WIDTH, HEIGHT);
+
+ //Prepare Path
+ auto path = tvg::Path::gen();
+ path.reserve(cmdCnt, ptCnt); //command count, points count
+ path.moveTo(...);
+ path.lineTo(...);
+ path.cubicTo(...);
+ path.close();
+
+ //Prepare a Shape
+ auto shape1 = tvg::ShapeNode::gen();
+ shape1->path(move(path)); //propagate owner
+ shape1->path(path.get()); //copy data directly
+ shape1->fill(0, 255, 0, 255);
+
+ //Draw the Shape onto the Canvas
+ canvas->push(move(shape1));
+ canvas->draw();
+ canvas->sync();
+
+ //Terminate TizenVG Engine
+ tvg::Engine::term();
+}
--- /dev/null
+#include <tizenvg.h>
+
+using namespace std;
+
+#define WIDTH 800
+#define HEIGHT 800
+
+static uint32_t buffer[WIDTH * HEIGHT];
+
+int main(int argc, char **argv)
+{
+ //Initialize TizenVG Engine
+ tvg::Engine::init();
+
+ //Create a Canvas
+ auto canvas = tvg::SwCanvas::gen(buffer, WIDTH, HEIGHT);
+
+ //Create a Scene
+ auto scene = tvg::SceneNode::gen(3); //reserve 3 shape nodes (optional)
+
+ //Shape1
+ auto shape1 = tvg::ShapeNode::gen();
+ shape1->rect(0, 0, 400, 400, 0.1);
+ shape1->fill(255, 0, 0, 255);
+ shape1->rotate(0, 0, 45); //axis x, y, z
+ scene->push(move(shape1));
+
+ //Shape2
+ auto shape2 = tvg::ShapeNode::gen();
+ shape2->rect(0, 0, 400, 400, 0.1);
+ shape2->fill(0, 255, 0, 255);
+ shape2->transform(matrix); //by matrix (var matrix[4 * 4];)
+ scene->push(move(shape2));
+
+ //Shape3
+ auto shape3 = tvg::ShapeNode::gen();
+ shape3->rect(0, 0, 400, 400, 0.1);
+ shape3->fill(0, 0, 255, 255);
+ shape3->origin(100, 100); //offset
+ scene->push(move(shape3));
+
+ //Draw the Scene onto the Canvas
+ canvas->push(move(scene));
+ canvas->draw();
+ canvas->sync();
+
+ //Terminate TizenVG Engine
+ tvg::Engine::term();
+}
--- /dev/null
+#include <tizenvg.h>
+
+using namespace std;
+
+#define WIDTH 800
+#define HEIGHT 800
+
+static uint32_t buffer[WIDTH * HEIGHT];
+
+int main(int argc, char **argv)
+{
+ //Initialize TizenVG Engine
+ tvg::Engine::init();
+
+ //Create a Canvas
+ auto canvas = tvg::SwCanvas::gen(buffer, WIDTH, HEIGHT);
+
+ //Prepare a Shape
+ auto shape1 = tvg::ShapeNode::gen();
+ shape1->rect(0, 0, 400, 400, 0.1); //x, y, w, h, corner_radius
+ shape1->fill(0, 255, 0, 255);
+
+ //Stroke Style
+ shape1->strokeColor(0, 0, 0, 255); //r, g, b, a
+ shape1->strokeWidth(1); //1px
+ shape1->strokeJoin(tvg::StrokeJoin::Miter);
+ shape1->strokeLineCap(tvg::StrokeLineCap::Butt);
+
+ uint32_t dash[] = {3, 1, 5, 1};
+ shape1->strokeDash(dash, 4);
+
+ //Draw the Shape onto the Canvas
+ canvas->push(move(shape1));
+ canvas->draw();
+ canvas->sync();
+
+ //Terminate TizenVG Engine
+ tvg::Engine::term();
+}
--- /dev/null
+#include <tizenvg.h>
+
+using namespace std;
+
+#define WIDTH 800
+#define HEIGHT 800
+
+static uint32_t buffer[WIDTH * HEIGHT];
+
+int main(int argc, char **argv)
+{
+ //Initialize TizenVG Engine
+ tvg::Engine::init();
+
+ //Create a Canvas
+ auto canvas = tvg::SwCanvas::gen(buffer, WIDTH, HEIGHT);
+
+ //Create a Scene
+ auto scene = tvg::SceneNode::gen();
+
+ //Shape1
+ auto shape1 = tvg::ShapeNode::gen();
+ auto pshape1 = shape1->get(); //acquire shape1 pointer to access directly
+ shape1->rect(0, 0, 400, 400, 0.1);
+ shape1->fill(255, 0, 0, 255);
+ shape1->rotate(0, 0, 45); //axis x, y, z
+ scene->push(move(shape1));
+
+ //Draw the Scene onto the Canvas
+ canvas->push(move(scene));
+
+ //Draw frame 1
+ canvas->draw();
+ canvas->sync();
+
+ //Clear previous shape path
+ pshape1->clear();
+ pshape1->rect(0, 0, 300, 300, 0.1);
+
+ //Prepapre for drawing
+ pshape1->update();
+
+ //Draw frame 2
+ canvas->draw();
+ canvas->sync();
+
+ //Terminate TizenVG Engine
+ tvg::Engine::term();
+}