Util functions that convert a kind of buffers to url
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / image-loader / image.h
1 #ifndef DALI_TOOLKIT_DEVEL_API_IMAGE_MANAGER_H
2 #define DALI_TOOLKIT_DEVEL_API_IMAGE_MANAGER_H
3
4 /*
5  * Copyright (c) 2020 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 <dali/public-api/images/pixel-data.h>
22 #include <dali/public-api/rendering/frame-buffer.h>
23 #include <dali/public-api/adaptor-framework/native-image-source.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 /**
35  * API to interface with the toolkit image
36  * Allows developers to add FrameBuffer, PixelData and NativeImageSource to toolkit so that visuals can use them to render
37  */
38 namespace Image
39 {
40
41 /**
42  * @brief Generate a Url from frame buffer.
43  * This Url can be used in visuals to render the frame buffer.
44  * @note Any color textures already attached in this freme buffer are not converted to the Url by this method.
45  * This method does not check for duplicates, If same frame buffer is entered multiple times, a different URL is returned each time.
46  * @param[in] frameBuffer the frame buffer to converted to Url
47  * @param[in] pixelFormat the pixel format for this frame buffer
48  * @param[in] width the width for this frame buffer
49  * @param[in] height the height for this frame buffer
50  * @return the Url string representing this frame buffer
51  */
52 DALI_TOOLKIT_API std::string GenerateUrl( const Dali::FrameBuffer frameBuffer, Pixel::Format pixelFormat, uint32_t width, uint32_t height );
53
54 /**
55  * @brief Generate a Url from frame buffer.
56  * This Url can be used in visuals to render the frame buffer.
57  * @note Only an color texture already attached in this frame buffer can be convert to Url by this method.
58  * This method does not check for duplicates, If same frame buffer is entered multiple times, a different URL is returned each time.
59  * @param[in] frameBuffer the frame buffer to converted to Url
60  * @param[in] index the index of the attached color texture.
61  * @return the Url string representing this frame buffer
62  */
63 DALI_TOOLKIT_API std::string GenerateUrl( const Dali::FrameBuffer frameBuffer, const uint8_t index );
64
65 /**
66  * @brief Generate a Url from Pixel data.
67  * This Url can be used in visuals to render the pixel data.
68  * @note This method does not check for duplicates, If same pixel data is entered multiple times, a different URL is returned each time.
69  * @param[in] pixelData the pixel data to converted to Url
70  * @return the Url string representing this pixel data
71  */
72 DALI_TOOLKIT_API std::string GenerateUrl( const Dali::PixelData pixelData );
73
74 /**
75  * @brief Generate a Url from native image source.
76  * This Url can be used in visuals to render the native image source.
77  * @note This method does not check for duplicates, If same native image source is entered multiple times, a different URL is returned each time.
78  * @param[in] nativeImageSource the native image source to converted to Url
79  * @return the Url string representing this native image source
80  */
81 DALI_TOOLKIT_API std::string GenerateUrl( const Dali::NativeImageSourcePtr nativeImageSource );
82
83 } // ImageUtil
84
85 } // Toolkit
86
87 } // Dali
88
89 #endif // DALI_TOOLKIT_DEVEL_API_IMAGE_MANAGER_H