1 #ifndef DALI_INTERNAL_SHAPE_IMPL_H
2 #define DALI_INTERNAL_SHAPE_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.
22 #include <dali/public-api/object/base-object.h>
25 #include <dali/devel-api/adaptor-framework/canvas-renderer-shape.h>
26 #include <dali/internal/canvas-renderer/common/drawable-impl.h>
35 * Dali internal Shape.
37 class Shape : public Internal::Adaptor::Drawable
51 * @copydoc Dali::CanvasRenderer::Shape::AddRect()
53 virtual bool AddRect(Rect<float> rect, Vector2 roundedCorner);
56 * @copydoc Dali::CanvasRenderer::Shape::AddCircle()
58 virtual bool AddCircle(Vector2 center, Vector2 radius);
61 * @copydoc Dali::CanvasRenderer::Shape::AddArc()
63 virtual bool AddArc(Vector2 center, float radius, float startAngle, float sweep, bool pie);
66 * @copydoc Dali::CanvasRenderer::Shape::AddMoveTo()
68 virtual bool AddMoveTo(Vector2 point);
71 * @copydoc Dali::CanvasRenderer::Shape::AddLineTo()
73 virtual bool AddLineTo(Vector2 line);
76 * @copydoc Dali::CanvasRenderer::Shape::AddCubicTo()
78 virtual bool AddCubicTo(Vector2 controlPoint1, Vector2 controlPoint2, Vector2 endPoint);
81 * @copydoc Dali::CanvasRenderer::Shape::Close()
86 * @copydoc Dali::CanvasRenderer::Shape::ResetPath()
88 virtual bool ResetPath();
91 * @copydoc Dali::CanvasRenderer::Shape::SetFillColor()
93 virtual bool SetFillColor(Vector4 color);
96 * @copydoc Dali::CanvasRenderer::Shape::GetFillColor()
98 virtual Vector4 GetFillColor() const;
101 * @copydoc Dali::CanvasRenderer::Shape::SetFillRule()
103 virtual bool SetFillRule(Dali::CanvasRenderer::Shape::FillRule rule);
106 * @copydoc Dali::CanvasRenderer::Shape::GetFillRule()
108 virtual Dali::CanvasRenderer::Shape::FillRule GetFillRule() const;
111 * @copydoc Dali::CanvasRenderer::Shape::SetStrokeWidth()
113 virtual bool SetStrokeWidth(float width);
116 * @copydoc Dali::CanvasRenderer::Shape::GetStrokeWidth()
118 virtual float GetStrokeWidth() const;
121 * @copydoc Dali::CanvasRenderer::Shape::SetStrokeColor()
123 virtual bool SetStrokeColor(Vector4 color);
126 * @copydoc Dali::CanvasRenderer::Shape::GetStrokeColor()
128 virtual Vector4 GetStrokeColor() const;
131 * @copydoc Dali::CanvasRenderer::Shape::SetStrokeDash()
133 virtual bool SetStrokeDash(const Dali::Vector<float> dashPattern);
136 * @copydoc Dali::CanvasRenderer::Shape::GetStrokeDash()
138 virtual Dali::Vector<float> GetStrokeDash() const;
141 * @copydoc Dali::CanvasRenderer::Shape::SetStrokeCap()
143 virtual bool SetStrokeCap(Dali::CanvasRenderer::Shape::StrokeCap cap);
146 * @copydoc Dali::CanvasRenderer::Shape::GetStrokeCap()
148 virtual Dali::CanvasRenderer::Shape::StrokeCap GetStrokeCap() const;
151 * @copydoc Dali::CanvasRenderer::Shape::SetStrokeJoin()
153 virtual bool SetStrokeJoin(Dali::CanvasRenderer::Shape::StrokeJoin join);
156 * @copydoc Dali::CanvasRenderer::Shape::GetStrokeJoin()
158 virtual Dali::CanvasRenderer::Shape::StrokeJoin GetStrokeJoin() const;
160 Shape(const Shape&) = delete;
161 Shape& operator=(Shape&) = delete;
162 Shape(Shape&&) = delete;
163 Shape& operator=(Shape&&) = delete;
166 } // namespace Adaptor
168 } // namespace Internal
170 inline static Internal::Adaptor::Shape& GetImplementation(Dali::CanvasRenderer::Shape& shape)
172 DALI_ASSERT_ALWAYS(shape && "Shape handle is empty.");
174 BaseObject& handle = shape.GetBaseObject();
176 return static_cast<Internal::Adaptor::Shape&>(handle);
179 inline static const Internal::Adaptor::Shape& GetImplementation(const Dali::CanvasRenderer::Shape& shape)
181 DALI_ASSERT_ALWAYS(shape && "Shape handle is empty.");
183 const BaseObject& handle = shape.GetBaseObject();
185 return static_cast<const Internal::Adaptor::Shape&>(handle);
190 #endif // DALI_INTERNAL_SHAPE_IMPL_H