1 #ifndef DALI_INTERNAL_DRAWABLE_IMPL_H
2 #define DALI_INTERNAL_DRAWABLE_IMPL_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
25 #include <dali/public-api/object/base-object.h>
28 #include <dali/devel-api/adaptor-framework/canvas-renderer-drawable.h>
29 #include <dali/devel-api/adaptor-framework/canvas-renderer.h>
38 * Dali internal Drawable.
40 class Drawable : public Dali::BaseObject
51 virtual ~Drawable() override;
54 * @brief Create factory item(implementation) object.
59 * @copydoc Dali::CanvasRenderer::Drawable::SetOpacity
61 virtual bool SetOpacity(float opacity);
64 * @copydoc Dali::CanvasRenderer::Drawable::GetOpacity
66 virtual float GetOpacity() const;
69 * @copydoc Dali::CanvasRenderer::Drawable::Rotate
71 virtual bool Rotate(Degree degree);
74 * @copydoc Dali::CanvasRenderer::Drawable::Scale
76 virtual bool Scale(float factor);
79 * @copydoc Dali::CanvasRenderer::Drawable::Translate
81 virtual bool Translate(Vector2 translate);
84 * @copydoc Dali::CanvasRenderer::Drawable::Transform
86 virtual bool Transform(const Dali::Matrix3& matrix);
89 * @copydoc Dali::CanvasRenderer::Drawable::GetBoundingBox
91 virtual Rect<float> GetBoundingBox() const;
94 * @brief Set whether this drawable object was added to other object(CanvasRenderer or DrawableGroup) or not.
95 * @param[in] added Ture if added, false otherwise.
97 virtual void SetAdded(bool added);
100 * @brief Returns whether this drawable object was added to another object(CanvasRenderer or DrawableGroup).
101 * @return Returns Ture if added, false otherwise.
103 virtual bool IsAdded() const;
106 * @brief Returns a drawable object pointer.
107 * @return Returns a drawable object pointer.
109 virtual void* GetObject() const;
112 * @brief Set a drawable object
113 * @param[in] object drawable object
115 virtual void SetObject(const void* object);
118 * @brief Set a changed state.
119 * @param[in] changed The state of changed.
121 virtual void SetChanged(bool changed);
124 * @brief Get a changed state.
125 * @return Returns state of changed.
127 virtual bool GetChanged() const;
130 * @brief Returns a drawable's implements object pointer.
131 * @return Returns a drawable's implements object pointer.
133 Dali::Internal::Adaptor::Drawable* GetImplementation();
135 Drawable(const Drawable&) = delete;
136 Drawable& operator=(Drawable&) = delete;
137 Drawable(Drawable&&) = delete;
138 Drawable& operator=(Drawable&&) = delete;
141 Dali::Internal::Adaptor::Drawable* pImpl = nullptr;
144 } // namespace Adaptor
146 } // namespace Internal
148 inline static Internal::Adaptor::Drawable& GetImplementation(Dali::CanvasRenderer::Drawable& drawable)
150 DALI_ASSERT_ALWAYS(drawable && "Drawable handle is empty.");
152 BaseObject& handle = drawable.GetBaseObject();
154 return static_cast<Internal::Adaptor::Drawable&>(handle);
157 inline static const Internal::Adaptor::Drawable& GetImplementation(const Dali::CanvasRenderer::Drawable& drawable)
159 DALI_ASSERT_ALWAYS(drawable && "Drawable handle is empty.");
161 const BaseObject& handle = drawable.GetBaseObject();
163 return static_cast<const Internal::Adaptor::Drawable&>(handle);
168 #endif // DALI_INTERNAL_DRAWABLE_IMPL_H