Support embedded texture data for glTF + alpha
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / builder / base64-encoding.h
1 #ifndef DALI_TOOLKIT_BASE64_ENCODING_H
2 #define DALI_TOOLKIT_BASE64_ENCODING_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
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/common/vector-wrapper.h>
23 #include <dali/public-api/object/property.h>
24
25 // INTERNAL INCLUDES
26 #include <dali-toolkit/public-api/dali-toolkit-common.h>
27
28 namespace Dali
29 {
30 namespace Toolkit
31 {
32 /**
33  * @brief Parses a Property::STRING or Property::ARRAY of STRINGS to
34  * retrieve a block of uint32_t data.
35  *
36  * Data can be encoded using the base64 encoding scheme to allow it to be used
37  * in JSON (The property system maps to JSON types).
38  *
39  * @param[in] value The property value to decode
40  * @param[out] outputData The output data block
41  * @return True if a data block was decoded successfully.
42  */
43 DALI_TOOLKIT_API bool DecodeBase64PropertyData(const Property::Value& value, std::vector<uint32_t>& outputData);
44
45 /**
46  * @brief Parses a Property::STRING or Property::ARRAY of STRINGS to
47  * retrieve an array of uint8_t data.
48  *
49  * Data can be encoded using the base64 encoding scheme to allow it to be used
50  * in JSON (The property system maps to JSON types).
51  *
52  * @param[in] value The property value to decode
53  * @param[out] outputData The output data block
54  * @return True if a data block was decoded successfully.
55  */
56 DALI_TOOLKIT_API bool DecodeBase64PropertyData(const Property::Value& value, std::vector<uint8_t>& outputData);
57
58 /**
59  * @brief Convert a block of uint32_t data into a Property::STRING or ARRAY of STRINGs
60  * encoded using base64. This allows the data to be mapped to JSON easily.
61  *
62  * @param[out] value The value to write data into (to avoid copying).
63  * @param[in] inputData The input
64  */
65 DALI_TOOLKIT_API void EncodeBase64PropertyData(Property::Value& value, const std::vector<uint32_t>& inputData);
66
67 } // namespace Toolkit
68
69 } // namespace Dali
70
71 #endif // DALI_TOOLKIT_BASE64_ENCODING_H