Revert "[Tizen] Add codes for Dali Windows Backend"
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / image-loading.h
1 #ifndef DALI_IMAGE_LOADING_H
2 #define DALI_IMAGE_LOADING_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/devel-api/adaptor-framework/pixel-buffer.h>
24
25 // INTERNAL INCLUDES
26 #include <dali/public-api/dali-adaptor-common.h>
27
28
29 namespace Dali
30 {
31
32 /**
33  * @brief Load an image synchronously from local file.
34  *
35  * @note This method is thread safe, i.e. can be called from any thread.
36  *
37  * @param [in] url The URL of the image file to load.
38  * @param [in] size The width and height to fit the loaded image to, 0.0 means whole image
39  * @param [in] fittingMode The method used to fit the shape of the image before loading to the shape defined by the size parameter.
40  * @param [in] samplingMode The filtering method used when sampling pixels from the input image while fitting it to desired size.
41  * @param [in] orientationCorrection Reorient the image to respect any orientation metadata in its header.
42  * @return handle to the loaded PixelBuffer object or an empty handle in case loading failed.
43  */
44 DALI_ADAPTOR_API Devel::PixelBuffer LoadImageFromFile(
45   const std::string& url,
46   ImageDimensions size = ImageDimensions( 0, 0 ),
47   FittingMode::Type fittingMode = FittingMode::DEFAULT,
48   SamplingMode::Type samplingMode = SamplingMode::BOX_THEN_LINEAR,
49   bool orientationCorrection = true );
50
51 /**
52  * @brief Determine the size of an image that LoadImageFromFile will provide when
53  * given the same image loading parameters.
54  *
55  * This is a synchronous request.
56  * This function is used to determine the size of an image before it has loaded.
57  * @param[in] filename name of the image.
58  * @param[in] size The requested size for the image.
59  * @param[in] fittingMode The method to use to map the source image to the desired
60  * dimensions.
61  * @param[in] samplingMode The image filter to use if the image needs to be
62  * downsampled to the requested size.
63  * @param[in] orientationCorrection Whether to use image metadata to rotate or
64  * flip the image, e.g., from portrait to landscape.
65  * @return dimensions that image will have if it is loaded with given parameters.
66  */
67 DALI_ADAPTOR_API ImageDimensions GetClosestImageSize(
68   const std::string& filename,
69   ImageDimensions size = ImageDimensions(0, 0),
70   FittingMode::Type fittingMode = FittingMode::DEFAULT,
71   SamplingMode::Type samplingMode = SamplingMode::BOX_THEN_LINEAR ,
72   bool orientationCorrection = true );
73
74 /**
75  * @brief Load an image synchronously from a remote resource.
76  *
77  * @param [in] url The URL of the image file to load.
78  * @param [in] size The width and height to fit the loaded image to, 0.0 means whole image
79  * @param [in] fittingMode The method used to fit the shape of the image before loading to the shape defined by the size parameter.
80  * @param [in] samplingMode The filtering method used when sampling pixels from the input image while fitting it to desired size.
81  * @param [in] orientationCorrection Reorient the image to respect any orientation metadata in its header.
82  *
83  * @return handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.
84  */
85 DALI_ADAPTOR_API Devel::PixelBuffer DownloadImageSynchronously(
86   const std::string& url,
87   ImageDimensions size = ImageDimensions( 0, 0 ),
88   FittingMode::Type fittingMode = FittingMode::DEFAULT,
89   SamplingMode::Type samplingMode = SamplingMode::BOX_THEN_LINEAR,
90   bool orientationCorrection = true );
91
92 /**
93  * @brief get the maximum texture size.
94  *
95  * @return The maximum texture size
96  */
97 DALI_ADAPTOR_API unsigned int GetMaxTextureSize();
98
99 } // Dali
100
101 #endif // DALI_IMAGE_LOADING_H