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