[dali_2.3.20] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / visuals / gradient-visual-properties.h
1 #ifndef DALI_TOOLKIT_GRADIENT_VISUAL_PROPERTIES_H
2 #define DALI_TOOLKIT_GRADIENT_VISUAL_PROPERTIES_H
3
4 /*
5  * Copyright (c) 2020 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 // INTERNAL INCLUDES
22 #include <dali-toolkit/public-api/toolkit-property-index-ranges.h>
23
24 namespace Dali
25 {
26 namespace Toolkit
27 {
28 /**
29  * @addtogroup dali_toolkit_visuals
30  * @{
31  */
32
33 /**
34  * @brief GradientVisual is to render a smooth transition of colors to the control's quad.
35  * @SINCE_1_1.45
36  */
37 namespace GradientVisual
38 {
39 /**
40  * @brief GradientVisual Property.
41  * @SINCE_1_1.45
42  */
43 namespace Property
44 {
45 /**
46  * @brief Enumeration for the instance of properties belonging to the GradientVisual.
47  * @SINCE_1_1.45
48  */
49 enum
50 {
51   /**
52    * @brief The start position of a linear gradient.
53    * @details Name "startPosition", type Property::VECTOR2.
54    * Gradient is drawn in a rectangular area, TopLeft is (-0.5, -0.5) and BottomRight is (0.5, 0.5).
55    * The outside of the entered Start Position and End Position is extended to the value of the border.
56    * Even if the range between Start Position and End Position is greater than (-0.5, -0.5) to (0.5, 0.5),
57    * only the corresponding area is drawn.
58    * @SINCE_1_1.45
59    * @note Mandatory for Linear.
60    */
61   START_POSITION = VISUAL_PROPERTY_START_INDEX,
62
63   /**
64    * @brief The end position of a linear gradient.
65    * @details Name "endPosition", type Property::VECTOR2.
66    * Gradient is drawn in a rectangular area, TopLeft is (-0.5, -0.5) and BottomRight is (0.5, 0.5).
67    * The outside of the entered Start Position and End Position is extended to the value of the border.
68    * Even if the range between Start Position and End Position is greater than (-0.5, -0.5) to (0.5, 0.5),
69    * only the corresponding area is drawn.
70    * @SINCE_1_1.45
71    * @note Mandatory for Linear.
72    */
73   END_POSITION,
74
75   /**
76    * @brief The center point of a radial gradient.
77    * @details Name "center", type Property::VECTOR2.
78    * @SINCE_1_1.45
79    * @note Mandatory for Radial.
80    */
81   CENTER,
82
83   /**
84    * @brief The size of the radius of a radial gradient.
85    * @details Name "radius", type Property::FLOAT.
86    * @SINCE_1_1.45
87    * @note Mandatory for Radial.
88    */
89   RADIUS,
90
91   /**
92    * @brief All the stop offsets.
93    * @details Name "stopOffset", type Property::ARRAY of Property::FLOAT.
94    * @SINCE_1_1.45
95    * @note Optional. If not supplied, default is 0.0 and 1.0.
96    */
97   STOP_OFFSET,
98
99   /**
100    * @brief The color at the stop offsets.
101    * @details Name "stopColor", type Property::ARRAY of Property::VECTOR4.
102    * @SINCE_1_1.45
103    * @note Mandatory. At least 2 values required to show a gradient.
104    */
105   STOP_COLOR,
106
107   /**
108    * @brief Defines the coordinate system for certain attributes of the points in a gradient.
109    * @details Name "units", type Units::Type (Property::INTEGER) or Property::STRING.
110    * @SINCE_1_1.45
111    * @note Optional. If not supplied, default is Units::OBJECT_BOUNDING_BOX.
112    * @see Units::Type
113    */
114   UNITS,
115
116   /**
117    * @brief Indicates what happens if the gradient starts or ends inside the bounds of the target rectangle.
118    * @details Name "spreadMethod", type SpreadMethod::Type (Property::INTEGER) or Property::STRING.
119    * @SINCE_1_1.45
120    * @note Optional. If not supplied, default is SpreadMethod::PAD.
121    * @see SpreadMethod::Type
122    */
123   SPREAD_METHOD
124 };
125
126 } // namespace Property
127
128 /**
129  * @brief The type of coordinate system for certain attributes of the points in a gradient.
130  *
131  * This applies to the:
132  * - Start (x1, y1) and End (x2 and y2) points of a line if using a linear gradient.
133  * - Center point (cx, cy) and radius (r) of a circle if using a radial gradient.
134  * @SINCE_1_1.45
135  */
136 namespace Units
137 {
138 /**
139  * @brief The type of coordinate system for certain attributes of the points in a gradient.
140  *
141  * This applies to the:
142  * - Start (x1, y1) and End (x2 and y2) points of a line if using a linear gradient.
143  * - Center point (cx, cy) and radius (r) of a circle if using a radial gradient.
144  * @SINCE_1_1.45
145  */
146 enum Type
147 {
148   OBJECT_BOUNDING_BOX, ///< Uses the normals for the start, end & center points, i.e. top-left is (-0.5, -0.5) and bottom-right is (0.5, 0.5). @SINCE_1_1.45
149   USER_SPACE           ///< Uses the user coordinates for the start, end & center points, i.e. in a 200 by 200 control, top-left is (0, 0) and bottom-right is (200, 200). @SINCE_1_1.45
150 };
151
152 } // namespace Units
153
154 /**
155  * @brief Policies that define what happens if the gradient starts or ends inside the bounds of the target rectangle.
156  * @SINCE_1_1.45
157  */
158 namespace SpreadMethod
159 {
160 /**
161  * @brief Policies that define what happens if the gradient starts or ends inside the bounds of the target rectangle.
162  * @SINCE_1_1.45
163  */
164 enum Type
165 {
166   PAD,     ///< Uses the terminal colors of the gradient to fill the remainder of the quad. @SINCE_1_1.45
167   REFLECT, ///< Reflect the gradient pattern start-to-end, end-to-start, start-to-end etc. until the quad is filled. @SINCE_1_1.45
168   REPEAT   ///< Repeat the gradient pattern start-to-end, start-to-end, start-to-end etc. until the quad is filled. @SINCE_1_1.45
169 };
170
171 } // namespace SpreadMethod
172
173 } // namespace GradientVisual
174
175 /**
176  * @}
177  */
178
179 } // namespace Toolkit
180
181 } // namespace Dali
182
183 #endif // DALI_TOOLKIT_GRADIENT_VISUAL_PROPERTIES_H