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.
25 #include <dali/public-api/object/base-object.h>
26 #include <dali/public-api/signals/connection-tracker.h>
29 #include <dali/devel-api/adaptor-framework/canvas-renderer-shape.h>
30 #include <dali/internal/canvas-renderer/common/drawable-impl.h>
39 * Dali internal Shape.
41 class Shape : public Internal::Adaptor::Drawable
55 * @copydoc Dali::CanvasRenderer::Shape::AddRect
57 virtual bool AddRect(Rect<float> rect, Vector2 roundedCorner);
60 * @copydoc Dali::CanvasRenderer::Shape::AddCircle
62 virtual bool AddCircle(Vector2 center, Vector2 radius);
65 * @copydoc Dali::CanvasRenderer::Shape::AddArc
67 virtual bool AddArc(Vector2 center, float radius, float startAngle, float sweep, bool pie);
70 * @copydoc Dali::CanvasRenderer::Shape::AddMoveTo
72 virtual bool AddMoveTo(Vector2 point);
75 * @copydoc Dali::CanvasRenderer::Shape::AddLineTo
77 virtual bool AddLineTo(Vector2 line);
80 * @copydoc Dali::CanvasRenderer::Shape::AddCubicTo
82 virtual bool AddCubicTo(Vector2 controlPoint1, Vector2 controlPoint2, Vector2 endPoint);
85 * @copydoc Dali::CanvasRenderer::Shape::AddClose
90 * @copydoc Dali::CanvasRenderer::Shape::SetFillColor
92 virtual bool SetFillColor(Vector4 color);
95 * @copydoc Dali::CanvasRenderer::Shape::GetFillColor
97 virtual Vector4 GetFillColor() const;
100 * @copydoc Dali::CanvasRenderer::Shape::SetFillRule
102 virtual bool SetFillRule(Dali::CanvasRenderer::Shape::FillRule rule);
105 * @copydoc Dali::CanvasRenderer::Shape::GetFillRule
107 virtual Dali::CanvasRenderer::Shape::FillRule GetFillRule() const;
110 * @copydoc Dali::CanvasRenderer::Shape::SetStrokeWidth
112 virtual bool SetStrokeWidth(float width);
115 * @copydoc Dali::CanvasRenderer::Shape::GetStrokeWidth
117 virtual float GetStrokeWidth() const;
120 * @copydoc Dali::CanvasRenderer::Shape::SetStrokeColor
122 virtual bool SetStrokeColor(Vector4 color);
125 * @copydoc Dali::CanvasRenderer::Shape::GetStrokeColor
127 virtual Vector4 GetStrokeColor() const;
130 * @copydoc Dali::CanvasRenderer::Shape::SetStrokeDash
132 virtual bool SetStrokeDash(const Dali::Vector<float> dashPattern);
135 * @copydoc Dali::CanvasRenderer::Shape::GetStrokeDash
137 virtual Dali::Vector<float> GetStrokeDash() const;
140 * @copydoc Dali::CanvasRenderer::Shape::SetStrokeCap
142 virtual bool SetStrokeCap(Dali::CanvasRenderer::Shape::StrokeCap cap);
145 * @copydoc Dali::CanvasRenderer::Shape::GetStrokeCap
147 virtual Dali::CanvasRenderer::Shape::StrokeCap GetStrokeCap() const;
150 * @copydoc Dali::CanvasRenderer::Shape::SetStrokeJoin
152 virtual bool SetStrokeJoin(Dali::CanvasRenderer::Shape::StrokeJoin join);
155 * @copydoc Dali::CanvasRenderer::Shape::GetStrokeJoin
157 virtual Dali::CanvasRenderer::Shape::StrokeJoin GetStrokeJoin() const;
159 Shape(const Shape&) = delete;
160 Shape& operator=(Shape&) = delete;
161 Shape(Shape&&) = delete;
162 Shape& operator=(Shape&&) = delete;
165 } // namespace Adaptor
167 } // namespace Internal
169 inline static Internal::Adaptor::Shape& GetImplementation(Dali::CanvasRenderer::Shape& shape)
171 DALI_ASSERT_ALWAYS(shape && "Shape handle is empty.");
173 BaseObject& handle = shape.GetBaseObject();
175 return static_cast<Internal::Adaptor::Shape&>(handle);
178 inline static const Internal::Adaptor::Shape& GetImplementation(const Dali::CanvasRenderer::Shape& shape)
180 DALI_ASSERT_ALWAYS(shape && "Shape handle is empty.");
182 const BaseObject& handle = shape.GetBaseObject();
184 return static_cast<const Internal::Adaptor::Shape&>(handle);
189 #endif // DALI_INTERNAL_SHAPE_IMPL_H