1 #ifndef DALI_CANVAS_RENDERER_LINEAR_GRADIENT_H
2 #define DALI_CANVAS_RENDERER_LINEAR_GRADIENT_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-handle.h>
25 #include <dali/devel-api/adaptor-framework/canvas-renderer-gradient.h>
26 #include <dali/devel-api/adaptor-framework/canvas-renderer.h>
27 #include <dali/public-api/dali-adaptor-common.h>
32 * @addtogroup dali_adaptor_framework
36 namespace Internal DALI_INTERNAL
42 } // namespace Adaptor
43 } // namespace DALI_INTERNAL
46 * @brief A class representing the linear gradient fill of the Shape object.
48 * Besides the class inherited from the Gradient class, it enables setting and getting the linear gradient bounds.
49 * The behavior outside the gradient bounds depends on the value specified in the spread API.
51 class DALI_ADAPTOR_API CanvasRenderer::LinearGradient : public CanvasRenderer::Gradient
55 * @brief Creates an initialized handle to a new CanvasRenderer::LinearGradient.
56 * @return A handle to a newly allocated LinearGradient
58 static LinearGradient New();
62 * @brief Creates an empty handle. Use CanvasRenderer::LinearGradient::New() to create an initialized object.
72 * @brief This copy constructor is required for (smart) pointer semantics.
74 * @param[in] handle A reference to the copied handle
76 LinearGradient(const LinearGradient& handle) = default;
80 * @brief Sets the linear gradient bounds.
81 * The bounds of the linear gradient are defined as a surface constrained by two parallel lines crossing
82 * the given points (@p x1, @p y1) and (@p x2, @p y2), respectively. Both lines are perpendicular to the line linking
83 * (@p x1, @p y1) and (@p x2, @p y2).
84 * @param[in] firstPoint The first point used to determine the gradient bounds.
85 * @param[in] secondPoint The second point used to determine the gradient bounds.
86 * @return Returns True when it's successful. False otherwise.
88 bool SetBounds(Vector2 firstPoint, Vector2 secondPoint);
91 * @brief Gets the linear gradient bounds.
92 * @param[out] firstPoint The first point used to determine the gradient bounds.
93 * @param[out] secondPoint The second point used to determine the gradient bounds.
94 * @return Returns True when it's successful. False otherwise.
96 bool GetBounds(Vector2& firstPoint, Vector2& secondPoint) const;
98 public: // Not intended for application developers
101 * @brief The constructor.
102 * @note Not intended for application developers.
104 * @param[in] pointer A pointer to a newly allocated CanvasRenderer::LinearGradient
106 explicit DALI_INTERNAL LinearGradient(Internal::Adaptor::LinearGradient* impl);
115 #endif // DALI_CANVAS_RENDERER_LINEAR_GRADIENT_H