2ea471f7e23e50500d51addf430d12883ac02e0c
[platform/core/uifw/dali-adaptor.git] / dali / internal / imaging / common / encoded-image-buffer-impl.h
1 #ifndef DALI_ENCODED_IMAGE_BUFFER_IMPL_H
2 #define DALI_ENCODED_IMAGE_BUFFER_IMPL_H
3
4 /*
5  * Copyright (c) 2021 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/common/intrusive-ptr.h>
22 #include <dali/public-api/object/base-object.h>
23 #include <dali/public-api/common/dali-vector.h>
24
25 // INTERNAL INCLUDES
26 #include <dali/public-api/dali-adaptor-common.h>
27 #include <dali/public-api/adaptor-framework/encoded-image-buffer.h>
28
29 namespace Dali
30 {
31 namespace Internal
32 {
33 class EncodedImageBuffer : public BaseObject
34 {
35 public:
36   using RawBufferType = Dali::EncodedImageBuffer::RawBufferType;
37
38   /**
39    * Constructor
40    * @param [in] buffer The raw buffer of image.
41    */
42   EncodedImageBuffer(const RawBufferType& buffer);
43
44   /**
45    * @copydoc Dali::EncodedImageBuffer::New
46    */
47   static IntrusivePtr<EncodedImageBuffer> New(const RawBufferType& buffer);
48
49   /**
50    * @copydoc Dali::EncodedImageBuffer::GetRawBuffer
51    */
52   const RawBufferType& GetRawBuffer() const;
53
54 protected:
55   /**
56    * Destructor
57    */
58   ~EncodedImageBuffer();
59
60 private:
61   // Undefined
62   EncodedImageBuffer(const EncodedImageBuffer& imageBuffer);
63
64   // Undefined
65   EncodedImageBuffer& operator=(const EncodedImageBuffer& imageBuffer);
66
67 private:
68   Dali::Vector<uint8_t> mBuffer;
69 };
70
71 } // namespace Internal
72
73 inline const Internal::EncodedImageBuffer& GetImplementation(const Dali::EncodedImageBuffer& encodedImageBuffer)
74 {
75   DALI_ASSERT_ALWAYS(encodedImageBuffer && "EncodedImageBuffer handle is empty");
76
77   const BaseObject& handle = encodedImageBuffer.GetBaseObject();
78
79   return static_cast<const Internal::EncodedImageBuffer&>(handle);
80 }
81
82 inline Internal::EncodedImageBuffer& GetImplementation(Dali::EncodedImageBuffer& encodedImageBuffer)
83 {
84   DALI_ASSERT_ALWAYS(encodedImageBuffer && "EncodedImageBuffer handle is empty");
85
86   BaseObject& handle = encodedImageBuffer.GetBaseObject();
87
88   return static_cast<Internal::EncodedImageBuffer&>(handle);
89 }
90
91 } // namespace Dali
92
93 #endif // DALI_ENCODED_IMAGE_BUFFER_IMPL_H