2 * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
23 #define TIZENVG_EXPORT __attribute__ ((visibility ("default")))
25 #define TIZENVG_EXPORT
31 #define LOG_TAG "TIZENVG"
38 #define _TIZENVG_DECLARE_PRIVATE(A) \
41 std::unique_ptr<Impl> pImpl; \
42 A(const A&) = delete; \
43 const A& operator=(const A&) = delete; \
46 #define _TIZENVG_DISABLE_CTOR(A) \
53 enum class TIZENVG_EXPORT PathCommand { Close, MoveTo, LineTo, CubicTo };
69 * @brief description...
72 class TIZENVG_EXPORT PaintNode
75 virtual ~PaintNode() {}
76 virtual int dispose(RenderMethod* engine) = 0;
77 virtual int update(RenderMethod* engine) = 0;
86 * @brief description...
89 class TIZENVG_EXPORT ShapeNode final : public PaintNode
94 int dispose(RenderMethod* engine) noexcept override;
95 int update(RenderMethod* engine) noexcept override;
98 int appendRect(float x, float y, float w, float h, float radius) noexcept;
99 int appendCircle(float cx, float cy, float radius) noexcept;
101 int fill(size_t r, size_t g, size_t b, size_t a) noexcept;
103 int pathCommands(const PathCommand** cmds) const noexcept;
104 int pathCoords(const Point** pts) const noexcept;
105 int fill(size_t* r, size_t* g, size_t* b, size_t* a) const noexcept;
107 static std::unique_ptr<ShapeNode> gen() noexcept;
109 _TIZENVG_DECLARE_PRIVATE(ShapeNode);
118 * @brief description...
121 class TIZENVG_EXPORT SceneNode final : public PaintNode
126 int dispose(RenderMethod* engine) noexcept override;
127 int update(RenderMethod* engine) noexcept override;
129 int push(std::unique_ptr<ShapeNode> shape) noexcept;
131 static std::unique_ptr<SceneNode> gen() noexcept;
133 _TIZENVG_DECLARE_PRIVATE(SceneNode);
142 @brief description...
145 class TIZENVG_EXPORT SwCanvas final
150 int push(std::unique_ptr<PaintNode> paint) noexcept;
151 int clear() noexcept;
153 int update() noexcept;
154 int draw(bool async = true) noexcept;
156 RenderMethod* engine() noexcept;
158 int target(uint32_t* buffer, size_t stride, size_t height) noexcept;
160 static std::unique_ptr<SwCanvas> gen(uint32_t* buffer = nullptr, size_t stride = 0, size_t height = 0) noexcept;
162 _TIZENVG_DECLARE_PRIVATE(SwCanvas);
171 * @brief description...
174 class TIZENVG_EXPORT GlCanvas final
179 int push(std::unique_ptr<PaintNode> paint) noexcept;
180 int clear() noexcept;
182 //TODO: Gl Specific methods. Need gl backend configuration methods as well.
183 int update() noexcept;
184 int draw(bool async = true) noexcept { return 0; }
185 int sync() noexcept { return 0; }
186 RenderMethod* engine() noexcept;
188 static std::unique_ptr<GlCanvas> gen() noexcept;
190 _TIZENVG_DECLARE_PRIVATE(GlCanvas);
199 * @brief description...
202 class TIZENVG_EXPORT Engine final
216 static int init() noexcept;
217 static int term() noexcept;
219 _TIZENVG_DISABLE_CTOR(Engine);