Add BORDER_SIZE property to ImageVisual
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / visuals / visual-properties-devel.h
1 #ifndef DALI_TOOLKIT_DEVEL_API_VISUALS_VISUAL_PROPERTIES_DEVEL_H
2 #define DALI_TOOLKIT_DEVEL_API_VISUALS_VISUAL_PROPERTIES_DEVEL_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/visuals/visual-properties.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 namespace DevelVisual
31 {
32
33 /**
34  * @brief All the visual types.
35  */
36 enum Type
37 {
38   BORDER         = Dali::Toolkit::Visual::BORDER,
39   COLOR          = Dali::Toolkit::Visual::COLOR,
40   GRADIENT       = Dali::Toolkit::Visual::GRADIENT,
41   IMAGE          = Dali::Toolkit::Visual::IMAGE,
42   MESH           = Dali::Toolkit::Visual::MESH,
43   PRIMITIVE      = Dali::Toolkit::Visual::PRIMITIVE,
44   WIREFRAME      = Dali::Toolkit::Visual::WIREFRAME,
45
46   TEXT           = WIREFRAME + 1, ///< Renders text.
47   N_PATCH        = WIREFRAME + 2, ///< Renders an n-patch image.
48   SVG            = WIREFRAME + 3, ///< Renders an SVG image.
49   ANIMATED_IMAGE = WIREFRAME + 4  ///< Renders a animated image.
50 };
51
52 namespace Property
53 {
54
55 enum Type
56 {
57   TYPE   = Dali::Toolkit::Visual::Property::TYPE,
58   SHADER = Dali::Toolkit::Visual::Property::SHADER,
59
60   /**
61    * @brief The transform used by the visual.
62    * @details Name "transform", type Property::Map.
63    *
64    * @note Optional.
65    * @see DevelVisual::Transform::Property
66    */
67   TRANSFORM = SHADER + 1,
68
69   /**
70    * @brief Enables/disables premultiplied alpha.
71    * The premultiplied alpha is false by default unless this behaviour is modified
72    * by the derived Visual type.
73    *
74    * @details Name "premultipliedAlpha", type Property::Boolean.
75    *
76    * @note Optional.
77    */
78   PREMULTIPLIED_ALPHA = SHADER + 2,
79
80   /**
81    * @brief Mix color is a blend color for any visual.
82    * @details Name "mixColor", type Property::VECTOR3 or Property::VECTOR4
83    *
84    * @note Optional
85    */
86   MIX_COLOR = SHADER + 3,
87
88   /**
89    * @brief Opacity is the alpha component of the mixColor, above.
90    * @details Name "opacity", type Property::FLOAT
91    *
92    * @note Optional
93    */
94   OPACITY = SHADER + 4
95 };
96
97 } // namespace Property
98
99 namespace Transform
100 {
101
102 /**
103  * @brief Policies used by the transform for the offset or size.
104  */
105 namespace Policy
106 {
107
108 enum Type
109 {
110   RELATIVE = 0,   ///< Relative to the control (percentage [0.0f to 1.0f] of the control).
111   ABSOLUTE = 1    ///< Absolute value in world units.
112 };
113
114 } // namespace Policy
115
116 namespace Property
117 {
118
119 enum Type
120 {
121   /**
122    * @brief Offset of the visual, which can be either relative (percentage [0.0f to 1.0f] of the parent) or absolute (in world units).
123    * @details Name "offset", type Property::VECTOR2
124    * @see OFFSET_POLICY
125    */
126   OFFSET,
127
128   /**
129    * @brief Size of the visual, which can be either relative (percentage [0.0f to 1.0f] of the parent) or absolute (in world units).
130    * @details Name "size", type Property::VECTOR2
131    * @see SIZE_POLICY
132    */
133   SIZE,
134
135   /**
136    * @brief The origin of the visual within its control area.
137    * @details Name "origin", type Align::Type (Property::INTEGER) or Property::STRING.
138    * @see Toolkit::Align
139    */
140   ORIGIN,
141
142   /**
143    * @brief The anchor-point of the visual
144    * @details Name "anchorPoint", type Align::Type (Property::INTEGER) or Property::STRING.
145    * @see Toolkit::Align
146    */
147   ANCHOR_POINT,
148
149   /**
150    * @brief Whether the x or y OFFSET values are relative (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
151    * @details Name "offsetPolicy", type Vector2 or Property::ARRAY of Property::STRING.
152    *          If Property::ARRAY then 2 strings expected for the x and y.
153    *
154    * C++:
155    * @code
156    * control.SetProperty( ..., // Some visual based property
157    *                      Property::Map().Add( ... ) // Properties to set up visual
158    *                                     .Add( DevelVisual::Property::TRANSFORM,
159    *                                           Property::Array().Add( DevelVisual::Transform::Property::OFFSET_POLICY, Vector2( Policy::ABSOLUTE, Policy::RELATIVE ) ) )
160    *                                                            .Add( DevelVisual::Transform::Property::OFFSET, Vector2( 10, 1.0f ) ) );
161    * @endcode
162    *
163    * JSON:
164    * @code
165    * {
166    *   ...
167    *   "transition":
168    *   {
169    *     "offsetPolicy" : [ "ABSOLUTE", "RELATIVE" ],
170    *     "offset" : [ 10, 1.0 ]
171    *   }
172    *   ...
173    * }
174    *
175    * @endcode
176    * @see Policy::Type
177    * @note By default, both the x and the y offset is RELATIVE.
178    */
179   OFFSET_POLICY,
180
181   /**
182    * @brief Whether the width or height SIZE values are relative (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
183    * @details Name "sizePolicy", type Vector2 or Property::ARRAY of Property::STRING.
184    *          If Property::ARRAY then 2 strings expected for the width and height.
185    *
186    * @see Policy::Type
187    * @see OFFSET_POLICY for example
188    * @note By default, both the width and the height is RELATIVE to the control's size.
189    */
190   SIZE_POLICY,
191 };
192
193 } // namespace Property
194
195 } // namespace Transform
196
197 } // namespace DevelVisual
198
199 } // namespace Toolkit
200
201 } // namespace Dali
202
203 #endif // DALI_TOOLKIT_DEVEL_API_VISUALS_VISUAL_PROPERTIES_DEVEL_H