Merge branch 'devel/master' into tizen
[platform/core/uifw/dali-core.git] / dali / devel-api / rendering / texture-devel.h
1 #ifndef DALI_TEXTURE_DEVEL_H
2 #define DALI_TEXTURE_DEVEL_H
3
4 /*
5  * Copyright (c) 2022 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
21 // INTERNAL INCLUDES
22 #include <dali/public-api/rendering/texture.h>
23
24 namespace Dali
25 {
26 namespace DevelTexture
27 {
28 /**
29  * @brief Function to determine if a texture is backed by a native image.
30  *
31  * @return True if the texture is a native image.
32  */
33 bool DALI_CORE_API IsNative(Dali::Texture texture);
34
35 /**
36  * @brief Converts shader for native image.
37  *
38  * Applies any specific native shader prefix and sampler code to the
39  * given shader.
40  *
41  * @param[in] texture The texture the shader will apply to
42  * @param[in] shader The fragment shader code to modify
43  * @return True if the shader code was modified
44  */
45 bool DALI_CORE_API ApplyNativeFragmentShader(Dali::Texture texture, std::string& shader);
46
47 /**
48  * @brief Uploads data to the texture from a PixelData object.
49  * @note Compressed type doesn't support this API.
50  * @note Upload does not upsample or downsample pixel data to fit the specified rectangular area in the texture.
51  *
52  * @SINCE_2_1.33
53  * @param[in] texture The texture will be uploaded
54  * @param[in] pixelData The pixelData object
55  * @param[in] dataXOffset Specifies an horizontal offset of the rectangular area in the pixelData that will be updated
56  * @param[in] dataYOffset Specifies a vertical offset of the rectangular area in the pixelData that will be updated
57  * @param[in] dataWidth Specifies the width of the rectangular area in the pixelData that will be updated
58  * @param[in] dataHeight Specifies the height of the rectangular area in the pixelData that will be updated
59  * @return True if the PixelData object has compatible pixel format and fits within the texture, false otherwise
60  */
61 bool DALI_CORE_API UploadSubPixelData(Dali::Texture   texture,
62                                       Dali::PixelData pixelData,
63                                       uint32_t        dataXOffset,
64                                       uint32_t        dataYOffset,
65                                       uint32_t        dataWidth,
66                                       uint32_t        dataHeight);
67
68 /**
69  * @brief Uploads data to the texture from a PixelData object.
70  * @note Compressed type doesn't support this API.
71  * @note Upload does not upsample or downsample pixel data to fit the specified rectangular area in the texture.
72  *
73  * @SINCE_2_1.33
74  * @param[in] texture The texture will be uploaded
75  * @param[in] pixelData The pixelData object
76  * @param[in] dataXOffset Specifies an horizontal offset of the rectangular area in the pixelData that will be updated
77  * @param[in] dataYOffset Specifies a vertical offset of the rectangular area in the pixelData that will be updated
78  * @param[in] dataWidth Specifies the width of the rectangular area in the pixelData that will be updated
79  * @param[in] dataHeight Specifies the height of the rectangular area in the pixelData that will be updated
80  * @param[in] layer Specifies the layer of a cube map or array texture (Unused for 2D textures). @see CubeMapLayer
81  * @param[in] mipmap Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image
82  * @param[in] xOffset Specifies an horizontal offset of the rectangular area in the texture that will be updated
83  * @param[in] yOffset Specifies a vertical offset of the rectangular area in the texture that will be updated
84  * @param[in] width Specifies the width of the rectangular area in the texture that will be updated
85  * @param[in] height Specifies the height of the rectangular area in the texture that will be updated
86  * @return True if the PixelData object has compatible pixel format and fits within the texture, false otherwise
87  */
88 bool DALI_CORE_API UploadSubPixelData(Dali::Texture   texture,
89                                       Dali::PixelData pixelData,
90                                       uint32_t        dataXOffset,
91                                       uint32_t        dataYOffset,
92                                       uint32_t        dataWidth,
93                                       uint32_t        dataHeight,
94                                       uint32_t        layer,
95                                       uint32_t        mipmap,
96                                       uint32_t        xOffset,
97                                       uint32_t        yOffset,
98                                       uint32_t        width,
99                                       uint32_t        height);
100
101 } // namespace DevelTexture
102 } // namespace Dali
103
104 #endif // DALI_TEXTURE_DEVEL_H