Reduce LOC of gles-graphics-types.h
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / canvas-renderer-linear-gradient.h
1 #ifndef DALI_CANVAS_RENDERER_LINEAR_GRADIENT_H
2 #define DALI_CANVAS_RENDERER_LINEAR_GRADIENT_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 #include <dali/public-api/object/base-handle.h>
23
24 // INTERNAL INCLUDES
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>
28
29 namespace Dali
30 {
31 /**
32  * @addtogroup dali_adaptor_framework
33  * @{
34  */
35
36 namespace Internal DALI_INTERNAL
37 {
38 namespace Adaptor
39 {
40 class CanvasRenderer;
41 class LinearGradient;
42 } // namespace Adaptor
43 } // namespace DALI_INTERNAL
44
45 /**
46  * @brief A class representing the linear gradient fill of the Shape object.
47  *
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.
50  */
51 class DALI_ADAPTOR_API CanvasRenderer::LinearGradient : public CanvasRenderer::Gradient
52 {
53 public:
54   /**
55    * @brief Creates an initialized handle to a new CanvasRenderer::LinearGradient.
56    * @return A handle to a newly allocated LinearGradient
57    */
58   static LinearGradient New();
59
60 public:
61   /**
62    * @brief Creates an empty handle. Use CanvasRenderer::LinearGradient::New() to create an initialized object.
63    */
64   LinearGradient();
65
66   /**
67    * @brief Destructor.
68    */
69   ~LinearGradient();
70
71   /**
72    * @brief This copy constructor is required for (smart) pointer semantics.
73    *
74    * @param[in] handle A reference to the copied handle
75    */
76   LinearGradient(const LinearGradient& handle) = default;
77
78 public:
79   /**
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.
87    */
88   bool SetBounds(Vector2 firstPoint, Vector2 secondPoint);
89
90   /**
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.
95    */
96   bool GetBounds(Vector2& firstPoint, Vector2& secondPoint) const;
97
98 public: // Not intended for application developers
99   /// @cond internal
100   /**
101    * @brief The constructor.
102    * @note  Not intended for application developers.
103    *
104    * @param[in] pointer A pointer to a newly allocated CanvasRenderer::LinearGradient
105    */
106   explicit DALI_INTERNAL LinearGradient(Internal::Adaptor::LinearGradient* impl);
107   /// @endcond
108 };
109
110 /**
111  * @}
112  */
113 } // namespace Dali
114
115 #endif // DALI_CANVAS_RENDERER_LINEAR_GRADIENT_H