CanvasRenderer: Separates Commit() method
[platform/core/uifw/dali-adaptor.git] / dali / internal / canvas-renderer / tizen / drawable-impl-tizen.h
1 #ifndef DALI_INTERNAL_TIZEN_DRAWABLE_IMPL_TIZEN_H
2 #define DALI_INTERNAL_TIZEN_DRAWABLE_IMPL_TIZEN_H
3
4 /*
5  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #ifdef THORVG_SUPPORT
23 #include <thorvg.h>
24 #endif
25 #include <dali/public-api/object/base-object.h>
26
27 // INTERNAL INCLUDES
28 #include <dali/devel-api/adaptor-framework/canvas-renderer-drawable.h>
29 #include <dali/devel-api/adaptor-framework/canvas-renderer.h>
30 #include <dali/internal/canvas-renderer/common/drawable-impl.h>
31 #include <dali/internal/canvas-renderer/tizen/canvas-renderer-impl-tizen.h>
32
33 namespace Dali
34 {
35 namespace Internal
36 {
37 namespace Adaptor
38 {
39 /**
40  * Dali internal Drawable.
41  */
42 class DrawableTizen : public Dali::Internal::Adaptor::Drawable
43 {
44 public:
45   /**
46    * @brief Creates a Drawable object.
47    * @return A pointer to a newly allocated Drawable
48    */
49   static DrawableTizen* New();
50
51   /**
52    * @copydoc Dali::CanvasRenderer::Drawable::SetOpacity()
53    */
54   bool SetOpacity(float opacity) override;
55
56   /**
57    * @copydoc Dali::CanvasRenderer::Drawable::GetOpacity()
58    */
59   float GetOpacity() const override;
60
61   /**
62    * @copydoc Dali::CanvasRenderer::Drawable::Rotate()
63    */
64   bool Rotate(Degree degree) override;
65
66   /**
67    * @copydoc Dali::CanvasRenderer::Drawable::Scale()
68    */
69   bool Scale(float factor) override;
70
71   /**
72    * @copydoc Dali::CanvasRenderer::Drawable::Translate()
73    */
74   bool Translate(Vector2 translate) override;
75
76   /**
77    * @copydoc Dali::CanvasRenderer::Drawable::Transform()
78    */
79   bool Transform(const Dali::Matrix3& matrix) override;
80
81   /**
82    * @copydoc Dali::CanvasRenderer::Drawable::GetBoundingBox()
83    */
84   Rect<float> GetBoundingBox() const override;
85   /**
86    * @copydoc Dali::CanvasRenderer::Drawable::SetClipPath()
87    */
88   bool SetClipPath(Dali::CanvasRenderer::Drawable& clip) override;
89
90   /**
91    * @copydoc Dali::CanvasRenderer::Drawable::SetMask()
92    */
93   bool SetMask(Dali::CanvasRenderer::Drawable& mask, Dali::CanvasRenderer::Drawable::MaskType type) override;
94
95   /**
96    * @copydoc Internal::Adaptor::Drawable::GetCompositionDrawable()
97    */
98   Dali::CanvasRenderer::Drawable GetCompositionDrawable() const override;
99
100   /**
101    * @copydoc Internal::Adaptor::Drawable::GetCompositionType()
102    */
103   CompositionType GetCompositionType() const override;
104
105   /**
106    * @copydoc Internal::Adaptor::Drawable::SetAdded()
107    */
108   void SetAdded(bool added) override;
109
110   /**
111    * @copydoc Internal::Adaptor::Drawable::IsAdded()
112    */
113   bool IsAdded() const override;
114
115   /**
116    * @copydoc Internal::Adaptor::Drawable::SetObject()
117    */
118   void* GetObject() const override;
119
120   /**
121    * @copydoc Internal::Adaptor::Drawable::GetObject()
122    */
123   void SetObject(const void* object) override;
124
125   /**
126    * @copydoc Internal::Adaptor::Drawable::SetChanged()
127    */
128   void SetChanged(bool changed) override;
129
130   /**
131    * @copydoc Internal::Adaptor::Drawable::GetChanged()
132    */
133   bool GetChanged() const override;
134
135   /**
136    * @copydoc Internal::Adaptor::Drawable::SetType()
137    */
138   void SetType(Types type);
139
140   /**
141    * @copydoc Internal::Adaptor::Drawable::GetType()
142    */
143   Types GetType() const;
144
145   DrawableTizen(const Drawable&) = delete;
146   DrawableTizen& operator=(Drawable&) = delete;
147   DrawableTizen(Drawable&&)           = delete;
148   DrawableTizen& operator=(Drawable&&) = delete;
149
150 protected:
151   /**
152    * @brief Constructor
153    */
154   DrawableTizen();
155
156   /**
157    * @brief Destructor.
158    */
159   virtual ~DrawableTizen() override;
160
161 private:
162   bool                           mAdded;
163   bool                           mChanged;
164   Drawable::Types                mType;
165   Drawable::CompositionType      mCompositionType;
166   Dali::CanvasRenderer::Drawable mCompositionDrawable;
167
168 #ifdef THORVG_SUPPORT
169   tvg::Paint* mTvgPaint;
170 #endif
171 };
172
173 } // namespace Adaptor
174
175 } // namespace Internal
176
177 } // namespace Dali
178
179 #endif // DALI_INTERNAL_TIZEN_DRAWABLE_IMPL_TIZEN_H