Merge "DALi Version 2.0.38" into devel/master
[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) 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 // INTERNAL INCLUDES
22 #include <dali-toolkit/public-api/visuals/visual-properties.h>
23
24 namespace Dali
25 {
26 namespace Toolkit
27 {
28 namespace DevelVisual
29 {
30 /**
31  * @brief All the visual types.
32  */
33 enum Type
34 {
35   BORDER         = Dali::Toolkit::Visual::BORDER,
36   COLOR          = Dali::Toolkit::Visual::COLOR,
37   GRADIENT       = Dali::Toolkit::Visual::GRADIENT,
38   IMAGE          = Dali::Toolkit::Visual::IMAGE,
39   MESH           = Dali::Toolkit::Visual::MESH,
40   PRIMITIVE      = Dali::Toolkit::Visual::PRIMITIVE,
41   WIREFRAME      = Dali::Toolkit::Visual::WIREFRAME,
42   TEXT           = Dali::Toolkit::Visual::TEXT,
43   N_PATCH        = Dali::Toolkit::Visual::N_PATCH,
44   SVG            = Dali::Toolkit::Visual::SVG,
45   ANIMATED_IMAGE = Dali::Toolkit::Visual::ANIMATED_IMAGE,
46
47   ANIMATED_GRADIENT     = ANIMATED_IMAGE + 1, ///< Renders an animated gradient.
48   ANIMATED_VECTOR_IMAGE = ANIMATED_IMAGE + 2, ///< Renders an animated vector image.
49   ARC                   = ANIMATED_IMAGE + 3, ///< Renders an arc.
50 };
51
52 /**
53  * @brief Visual Properties
54  */
55 namespace Property
56 {
57 enum Type
58 {
59   TYPE                = Dali::Toolkit::Visual::Property::TYPE,
60   SHADER              = Dali::Toolkit::Visual::Property::SHADER,
61   TRANSFORM           = Dali::Toolkit::Visual::Property::TRANSFORM,
62   PREMULTIPLIED_ALPHA = Dali::Toolkit::Visual::Property::PREMULTIPLIED_ALPHA,
63   MIX_COLOR           = Dali::Toolkit::Visual::Property::MIX_COLOR,
64   OPACITY             = Dali::Toolkit::Visual::Property::OPACITY,
65
66   /**
67    * @brief The fitting mode of the visual
68    * @details Name "fittingMode", type FittingMode (Property::INTEGER) or Property::STRING.
69    * @see DevelVisual::FittingMode
70    * @note The default is defined by the type of visual (if it's suitable to be stretched or not).
71    */
72   VISUAL_FITTING_MODE = OPACITY + 1,
73
74   /**
75    * @brief The radius for the rounded corners of the visual
76    * @details Name "cornerRadius", type Property::FLOAT or Prooperty::VECTOR4, animatable
77    * @note By default, it is Vector::ZERO.
78    * @note Only Property::Vector4 can be animated.
79    * @note Each radius will clamp internally to the half of smaller of the visual width and visual height.
80    * @note Their may exist some alias when you use it as ClippingMode::CLIP_CHILDREN
81    * @note Radius value are used in clockwise order from top-left-corner to bottom-left-corner.
82    *       When radius is Vector4(x, y, z, w)
83    *       x    y
84    *        +--+
85    *        |  |
86    *        +--+
87    *       w    z
88    */
89   CORNER_RADIUS = OPACITY + 2,
90
91   /**
92    * @brief Whether the corner radius value is relative (percentage [0.0f to 1.0f] of the visual size) or absolute (in world units).
93    * @details Name "cornerRadiusPolicy", type Property::INTEGER.
94    * @see Policy::Type
95    * @note By default, it is ABSOLUTE to the visual's size.
96    *       If it it RELATIVE, the corner radius value is relative to the smaller of the visual width and visual height.
97    */
98   CORNER_RADIUS_POLICY = OPACITY + 3,
99
100   /**
101    * @brief The width for the borderline of the visual
102    * @details Name "borderlineWidth", type Property::FLOAT, animatable
103    * @note Optional. Default value is 0.0f.
104    */
105   BORDERLINE_WIDTH = OPACITY + 4,
106
107   /**
108    * @brief The color for the borderline of the visual
109    * @details Name "borderlineColor", type Property::VECTOR4, animatable
110    * @note Default value is Color::BLACK
111    */
112   BORDERLINE_COLOR = OPACITY + 5,
113
114   /**
115    * @brief The offset from the visual borderline (recommend [-1.0f to 1.0f]).
116    * @details Name "borderlineOffset", type Property::FLOAT, animatable
117    * @note Default value is 0.0f.
118    * @note This value will clamp internally to [-1.0f to 1.0f].
119    */
120   BORDERLINE_OFFSET = OPACITY + 6,
121 };
122
123 } // namespace Property
124
125 /**
126  * @brief The values of this enum determine how the visual should be fit to the view
127  */
128 enum FittingMode
129 {
130   FIT_KEEP_ASPECT_RATIO,      ///< The visual should be scaled to fit, preserving aspect ratio
131   FILL,                       ///< The visual should be stretched to fill, not preserving aspect ratio
132   OVER_FIT_KEEP_ASPECT_RATIO, ///< The visual should be scaled to fit, preserving aspect ratio. The visual will be filled without empty area, and outside is cropped away.
133   CENTER,                     ///< The visual should keep original size of image. It is not scaled and not strecthed.
134   FIT_HEIGHT,                 ///< The visual should be scaled to fit, preserving aspect ratio. Height is scaled proportionately to maintain aspect ratio. It will be deprecated.
135   FIT_WIDTH                   ///< The visual should be scaled to fit, preserving aspect ratio. Width is scaled proportionately to maintain aspect ratio. It will be deprecated.
136 };
137
138 /**
139  * @brief Devel Visual Transform for the offset or size.
140  */
141 namespace Transform
142 {
143 /**
144  * @brief Visual Transform Property.
145  */
146 namespace Property
147 {
148 /**
149  * @brief Enumeration for the type of Transform Property.
150  */
151 enum Type
152 {
153   SIZE_POLICY = Dali::Toolkit::Visual::Transform::Property::SIZE_POLICY,
154
155   /**
156    * @brief Extra size value that will be added to the computed visual size.
157    * @details Name "extraSize", type Vector2.
158    *
159    * @note It is an absolute value.
160    *       The property can be used when a user want to set a visual size as a combined value of `relative` and `absolute`.
161    *       For example, when a user want to set a visual size to (ControlSize * 2 + 10),
162    *       The transform map will be,
163    *       transformMap.Add( Transform::Property::SIZE, Vector2( 2.0f, 2.0f ) )
164    *                   .Add( Transform::Property::SIZE_POLICY, Vector2( Transform::Policy::Relative, Transform::Policy::Relative ) )
165    *                   .Add( Transform::Property::EXTRA_SIZE, Vector2( 10.0f, 10.0f ) );
166    */
167   EXTRA_SIZE = SIZE_POLICY + 1,
168 };
169
170 } // namespace Property
171
172 } // namespace Transform
173
174 } // namespace DevelVisual
175
176 } // namespace Toolkit
177
178 } // namespace Dali
179
180 #endif // DALI_TOOLKIT_DEVEL_API_VISUALS_VISUAL_PROPERTIES_DEVEL_H