Move Some Devel Properties & APIs to the Public API
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / visuals / image-visual-properties.h
1 #ifndef DALI_TOOLKIT_IMAGE_VISUAL_PROPERTIES_H
2 #define DALI_TOOLKIT_IMAGE_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 ImageVisual is to render an image into the control's quad.
37  * @SINCE_1_1.45
38  */
39 namespace ImageVisual
40 {
41
42 /**
43  * @brief ImageVisual Property.
44  * @SINCE_1_1.45
45  */
46 namespace Property
47 {
48
49 /**
50  * @brief Enumeration for the instance of properties belonging to the ImageVisual.
51  * @SINCE_1_1.45
52  */
53 enum
54 {
55   /**
56    * @brief The URL of the image.
57    * @details Name "url", type Property::STRING or Property::ARRAY of Property::STRING.
58    * @note The array form is used for generating animated image visuals.
59    * @note The number of threads used for local and remote image loading can be controlled by the
60    *       environment variables DALI_TEXTURE_LOCAL_THREADS and DALI_TEXTURE_REMOTE_THREADS respectively.
61    *       The default values are 4 threads for local image loading and 8 threads for remote image loading.
62    * @SINCE_1_1.45
63    * @note Mandatory.
64    */
65   URL = VISUAL_PROPERTY_START_INDEX,
66
67   /**
68    * @brief Fitting options, used when resizing images to fit desired dimensions.
69    * @details Name "fittingMode", type Dali::FittingMode (Property::INTEGER) or Property::STRING.
70    * @SINCE_1_1.45
71    * @note Optional. If not supplied, default is FittingMode::SHRINK_TO_FIT.
72    * @note For Normal Quad images only.
73    * @see Dali::FittingMode
74    */
75   FITTING_MODE,
76
77   /**
78    * @brief Filtering options, used when resizing images to sample original pixels.
79    * @details Name "samplingMode", type Dali::SamplingMode (Property::INTEGER) or Property::STRING.
80    * @SINCE_1_1.45
81    * @note Optional. If not supplied, default is SamplingMode::BOX.
82    * @note For Normal Quad images only.
83    * @see Dali::SamplingMode
84    */
85   SAMPLING_MODE,
86
87   /**
88    * @brief The desired image width.
89    * @details Name "desiredWidth", type Property::INTEGER.
90    * @SINCE_1_1.45
91    * @note Optional. If not specified, the actual image width is used.
92    * @note For Normal Quad images only.
93    */
94   DESIRED_WIDTH,
95
96   /**
97    * @brief The desired image height.
98    * @details Name "desiredHeight", type Property::INTEGER.
99    * @SINCE_1_1.45
100    * @note Optional. If not specified, the actual image height is used.
101    * @note For Normal Quad images only.
102    */
103   DESIRED_HEIGHT,
104
105   /**
106    * @brief Whether to load the image synchronously.
107    * @details Name "synchronousLoading", type Property::BOOLEAN.
108    * @SINCE_1_1.45
109    * @note Optional. If not specified, the default is false, i.e. the image is loaded asynchronously.
110    * @note For Normal Quad images only.
111    */
112   SYNCHRONOUS_LOADING,
113
114   /**
115    * @brief If true, only draws the borders.
116    * @details Name "borderOnly", type Property::BOOLEAN.
117    * @SINCE_1_1.45
118    * @note Optional. If not specified, the default is false.
119    * @note For N-Patch images only.
120    */
121   BORDER_ONLY,
122
123   /**
124    * @brief The image area to be displayed.
125    * @details Name "pixelArea", type Property::VECTOR4.
126    *          It is a rectangular area.
127    *          The first two elements indicate the top-left position of the area, and the last two elements are the area width and height respectively.
128    * @SINCE_1_2.1
129    * @note Optional. If not specified, the default value is [0.0, 0.0, 1.0, 1.0], i.e. the entire area of the image.
130    * @note For Normal Quad images only.
131    */
132   PIXEL_AREA,
133
134   /**
135    * @brief The wrap mode for u coordinate.
136    * @details Name "wrapModeU", type Dali::WrapMode::Type (Property::INTEGER) or Property::STRING.
137    *          It decides how the texture should be sampled when the u coordinate exceeds the range of 0.0 to 1.0.
138    * @SINCE_1_2.1
139    * @note Optional. If not specified, the default is CLAMP.
140    * @note For Normal QUAD image only.
141    */
142   WRAP_MODE_U,
143
144   /**
145    * @brief The wrap mode for v coordinate.
146    * @details Name "wrapModeV", type Dali::WrapMode::Type (Property::INTEGER) or Property::STRING.
147    *          it decides how the texture should be sampled when the v coordinate exceeds the range of 0.0 to 1.0.
148    * @SINCE_1_2.1
149    * @note Optional. If not specified, the default is CLAMP.
150    * @note For Normal QUAD image only.
151    */
152   WRAP_MODE_V,
153
154   /**
155    * @brief The border of the image.
156    * @details Name "border", type Property::RECTANGLE or Property::VECTOR4.
157    *          The border of the image in the order: left, right, bottom, top.
158    * @SINCE_1_2.60
159    * @note Optional.
160    * @note For N-Patch images only.
161    */
162   BORDER,
163
164   /**
165    * @brief Whether to use the texture atlas
166    * @details Name "atlasing", type Property::BOOLEAN.
167    * @SINCE_1_2.60
168    * @note Optional. By default atlasing is off.
169    */
170   ATLASING,
171
172   /**
173    * @brief URL of a masking image
174    * @details Name "alphaMaskUrl", type Property::STRING, URL of image to apply as
175    * a mask after image loading. If set after the main URL has finished loading, this
176    * may necessitate a re-load of the main image. The alpha mask image will be scaled
177    * on load to match the size of the main image, then applied to the pixel data
178    * before uploading to GL.
179    * @SINCE_1_2.60
180    * @note Optional.
181    */
182   ALPHA_MASK_URL,
183
184   /**
185    * @brief Defines the batch size for pre-loading images in the AnimatedImageVisual
186    * @details Name "batchSize", type Property::INTEGER, number of images to pre-load
187    * before starting to play. Default value: 1
188    * @SINCE_1_2.60
189    * @note Optional.
190    */
191   BATCH_SIZE,
192
193   /**
194    * @brief Defines the cache size for loading images in the AnimatedImageVisual
195    * @details Name "cacheSize", type Property::INTEGER, number of images to keep
196    * cached ahead during playback. Default value: 1
197    *
198    * @SINCE_1_2.60
199    * @note Optional.
200    * @note, cacheSize should be >= batchSize.
201    * If it isn't, then the cache will automatically be changed to batchSize.
202    * @note, because of the defaults, it is expected that the application developer
203    * tune the batch and cache sizes to their particular use case.
204    */
205   CACHE_SIZE,
206
207   /**
208    * @brief The number of milliseconds between each frame in the AnimatedImageVisual
209    * @details Name "frameDelay", type Property::INTEGER, The number of milliseconds between each frame.
210    * @SINCE_1_2.60
211    * @note Optional.
212    * @note This is only used when multiple URLs are provided.
213    */
214   FRAME_DELAY,
215
216   /**
217    * @brief The scale factor to apply to the content image before masking
218    * @details Name "maskContentScale", type Property::FLOAT, The scale factor
219    * to apply to the content before masking. Note, scaled images are cropped to
220    * the same size as the alpha mask.
221    * @SINCE_1_2.60
222    * @note Optional.
223    */
224   MASK_CONTENT_SCALE,
225
226   /**
227    * @brief Whether to crop image to mask or scale mask to fit image
228    * @details Name "cropToMask", type Property::BOOLEAN, True if the image should
229    * be cropped to match the mask size, or false if the image should remain the same size.
230    * @SINCE_1_2.60
231    * @note Optional.
232    * @note If this is false, then the mask is scaled to fit the image before being applied.
233    */
234   CROP_TO_MASK,
235
236 /**
237    * @brief The policy to determine when an image should be loaded.
238    * @details Name "loadPolicy",  Type LoadPolicy::Type (Property::INTEGER)or Property::STRING.
239    * @SINCE_1_3_5
240    * @note Default LoadPolicy::ATTACHED
241    * @see LoadPolicy::Type
242    */
243
244   LOAD_POLICY,
245
246   /**
247    * @brief The policy to determine when an image should no longer be cached.
248    * @details Name "releasePolicy", Type ReleasePolicy::Type (Property::INTEGER) or Property::STRING
249    * @SINCE_1_3_5
250    * @note Default ReleasePolicy::DESTROYED
251    * @see ReleasePolicy::Type
252    */
253
254   RELEASE_POLICY,
255
256   /**
257    * @brief Determines if image orientation should be corrected so the image displays as it was intended.
258    * @details Name "orientationCorrection", Type Property::BOOLEAN, if true the image's orientation will be corrected.
259    * @SINCE_1_3_5
260    * @note Default true
261    */
262
263   ORIENTATION_CORRECTION,
264
265 };
266
267 } // namespace Property
268
269 /**
270  * @brief The policy determining if the image is loaded when the visual is staged or created.
271  * @SINCE_1_3_5
272  */
273 namespace LoadPolicy
274 {
275
276 /**
277  * @brief The available named elements that define the LoadPolicy.
278  * @SINCE_1_3_5
279  */
280 enum Type
281 {
282   IMMEDIATE = 0,  ///< The image is loaded when the ImageVisual is created.
283   ATTACHED        ///< The image is loaded when the ImageVisual is attached to the stage.
284 };
285
286 } // namespace LoadPolicy
287
288 /**
289  * @brief The policy determining when a image is deleted from the cache in relation to the ImageVisual lifetime.
290  * @SINCE_1_3_5
291  * @note If the texture is being shared by another visual it persist if still required.
292  */
293 namespace ReleasePolicy
294 {
295
296 /**
297  * @brief The available named elements that define the ReleasePolicy.
298  * @SINCE_1_3_5
299  */
300 enum Type
301 {
302   DETACHED = 0,  ///<  Image deleted from cache when ImageVisual detached from stage.
303   DESTROYED,     ///<  Image deleted from cache when ImageVisual destroyed.
304   NEVER          ///<  Image is never deleted, will survive the lifetime of the application.
305 };
306
307 } // namespace ReleasePolicy;
308
309 } // namespace ImageVisual
310
311 /**
312  * @}
313  */
314
315 } // namespace Toolkit
316
317 } // namespace Dali
318
319 #endif // DALI_TOOLKIT_IMAGE_VISUAL_PROPERTIES_H