1 #ifndef DALI_ENCODED_IMAGE_BUFFER_H
2 #define DALI_ENCODED_IMAGE_BUFFER_H
4 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 #include <dali/public-api/common/dali-vector.h>
22 #include <dali/public-api/object/base-handle.h>
25 #include <dali/public-api/dali-adaptor-common.h>
29 namespace Internal DALI_INTERNAL
31 class EncodedImageBuffer;
35 * @brief EncodedImageBuffer contains the large encoded raw buffer informations.
38 * @note Object will copy raw buffer data.
40 class DALI_ADAPTOR_API EncodedImageBuffer : public BaseHandle
43 using RawBufferType = Dali::Vector<uint8_t>;
46 * @brief The list of type of encoded image buffer.
53 VECTOR_IMAGE, ///< svg format.
54 ANIMATED_VECTOR_IMAGE, ///< lottie format.
56 DEFAULT = REGULAR_IMAGE,
61 * @brief Create a new EncodedImageBuffer. ImageType will be setted as DEFAULT.
64 * @param [in] buffer The encoded raw buffer
65 * @return A handle to a new EncodedImageBuffer.
67 static EncodedImageBuffer New(const RawBufferType& buffer);
70 * @brief Create a new EncodedImageBuffer with ImageType.
73 * @param [in] buffer The encoded raw buffer
74 * @param [in] type The type hint of encoded raw buffer
75 * @return A handle to a new EncodedImageBuffer.
77 static EncodedImageBuffer New(const RawBufferType& buffer, ImageType type);
80 * @brief Create an empty handle.
83 * Calling member functions of an empty handle is not allowed.
90 * This is non-virtual since derived Handle types must not contain data or virtual methods.
93 ~EncodedImageBuffer();
96 * @brief This copy constructor is required for (smart) pointer semantics.
99 * @param [in] handle A reference to the copied handle
101 EncodedImageBuffer(const EncodedImageBuffer& handle);
104 * @brief This assignment operator is required for (smart) pointer semantics.
107 * @param [in] handle A reference to the copied handle
108 * @return A reference to this
110 EncodedImageBuffer& operator=(const EncodedImageBuffer& handle);
113 * @brief This move constructor is required for (smart) pointer semantics.
116 * @param [in] handle A reference to the moved handle
118 EncodedImageBuffer(EncodedImageBuffer&& handle) noexcept;
121 * @brief This move assignment operator is required for (smart) pointer semantics.
124 * @param [in] handle A reference to the moved handle
125 * @return A reference to this
127 EncodedImageBuffer& operator=(EncodedImageBuffer&& handle) noexcept;
130 * @brief Get raw buffer data
133 * @note this method return const value. Mean, you cannot change raw buffer
134 * @return A RawBufferType this buffer have
136 const RawBufferType& GetRawBuffer() const;
139 * @brief Get the hash value of raw buffer
142 * @return A hash value of raw buffer.
144 std::size_t GetHash() const;
147 * @brief Set type of raw buffer.
150 * @param[in] type A ImageType for this buffer
152 void SetImageType(ImageType type);
155 * @brief Get type of raw buffer.
158 * @return A ImageType this buffer have
160 ImageType GetImageType() const;
162 public: // Not intended for developer use
163 explicit DALI_INTERNAL EncodedImageBuffer(Internal::EncodedImageBuffer* impl);
168 #endif // DALI_ENCODED_IMAGE_BUFFER_H