[dali_2.3.20] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / visuals / image-visual-properties-devel.h
1 #ifndef DALI_TOOLKIT_DEVEL_API_VISUALS_IMAGE_VISUAL_PROPERTIES_DEVEL_H
2 #define DALI_TOOLKIT_DEVEL_API_VISUALS_IMAGE_VISUAL_PROPERTIES_DEVEL_H
3
4 /*
5  * Copyright (c) 2024 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/image-visual-properties.h>
23
24 namespace Dali
25 {
26 namespace Toolkit
27 {
28 namespace DevelImageVisual
29 {
30 namespace Property
31 {
32 enum Type
33 {
34   URL                    = Dali::Toolkit::ImageVisual::Property::URL,
35   FITTING_MODE           = Dali::Toolkit::ImageVisual::Property::FITTING_MODE,
36   SAMPLING_MODE          = Dali::Toolkit::ImageVisual::Property::SAMPLING_MODE,
37   DESIRED_WIDTH          = Dali::Toolkit::ImageVisual::Property::DESIRED_WIDTH,
38   DESIRED_HEIGHT         = Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT,
39   SYNCHRONOUS_LOADING    = Dali::Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING,
40   BORDER_ONLY            = Dali::Toolkit::ImageVisual::Property::BORDER_ONLY,
41   PIXEL_AREA             = Dali::Toolkit::ImageVisual::Property::PIXEL_AREA,
42   WRAP_MODE_U            = Dali::Toolkit::ImageVisual::Property::WRAP_MODE_U,
43   WRAP_MODE_V            = Dali::Toolkit::ImageVisual::Property::WRAP_MODE_V,
44   BORDER                 = Dali::Toolkit::ImageVisual::Property::BORDER,
45   ATLASING               = Dali::Toolkit::ImageVisual::Property::ATLASING,
46   ALPHA_MASK_URL         = Dali::Toolkit::ImageVisual::Property::ALPHA_MASK_URL,
47   BATCH_SIZE             = Dali::Toolkit::ImageVisual::Property::BATCH_SIZE,
48   CACHE_SIZE             = Dali::Toolkit::ImageVisual::Property::CACHE_SIZE,
49   FRAME_DELAY            = Dali::Toolkit::ImageVisual::Property::FRAME_DELAY,
50   MASK_CONTENT_SCALE     = Dali::Toolkit::ImageVisual::Property::MASK_CONTENT_SCALE,
51   CROP_TO_MASK           = Dali::Toolkit::ImageVisual::Property::CROP_TO_MASK,
52   LOAD_POLICY            = Dali::Toolkit::ImageVisual::Property::LOAD_POLICY,
53   RELEASE_POLICY         = Dali::Toolkit::ImageVisual::Property::RELEASE_POLICY,
54   ORIENTATION_CORRECTION = Dali::Toolkit::ImageVisual::Property::ORIENTATION_CORRECTION,
55
56   /**
57    * @brief Overlays the auxiliary image on top of an NPatch image.
58    *
59    * The resulting visual image will be at least as large as the
60    * smallest possible n-patch or the auxiliary image, whichever is
61    * larger.
62    *
63    * @details Name "auxiliaryImage", Type Property::STRING, URL of the image.
64    * @note Default true
65    */
66   AUXILIARY_IMAGE = ORIENTATION_CORRECTION + 1,
67
68   /**
69    * @brief An alpha value for mixing between the masked main NPatch image and the auxiliary image
70    * @details Name "auxiliaryImageAlpha", Type Property::FLOAT, between 0 and 1
71    * @note Default 0
72    */
73   AUXILIARY_IMAGE_ALPHA = ORIENTATION_CORRECTION + 2,
74
75   /**
76    * @brief The number of times the AnimatedImageVisual or AnimatedVectorImageVisual will be looped.
77    * @details Name "loopCount", type Property::INTEGER.
78    * @note For Animated images only. Default -1. if < 0, loop unlimited. else, loop loopCount times.
79    */
80   LOOP_COUNT = ORIENTATION_CORRECTION + 3,
81
82   /**
83    * @brief The playing range the AnimatedVectorImageVisual will use.
84    *
85    * Animation will play between the values specified. The array can have two integer values.
86    * Or it can have one or two strings, which are markers. More will be ignored.
87    * Both values should be between 0 and the total frame number, otherwise they will be ignored.
88    * If the range provided is not in proper order ( minimum, maximum ), it will be reordered.
89    *
90    * A marker has its start frame and end frame.
91    * Animation will play between the start frame and the end frame of the marker if one marker is specified.
92    * Or animation will play between the start frame of the first marker and the end frame of the second marker if two markers are specified.
93    *
94    * @details Name "playRange", Type Property::ARRAY of Property::INTEGER or Property::ARRAY of Property::STRING or Property::STRING (one marker).
95    * @note Default 0 and the total frame number.
96    */
97   PLAY_RANGE = ORIENTATION_CORRECTION + 4,
98
99   /**
100    * @brief The playing state the AnimatedVectorImageVisual will use.
101    * @details Name "playState", Type PlayState::Type (Property::INTEGER)
102    * @note This property is read-only.
103    */
104   PLAY_STATE = ORIENTATION_CORRECTION + 5,
105
106   /**
107    * @brief The current frame number the AnimatedImageVisual and AnimatedVectorImageVisual will use.
108    * @details Name "currentFrameNumber", Type Property::INTEGER, between [0, the maximum frame number] or between the play range if specified
109    * @note This property is read-only.
110    */
111   CURRENT_FRAME_NUMBER = ORIENTATION_CORRECTION + 6,
112
113   /**
114    * @brief The total frame number the AnimatedImageVisual and AnimatedVectorImageVisual will use.
115    * @details Name "totalFrameNumber", Type Property::INTEGER.
116    * @note This property is read-only.
117    */
118   TOTAL_FRAME_NUMBER = ORIENTATION_CORRECTION + 7,
119
120   /**
121    * @brief  The stop behavior the AnimatedImageVisual and AnimatedVectorImageVisual will use.
122    * @details Name "stopBehavior", Type StopBehavior::Type (Property::INTEGER)
123    * @note Default value is StopBehavior::CURRENT_FRAME.
124    */
125   STOP_BEHAVIOR = ORIENTATION_CORRECTION + 8,
126
127   /**
128    * @brief  The looping mode the AnimatedVectorImageVisual will use.
129    * @details Name "loopingMode", Type LoopingMode::Type (Property::INTEGER)
130    * @note Default value is LoopingMode::RESTART.
131    */
132   LOOPING_MODE = ORIENTATION_CORRECTION + 9,
133
134   /**
135    * @brief The content information the AnimatedVectorImageVisual will use.
136    * @details Type Property::MAP.
137    * The map contains the layer name as a key and Property::Array as a value.
138    * And the array contains 2 integer values which are the frame numbers, the start frame number and the end frame number of the layer.
139    * @note This property is read-only.
140    */
141   CONTENT_INFO = ORIENTATION_CORRECTION + 10,
142
143   /**
144    * @brief Whether to redraw the image when the visual is scaled down.
145    * @details Name "redrawInScalingDown", type Property::BOOLEAN.
146    * @note It is used in the AnimatedVectorImageVisual. The default is true.
147    */
148   REDRAW_IN_SCALING_DOWN = ORIENTATION_CORRECTION + 11,
149
150   /**
151    * @brief Whether to apply mask in loading time or rendering time.
152    * @details Name "maskingType", type PlayState::Type (Property::INTEGER).
153    * In general, MASKING_ON_LOADING is the default behavior.
154    * However, if the visual uses an external texture, only MASKING_ON_RENDERING is possible.
155    * So we change its value to MASKING_ON_RENDERING even if the visual sets the MASKING_TYPE as MASKING_ON_LOADING when it uses external texture.
156    * @note It is used in the ImageVisual and AnimatedImageVisual. The default is MASKING_ON_LOADING.
157    */
158   MASKING_TYPE = ORIENTATION_CORRECTION + 12,
159
160   /**
161    * @brief If true, uploads texture before ResourceReady signal is emitted. Otherwise uploads after texture load is completed.
162    * @details Name "fastTrackUploading", type Property::BOOLEAN
163    * If true, the upload happens without event-thread dependency, but the following need to be considered:
164    *  - Texture size is not valid until upload is fully complete.
165    *  - Texture cannot be cached (a new image is uploaded every time).
166    *  - Seamless visual change is not supported.
167    *  - The following, if set are also not supported and will be ignored:
168    *    - Alpha masking
169    *    - Synchronous loading
170    *    - Reload action
171    *    - Atlas loading
172    *    - Custom shader
173    * @note Used by the ImageVisual. The default is false.
174    */
175   FAST_TRACK_UPLOADING = ORIENTATION_CORRECTION + 13,
176
177   /**
178    * @brief Whether to enable broken image in image visual.
179    * Some of visual don't need to show broken image(ex. placeholder)
180    * Disable broken image for these visuals.
181    * default is true.
182    */
183   ENABLE_BROKEN_IMAGE = ORIENTATION_CORRECTION + 14,
184
185   /**
186    * @brief The marker information the AnimatedVectorImageVisual will use.
187    * @details Type Property::MAP.
188    * The map contains the marker name as a key and Property::Array as a value.
189    * And the array contains 2 integer values which are the frame numbers, the start frame number and the end frame number of the marker.
190    * @note This property is read-only.
191    */
192   MARKER_INFO = ORIENTATION_CORRECTION + 15,
193
194   /**
195    * @brief Whether to AnimatedVectorImageVisual fixed cache or not.
196    * @details Name "enableFrameCache", type Property::BOOLEAN.
197    * If this property is true, AnimatedVectorImageVisual enable frame cache for loading and keeps loaded frame
198    * until the visual is removed. It reduces CPU cost when the animated image will be looping.
199    * But it can spend a lot of memory if the resource has high resolution image or many frame count.
200    * @note It is used in the AnimatedVectorImageVisual. The default is false
201    */
202   ENABLE_FRAME_CACHE = ORIENTATION_CORRECTION + 16,
203
204   /**
205    * @brief Whether notify AnimatedVectorImageVisual to render thread after every rasterization or not.
206    * @details Name "notifyAfterRasterization", type Property::BOOLEAN.
207    * If this property is true, AnimatedVectorImageVisual send notify to render thread after every rasterization.
208    * If false, AnimatedVectorImageVisual set Renderer's Behaviour as Continouly (mean, always update the render thread.)
209    *
210    * This flag is useful if given resource has low fps, so we don't need to render every frame.
211    * @note It is used in the AnimatedVectorImageVisual. The default is false.
212    */
213   NOTIFY_AFTER_RASTERIZATION = ORIENTATION_CORRECTION + 17
214 };
215
216 } //namespace Property
217
218 /**
219  * @brief Enumeration for what state the animation is in.
220  */
221 namespace PlayState
222 {
223 enum Type
224 {
225   STOPPED, ///< Animation has stopped
226   PLAYING, ///< The animation is playing
227   PAUSED   ///< The animation is paused
228 };
229
230 } // namespace PlayState
231
232 /**
233  * @brief Enumeration for what to do when the animation is stopped.
234  */
235 namespace StopBehavior
236 {
237 enum Type
238 {
239   CURRENT_FRAME, ///< When the animation is stopped, the current frame is shown.
240   FIRST_FRAME,   ///< When the animation is stopped, the first frame is shown.
241   LAST_FRAME     ///< When the animation is stopped, the last frame is shown.
242 };
243
244 } // namespace StopBehavior
245
246 /**
247  * @brief Enumeration for what looping mode is in.
248  */
249 namespace LoopingMode
250 {
251 enum Type
252 {
253   RESTART,     ///< When the animation arrives at the end in looping mode, the animation restarts from the beginning.
254   AUTO_REVERSE ///< When the animation arrives at the end in looping mode, the animation reverses direction and runs backwards again.
255 };
256
257 } // namespace LoopingMode
258
259 /**
260  * @brief Enumeration for what masking type is in.
261  */
262 namespace MaskingType
263 {
264 enum Type
265 {
266   MASKING_ON_RENDERING, ///< Alpha masking is applied for each rendering time. (On GPU)
267   MASKING_ON_LOADING    ///< Alpha masking is applied when the image is loading. (On CPU)
268 };
269
270 }
271
272 } // namespace DevelImageVisual
273
274 } // namespace Toolkit
275
276 } // namespace Dali
277
278 #endif // DALI_TOOLKIT_DEVEL_API_VISUALS_IMAGE_VISUAL_PROPERTIES_DEVEL_H