[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / image-loader / image.h
1 #ifndef DALI_TOOLKIT_IMAGE_H
2 #define DALI_TOOLKIT_IMAGE_H
3
4 /*
5  * Copyright (c) 2023 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/adaptor-framework/encoded-image-buffer.h>
22 #include <dali/public-api/images/native-image-interface.h>
23 #include <dali/public-api/images/pixel-data.h>
24 #include <dali/public-api/rendering/frame-buffer.h>
25
26 // INTERNAL INCLUDES
27 #include <dali-toolkit/public-api/dali-toolkit-common.h>
28 #include <dali-toolkit/public-api/image-loader/image-url.h>
29
30 namespace Dali
31 {
32 namespace Toolkit
33 {
34 /**
35  * API to interface with the toolkit image
36  * Allows developers to add FrameBuffer, PixelData and NativeImageInterface to toolkit so that visuals can use them to render
37  */
38 namespace Image
39 {
40 /**
41  * @brief Generate a Url from frame buffer.
42  * This Url can be used in visuals to render the frame buffer.
43  * @note Any color textures already attached in this freme buffer are not converted to the Url by this method.
44  * This method does not check for duplicates, If same frame buffer is entered multiple times, a different URL is returned each time.
45  * @param[in] frameBuffer the frame buffer to converted to Url
46  * @param[in] pixelFormat the pixel format for this frame buffer
47  * @param[in] width the width for this frame buffer
48  * @param[in] height the height for this frame buffer
49  * @return the ImageUrl representing this frame buffer
50  */
51 DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::FrameBuffer frameBuffer, Pixel::Format pixelFormat, uint32_t width, uint32_t height);
52
53 /**
54  * @brief Generate a Url from frame buffer.
55  * This Url can be used in visuals to render the frame buffer.
56  * @note Only an color texture already attached in this frame buffer can be convert to Url by this method.
57  * This method does not check for duplicates, If same frame buffer is entered multiple times, a different URL is returned each time.
58  * @param[in] frameBuffer the frame buffer to converted to Url
59  * @param[in] index the index of the attached color texture.
60  * @return the ImageUrl representing this frame buffer
61  */
62 DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::FrameBuffer frameBuffer, uint8_t index);
63
64 /**
65  * @brief Generate a Url from Pixel data.
66  * This Url can be used in visuals to render the pixel data.
67  * @note This method does not check for duplicates, If same pixel data is entered multiple times, a different URL is returned each time.
68  * @param[in] pixelData the pixel data to converted to Url
69  * @param[in] preMultiplied Whether this pixel data preMultiplied or not. Default as false.
70  * @return the ImageUrl representing this pixel data
71  */
72 DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::PixelData pixelData, bool preMultiplied = false);
73
74 /**
75  * @brief Generate a Url from native image interface.
76  * This Url can be used in visuals to render the native image interface.
77  * @note This method does not check for duplicates, If same native image interface is entered multiple times, a different URL is returned each time.
78  * @param[in] nativeImageInterface the native image interface to converted to Url
79  * @param[in] preMultiplied Whether this native image interface preMultiplied or not. Default as false.
80  * @return the ImageUrl representing this native image interface
81  */
82 DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::NativeImageInterfacePtr nativeImageInterface, bool preMultiplied = false);
83
84 /**
85  * @brief Generate a Url from encoded image buffer.
86  * This Url can be used in visuals to render the image.
87  * @note This method does not check for duplicates, If same encoded image buffer is entered multiple times, a different URL is returned each time.
88  * @param[in] encodedImageBuffer the encoded image buffer to converted to Url
89  * @return the ImageUrl representing this encoded image buffer
90  */
91 DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::EncodedImageBuffer encodedImageBuffer);
92
93 /**
94  * @brief Generate a Url of depth texture from frame buffer.
95  * This Url can be used in visuals to render the frame buffer.
96  * This method does not check for duplicates, If same frame buffer is entered multiple times, a different URL is returned each time.
97  * @param[in] frameBuffer the frame buffer to converted to Url
98  * @return the ImageUrl representing this frame buffer
99  */
100 DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateDepthUrl(const Dali::FrameBuffer frameBuffer);
101
102 } // namespace Image
103
104 } // namespace Toolkit
105
106 } // namespace Dali
107
108 #endif // DALI_TOOLKIT_IMAGE_H