742ff74fd5e0d4eb30d81dcc21ecbfce29dfdff3
[platform/core/uifw/dali-adaptor.git] / dali / internal / canvas-renderer / ubuntu / drawable-impl-ubuntu.h
1 #ifndef DALI_INTERNAL_UBUNTU_DRAWABLE_IMPL_UBUNTU_H
2 #define DALI_INTERNAL_UBUNTU_DRAWABLE_IMPL_UBUNTU_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/ubuntu/canvas-renderer-impl-ubuntu.h>
32
33 namespace Dali
34 {
35 namespace Internal
36 {
37 namespace Adaptor
38 {
39 /**
40  * Dali internal Drawable.
41  */
42 class DrawableUbuntu : 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 DrawableUbuntu* 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   /**
87    * @copydoc Dali::CanvasRenderer::Drawable::SetClipPath()
88    */
89   bool SetClipPath(Dali::CanvasRenderer::Drawable& clip) override;
90
91   /**
92    * @copydoc Dali::CanvasRenderer::Drawable::SetMask()
93    */
94   bool SetMask(Dali::CanvasRenderer::Drawable& mask, Dali::CanvasRenderer::Drawable::MaskType type) override;
95
96   /**
97    * @copydoc Internal::Adaptor::Drawable::GetCompositionDrawable()
98    */
99   Dali::CanvasRenderer::Drawable GetCompositionDrawable() const override;
100
101   /**
102    * @copydoc Internal::Adaptor::Drawable::GetCompositionType()
103    */
104   CompositionType GetCompositionType() const override;
105
106   /**
107    * @copydoc Internal::Adaptor::Drawable::SetAdded()
108    */
109   void SetAdded(bool added) override;
110
111   /**
112    * @copydoc Internal::Adaptor::Drawable::IsAdded()
113    */
114   bool IsAdded() const override;
115
116   /**
117    * @copydoc Internal::Adaptor::Drawable::SetObject()
118    */
119   void* GetObject() const override;
120
121   /**
122    * @copydoc Internal::Adaptor::Drawable::GetObject()
123    */
124   void SetObject(const void* object) override;
125
126   /**
127    * @copydoc Internal::Adaptor::Drawable::SetChanged()
128    */
129   void SetChanged(bool changed) override;
130
131   /**
132    * @copydoc Internal::Adaptor::Drawable::GetChanged()
133    */
134   bool GetChanged() const override;
135
136   /**
137    * @copydoc Internal::Adaptor::Drawable::SetType()
138    */
139   void SetType(Types type);
140
141   /**
142    * @copydoc Internal::Adaptor::Drawable::GetType()
143    */
144   Types GetType() const;
145
146   DrawableUbuntu(const Drawable&) = delete;
147   DrawableUbuntu& operator=(Drawable&) = delete;
148   DrawableUbuntu(Drawable&&)           = delete;
149   DrawableUbuntu& operator=(Drawable&&) = delete;
150
151 protected:
152   /**
153    * @brief Constructor
154    */
155   DrawableUbuntu();
156
157   /**
158    * @brief Destructor.
159    */
160   virtual ~DrawableUbuntu() override;
161
162 private:
163   bool                           mAdded;
164   bool                           mChanged;
165   Drawable::Types                mType;
166   Drawable::CompositionType      mCompositionType;
167   Dali::CanvasRenderer::Drawable mCompositionDrawable;
168
169 #ifdef THORVG_SUPPORT
170   tvg::Paint* mTvgPaint;
171 #endif
172 };
173
174 } // namespace Adaptor
175
176 } // namespace Internal
177
178 } // namespace Dali
179
180 #endif // DALI_INTERNAL_UBUNTU_DRAWABLE_IMPL_UBUNTU_H