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 };
68 * @brief description...
71 class TIZENVG_EXPORT PaintNode
74 virtual ~PaintNode() {}
75 virtual int update(RenderMethod* engine) = 0;
84 * @brief description...
87 class TIZENVG_EXPORT ShapeNode final : public PaintNode
92 int update(RenderMethod* engine) noexcept override;
95 int appendRect(float x, float y, float w, float h, float radius) noexcept;
96 int appendCircle(float cx, float cy, float radius) noexcept;
98 int fill(size_t r, size_t g, size_t b, size_t a) noexcept;
100 int pathCommands(const PathCommand** cmds) const noexcept;
101 int pathCoords(const Point** pts) const noexcept;
102 int fill(size_t* r, size_t* g, size_t* b, size_t* a) const noexcept;
104 static std::unique_ptr<ShapeNode> gen() noexcept;
106 //FIXME: Ugly... Better design?
107 void *engine() noexcept;
109 _TIZENVG_DECLARE_PRIVATE(ShapeNode);
118 * @brief description...
121 class TIZENVG_EXPORT SceneNode final : public PaintNode
126 int update(RenderMethod* engine) noexcept override;
128 int push(std::unique_ptr<ShapeNode> shape) noexcept;
130 static std::unique_ptr<SceneNode> gen() noexcept;
132 _TIZENVG_DECLARE_PRIVATE(SceneNode);
141 @brief description...
144 class TIZENVG_EXPORT SwCanvas final
149 int push(std::unique_ptr<PaintNode> paint) noexcept;
150 int clear() noexcept;
152 int update() noexcept;
153 int draw(bool async = true) noexcept;
155 RenderMethod* engine() noexcept;
157 int target(uint32_t* buffer, size_t stride, size_t height) noexcept;
159 static std::unique_ptr<SwCanvas> gen(uint32_t* buffer = nullptr, size_t stride = 0, size_t height = 0) noexcept;
161 _TIZENVG_DECLARE_PRIVATE(SwCanvas);
170 * @brief description...
173 class TIZENVG_EXPORT GlCanvas final
178 int push(std::unique_ptr<PaintNode> paint) noexcept;
179 int clear() noexcept;
181 //TODO: Gl Specific methods. Need gl backend configuration methods as well.
182 int update() noexcept;
183 int draw(bool async = true) noexcept;
184 int sync() noexcept { return 0; }
185 RenderMethod* engine() noexcept;
187 static std::unique_ptr<GlCanvas> gen() noexcept;
189 _TIZENVG_DECLARE_PRIVATE(GlCanvas);
198 * @brief description...
201 class TIZENVG_EXPORT Engine final
215 static int init() noexcept;
216 static int term() noexcept;
218 _TIZENVG_DISABLE_CTOR(Engine);