DALi Version 1.2.61
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / image-loader / sync-image-loader.h
1 #ifndef DALI_TOOLKIT_SYNC_IMAGE_LOADER_H
2 #define DALI_TOOLKIT_SYNC_IMAGE_LOADER_H
3
4 /*
5  * Copyright (c) 2016 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 // EXTERNAL INCLUDES
21 #include <string>
22 #include <dali/public-api/images/image-operations.h>
23 #include <dali/public-api/images/pixel-data.h>
24
25 namespace Dali
26 {
27
28 namespace Toolkit
29 {
30
31 namespace SyncImageLoader
32 {
33
34 /**
35  * @brief The methods in the SyncImageLoader namespace are used to load pixel data from a URL synchronously.
36  *
37  * Example:
38  *
39  * @code
40  * PixelData pixelData = Toolkit::SyncImageLoader::Load( "image_url.jpg" );
41  *
42  * // Check the image was loaded without error.
43  * if( pixelData )
44  * {
45  *   // Do work...
46  * }
47  *
48  * @endcode
49  */
50
51 /**
52  * @brief Loads an image synchronously.
53  * Note: When using this method, the following defaults will be used:
54  * fittingMode = FittingMode::DEFAULT
55  * samplingMode = SamplingMode::BOX_THEN_LINEAR
56  * orientationCorrection = true
57  *
58  * @SINCE_1_2_14
59  * @REMARK_INTERNET
60  * @REMARK_STORAGE
61  * @param[in] url The URL of the image file to load
62  * @return A PixelData object containing the image, or an invalid object on failure
63  */
64 DALI_IMPORT_API PixelData Load( const std::string& url );
65
66 /**
67  * @brief Loads an image synchronously by specifying the target dimensions.
68  * Note: When using this method, the following defaults will be used:
69  * fittingMode = FittingMode::DEFAULT
70  * samplingMode = SamplingMode::BOX_THEN_LINEAR
71  * orientationCorrection = true
72  *
73  * @SINCE_1_2_14
74  * @REMARK_INTERNET
75  * @REMARK_STORAGE
76  * @param[in] url The URL of the image file to load
77  * @param[in] dimensions The width and height to fit the loaded image to
78  * @return A PixelData object containing the image, or an invalid object on failure
79  */
80 DALI_IMPORT_API PixelData Load( const std::string& url, ImageDimensions dimensions );
81
82 /**
83  * @brief Loads an image synchronously by specifying the target dimensions and options.
84  * @SINCE_1_2_14
85  * @REMARK_INTERNET
86  * @REMARK_STORAGE
87  * @param[in] url The URL of the image file to load
88  * @param[in] dimensions The width and height to fit the loaded image to
89  * @param[in] fittingMode The method used to fit the shape of the image before loading to the shape defined by the size parameter
90  * @param[in] samplingMode The filtering method used when sampling pixels from the input image while fitting it to desired size
91  * @param[in] orientationCorrection Reorient the image to respect any orientation metadata in its header
92  * @return A PixelData object containing the image, or an invalid object on failure
93  */
94 DALI_IMPORT_API PixelData Load( const std::string& url,
95                 ImageDimensions dimensions,
96                 FittingMode::Type fittingMode,
97                 SamplingMode::Type samplingMode,
98                 bool orientationCorrection );
99
100 } // namespace SyncImageLoader
101
102 } // namespace Toolkit
103
104 } // namespace Dali
105
106 #endif // DALI_TOOLKIT_SYNC_IMAGE_LOADER_H