1 #ifndef DALI_TOOLKIT_SYNC_IMAGE_LOADER_H
2 #define DALI_TOOLKIT_SYNC_IMAGE_LOADER_H
5 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/images/image-operations.h>
23 #include <dali/public-api/images/pixel-data.h>
31 namespace SyncImageLoader
35 * @brief The methods in the SyncImageLoader namespace are used to load pixel data from a URL synchronously.
40 * PixelData pixelData = Toolkit::SyncImageLoader::Load( "image_url.jpg" );
42 * // Check the image was loaded without error.
52 * @brief Load 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
60 * @param[in] url The URL of the image file to load.
61 * @return A PixelData object containing the image, or an invalid object on failure.
63 DALI_IMPORT_API PixelData Load( const std::string& url );
66 * @brief Load an image synchronously by specifying the target dimensions.
67 * Note: When using this method, the following defaults will be used:
68 * fittingMode = FittingMode::DEFAULT
69 * samplingMode = SamplingMode::BOX_THEN_LINEAR
70 * orientationCorrection = true
74 * @param[in] url The URL of the image file to load.
75 * @param[in] dimensions The width and height to fit the loaded image to.
76 * @return A PixelData object containing the image, or an invalid object on failure.
78 DALI_IMPORT_API PixelData Load( const std::string& url, ImageDimensions dimensions );
81 * @brief Load an image synchronously by specifying the target dimensions and options.
84 * @param[in] url The URL of the image file to load.
85 * @param[in] dimensions The width and height to fit the loaded image to.
86 * @param[in] fittingMode The method used to fit the shape of the image before loading to the shape defined by the size parameter.
87 * @param[in] samplingMode The filtering method used when sampling pixels from the input image while fitting it to desired size.
88 * @param[in] orientationCorrection Reorient the image to respect any orientation metadata in its header.
89 * @return A PixelData object containing the image, or an invalid object on failure.
91 DALI_IMPORT_API PixelData Load( const std::string& url,
92 ImageDimensions dimensions,
93 FittingMode::Type fittingMode,
94 SamplingMode::Type samplingMode,
95 bool orientationCorrection );
97 } // namespace SyncImageLoader
99 } // namespace Toolkit
103 #endif // DALI_TOOLKIT_SYNC_IMAGE_LOADER_H