CanvasRenderer: Add Drawable::SetClipPath() Api
[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 Internal::Adaptor::Drawable::GetCompositionDrawable()
92    */
93   Dali::CanvasRenderer::Drawable GetCompositionDrawable() const override;
94
95   /**
96    * @copydoc Internal::Adaptor::Drawable::GetCompositionType()
97    */
98   CompositionType GetCompositionType() const override;
99
100   /**
101    * @copydoc Internal::Adaptor::Drawable::SetAdded()
102    */
103   void SetAdded(bool added) override;
104
105   /**
106    * @copydoc Internal::Adaptor::Drawable::IsAdded()
107    */
108   bool IsAdded() const override;
109
110   /**
111    * @copydoc Internal::Adaptor::Drawable::SetObject()
112    */
113   void* GetObject() const override;
114
115   /**
116    * @copydoc Internal::Adaptor::Drawable::GetObject()
117    */
118   void SetObject(const void* object) override;
119
120   /**
121    * @copydoc Internal::Adaptor::Drawable::SetChanged()
122    */
123   void SetChanged(bool changed) override;
124
125   /**
126    * @copydoc Internal::Adaptor::Drawable::GetChanged()
127    */
128   bool GetChanged() const override;
129
130   /**
131    * @copydoc Internal::Adaptor::Drawable::SetType()
132    */
133   void SetType(Types type);
134
135   /**
136    * @copydoc Internal::Adaptor::Drawable::GetType()
137    */
138   Types GetType() const;
139
140   DrawableTizen(const Drawable&) = delete;
141   DrawableTizen& operator=(Drawable&) = delete;
142   DrawableTizen(Drawable&&)           = delete;
143   DrawableTizen& operator=(Drawable&&) = delete;
144
145 protected:
146   /**
147    * @brief Constructor
148    */
149   DrawableTizen();
150
151   /**
152    * @brief Destructor.
153    */
154   virtual ~DrawableTizen() override;
155
156 private:
157   bool                           mAdded;
158   bool                           mChanged;
159   Drawable::Types                mType;
160   Drawable::CompositionType      mCompositionType;
161   Dali::CanvasRenderer::Drawable mCompositionDrawable;
162
163 #ifdef THORVG_SUPPORT
164   tvg::Paint* mTvgPaint;
165 #endif
166 };
167
168 } // namespace Adaptor
169
170 } // namespace Internal
171
172 } // namespace Dali
173
174 #endif // DALI_INTERNAL_TIZEN_DRAWABLE_IMPL_TIZEN_H