Update doxygen comments
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / visuals / visual-properties.h
1 #ifndef DALI_TOOLKIT_VISUAL_PROPERTIES_H
2 #define DALI_TOOLKIT_VISUAL_PROPERTIES_H
3
4 /*
5  * Copyright (c) 2017 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
27 namespace Toolkit
28 {
29
30 /**
31  * @addtogroup dali_toolkit_visuals
32  * @{
33  */
34
35 /**
36  * @brief All the visual types.
37  * @SINCE_1_1.45
38  */
39 namespace Visual
40 {
41
42 /**
43  * @brief All the visual types.
44  * @SINCE_1_1.45
45  */
46 enum Type
47 {
48   BORDER,           ///< Renders a solid color as an internal border to the control's quad. @SINCE_1_1.45
49   COLOR,            ///< Renders a solid color to the control's quad. @SINCE_1_1.45
50   GRADIENT,         ///< Renders a smooth transition of colors to the control's quad. @SINCE_1_1.45
51   IMAGE,            ///< Renders an image into the control's quad. @SINCE_1_1.45
52   MESH,             ///< Renders a mesh using an "obj" file, optionally with textures provided by an "mtl" file. @SINCE_1_1.45
53   PRIMITIVE,        ///< Renders a simple 3D shape, such as a cube or sphere. @SINCE_1_1.45
54   WIREFRAME,        ///< Renders a simple wire-frame outlining a quad. @SINCE_1_2_2
55   TEXT,             ///< Renders text @SINCE_1_2.60
56   N_PATCH,          ///< Renders an n-patch image. @SINCE_1_2.60
57   SVG,              ///< Renders an SVG image. @SINCE_1_2.60
58   ANIMATED_IMAGE,   ///< Renders a animated image. @SINCE_1_2.60
59 };
60
61 /**
62  * @brief Visual Property.
63  * @SINCE_1_1.45
64  */
65 namespace Property
66 {
67
68 /**
69  * @brief Enumeration for the instance of properties belonging to the Visual Property.
70  * @SINCE_1_1.45
71  */
72 enum
73 {
74   /**
75    * @brief The index for the visual type.
76    * @details Name "visualType", type [Type](@ref Dali::Toolkit::Visual::Type) (Property::INTEGER) or Property::STRING.
77    * @SINCE_1_1.45
78    * @note Mandatory.
79    * @see Type
80    */
81   TYPE = VISUAL_PROPERTY_BASE_START_INDEX,
82
83   /**
84    * @brief The shader to use in the visual.
85    * @details Name "shader", type Property::MAP.
86    * @SINCE_1_1.45
87    * @note Optional.
88    * @note Will override the existing shaders.
89    * @see Shader::Property
90    */
91   SHADER,
92
93   /**
94    * @brief The transform used by the visual.
95    * @details Name "transform", type Property::MAP.
96    * @SINCE_1_2.60
97    * @note Optional.
98    * @see Toolkit::Visual::Transform::Property
99    */
100   TRANSFORM,
101
102   /**
103    * @brief Enables/disables premultiplied alpha.
104    * @details Name "premultipliedAlpha", type Property::BOOLEAN.
105    * @SINCE_1_2.60
106    * @note Optional.
107    * @note The premultiplied alpha is false by default unless this behaviour is modified
108    * by the derived Visual type.
109    */
110   PREMULTIPLIED_ALPHA,
111
112   /**
113    * @brief Mix color is a blend color for any visual.
114    * @details Name "mixColor", type Property::VECTOR3 or Property::VECTOR4.
115    * @SINCE_1_2.60
116    * @note Optional
117    */
118   MIX_COLOR,
119
120   /**
121    * @brief Opacity is the alpha component of the mixColor, above.
122    * @details Name "opacity", type Property::FLOAT.
123    * @SINCE_1_2.60
124    * @note Optional
125    */
126   OPACITY,
127 };
128
129 } // namespace Property
130
131 /**
132  * @brief Visual Transfrom for the offset or size.
133  * @SINCE_1_2.60
134  */
135 namespace Transform
136 {
137
138 /**
139  * @brief Policies used by the transform for the offset or size.
140  * @SINCE_1_2.60
141  */
142 namespace Policy
143 {
144
145 /**
146  * @brief Enumeration for the type of Transform Policy.
147  * @SINCE_1_2.60
148  */
149 enum Type
150 {
151   RELATIVE = 0,   ///< Relative to the control (percentage [0.0f to 1.0f] of the control). @SINCE_1_2.60
152   ABSOLUTE = 1    ///< Absolute value in world units. @SINCE_1_2.60
153 };
154
155 } // namespace Policy
156
157 /**
158  * @brief Visual Transform Property.
159  * @SINCE_1_2.60
160  */
161 namespace Property
162 {
163
164 /**
165  * @brief Enumeration for the type of Transfrom Property.
166  * @SINCE_1_2.60
167  */
168 enum Type
169 {
170   /**
171    * @brief Offset of the visual, which can be either relative (percentage [0.0f to 1.0f] of the parent) or absolute (in world units).
172    * @details Name "offset", type Property::VECTOR2.
173    * @SINCE_1_2.60
174    *
175    * @see OFFSET_POLICY
176    */
177   OFFSET,
178
179   /**
180    * @brief Size of the visual, which can be either relative (percentage [0.0f to 1.0f] of the parent) or absolute (in world units).
181    * @details Name "size", type Property::VECTOR2.
182    * @see SIZE_POLICY
183    */
184   SIZE,
185
186   /**
187    * @brief The origin of the visual within its control area.
188    * @details Name "origin", type Align::Type (Property::INTEGER) or Property::STRING.
189    * @see Toolkit::Align
190    * @SINCE_1_2.60
191    * @note The default is Align::TOP_BEGIN.
192    */
193   ORIGIN,
194
195   /**
196    * @brief The anchor-point of the visual
197    * @details Name "anchorPoint", type Align::Type (Property::INTEGER) or Property::STRING.
198    * @see Toolkit::Align
199    * @SINCE_1_2.60
200    * @note The default is Align::TOP_BEGIN.
201    */
202   ANCHOR_POINT,
203
204   /**
205    * @brief Whether the x or y OFFSET values are relative (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
206    * @details Name "offsetPolicy", type Vector2 or Property::ARRAY of Property::STRING.
207    *          If Property::ARRAY then 2 strings expected for the x and y.
208    *
209    * C++:
210    * @code
211    * control.SetProperty( ..., // Some visual based property
212    *                      Property::Map().Add( ... ) // Properties to set up visual
213    *                                     .Add( Visual::Property::TRANSFORM,
214    *                                           Property::Array().Add( Toolkit::Visual::Transform::Property::OFFSET_POLICY, Vector2( Policy::ABSOLUTE, Policy::RELATIVE ) ) )
215    *                                                            .Add( Toolkit::Visual::Transform::Property::OFFSET, Vector2( 10, 1.0f ) ) );
216    * @endcode
217    *
218    * JSON:
219    * @code
220    * {
221    *   ...
222    *   "transition":
223    *   {
224    *     "offsetPolicy" : [ "ABSOLUTE", "RELATIVE" ],
225    *     "offset" : [ 10, 1.0 ]
226    *   }
227    *   ...
228    * }
229    *
230    * @endcode
231    * @see Policy::Type
232    * @SINCE_1_2.60
233    * @note By default, both the x and the y offset is RELATIVE.
234    */
235   OFFSET_POLICY,
236
237   /**
238    * @brief Whether the width or height SIZE values are relative (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
239    * @details Name "sizePolicy", type Vector2 or Property::ARRAY of Property::STRING.
240    *          If Property::ARRAY then 2 strings expected for the width and height.
241    *
242    * @see Policy::Type
243    * @see OFFSET_POLICY for example
244    * @SINCE_1_2.60
245    * @note By default, both the width and the height is RELATIVE to the control's size.
246    */
247   SIZE_POLICY,
248 };
249
250 } // namespace Property
251
252 } // namespace Transform
253
254 /**
255  * @brief Shader for Visuals.
256  * @SINCE_1_1.45
257  */
258 namespace Shader
259 {
260
261 /**
262  * @brief Shader Property.
263  * @SINCE_1_1.45
264  */
265 namespace Property
266 {
267
268 /**
269  * @brief The type of Shader.
270  * @SINCE_1_1.45
271  */
272 enum
273 {
274   /**
275    * @brief The vertex shader.
276    * @details Name "vertexShader", type Property::STRING or Property::ARRAY of Property::STRING.
277    *          A Property::ARRAY of Property::STRING values can be used to split the shader string over multiple lines.
278    * @SINCE_1_1.45
279    * @note Optional
280    * @note If not supplied, the visual's already set vertex shader is used.
281    */
282   VERTEX_SHADER,
283
284   /**
285    * @brief The fragment shader.
286    * @details Name "fragmentShader", type Property::STRING or Property::ARRAY of Property::STRING.
287    *          A Property::ARRAY of Property::STRING values can be used to split the shader string over multiple lines.
288    * @SINCE_1_1.45
289    * @note Optional
290    * @note If not supplied, the visual's already set fragment shader is used.
291    */
292   FRAGMENT_SHADER,
293
294   /**
295    * @brief How to subdivide the grid along the X-Axis.
296    * @details Name "subdivideGridX", type Property::INTEGER.
297    * @SINCE_1_1.45
298    * @note Optional
299    * @note If not supplied, the default is 1.
300    * @note Value should be greater than or equal to 1.
301    */
302   SUBDIVIDE_GRID_X,
303
304   /**
305    * @brief How to subdivide the grid along the Y-Axis.
306    * @details Name "subdivideGridY", type Property::INTEGER.
307    * @SINCE_1_1.45
308    * @note Optional
309    * @note If not supplied, the default is 1.
310    * @note Value should be greater than or equal to 1.
311    */
312   SUBDIVIDE_GRID_Y,
313
314   /**
315    * @brief Hints for rendering.
316    * @details Name "hints", type Dali::Shader::Hint (Property::INTEGER), Property::STRING or Property::ARRAY of Property::STRING.
317    * @SINCE_1_1.45
318    * @note Optional
319    * @note If not supplied, the default is Dali::Shader::Hint::NONE.
320    */
321   HINTS,
322 };
323
324 } // namespace Property
325
326 } // namespace Shader
327
328 } // namespace Visual
329
330 /**
331  * @}
332  */
333
334 } // namespace Toolkit
335
336 } // namespace Dali
337
338 #endif // DALI_TOOLKIT_VISUAL_PROPERTIES_H