Updates for NativeImageInterface
[platform/core/uifw/dali-adaptor.git] / dali / internal / imaging / android / native-image-source-queue-impl-android.h
1 #ifndef DALI_INTERNAL_NATIVE_IMAGE_SOURCE_QUEUE_IMPL_ANDROID_H
2 #define DALI_INTERNAL_NATIVE_IMAGE_SOURCE_QUEUE_IMPL_ANDROID_H
3
4 /*
5  * Copyright (c) 2019 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
23 // INTERNAL INCLUDES
24 #include <dali/internal/imaging/common/native-image-source-queue-impl.h>
25
26 namespace Dali
27 {
28
29 namespace Internal
30 {
31
32 namespace Adaptor
33 {
34
35 class EglGraphics;
36 class EglImageExtensions;
37
38 /**
39  * Dali internal NativeImageSourceQueue.
40  */
41 class NativeImageSourceQueueAndroid: public Internal::Adaptor::NativeImageSourceQueue
42 {
43 public:
44
45   /**
46    * Create a new NativeImageSourceQueueAndroid internally.
47    * Depending on hardware the width and height may have to be a power of two.
48    * @param[in] width The width of the image.
49    * @param[in] height The height of the image.
50    * @param[in] depth color depth of the image.
51    * @param[in] nativeImageSourceQueue contains tbm_surface_queue_h or is empty
52    * @return A smart-pointer to a newly allocated image.
53    */
54   static NativeImageSourceQueueAndroid* New( uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorDepth depth, Any nativeImageSourceQueue );
55
56   /**
57    * @copydoc Dali::NativeImageSourceQueue::GetNativeImageSourceQueue()
58    */
59   Any GetNativeImageSourceQueue() const override;
60
61   /**
62    * @copydoc Dali::NativeImageSourceQueue::SetSize
63    */
64   void SetSize( uint32_t width, uint32_t height ) override;
65
66   /**
67    * @copydoc Dali::NativeImageSourceQueue::IgnoreSourceImage
68    */
69   void IgnoreSourceImage() override;
70
71   /**
72    * destructor
73    */
74   ~NativeImageSourceQueueAndroid() override;
75
76   /**
77    * @copydoc Dali::NativeImageInterface::CreateResource()
78    */
79   bool CreateResource() override;
80
81   /**
82    * @copydoc Dali::NativeImageInterface::DestroyResource()
83    */
84   void DestroyResource() override;
85
86   /**
87    * @copydoc Dali::NativeImageInterface::TargetTexture()
88    */
89   uint32_t TargetTexture() override;
90
91   /**
92    * @copydoc Dali::NativeImageInterface::PrepareTexture()
93    */
94   void PrepareTexture() override;
95
96   /**
97    * @copydoc Dali::NativeImageInterface::GetWidth()
98    */
99   uint32_t GetWidth() const override
100   {
101     return mWidth;
102   }
103
104   /**
105    * @copydoc Dali::NativeImageInterface::GetHeight()
106    */
107   uint32_t GetHeight() const override
108   {
109     return mHeight;
110   }
111
112   /**
113    * @copydoc Dali::NativeImageInterface::RequiresBlending()
114    */
115   bool RequiresBlending() const override
116   {
117     return true;
118   }
119
120   /**
121    * @copydoc Dali::NativeImageInterface::GetExtension()
122    */
123   NativeImageInterface::Extension* GetNativeImageInterfaceExtension() override
124   {
125     return nullptr;
126   }
127
128   /**
129    * @copydoc Dali::NativeImageInterface::GetCustomFragmentPrefix()
130    */
131   const char* GetCustomFragmentPrefix() const override;
132
133   /**
134    * @copydoc Dali::NativeImageInterface::GetCustomSamplerTypename()
135    */
136   const char* GetCustomSamplerTypename() const override;
137
138   /**
139    * @copydoc Dali::NativeImageInterface::GetTextureTarget()
140    */
141   int GetTextureTarget() const override;
142
143   /**
144    * @copydoc Dali::NativeImageInterface::GetNativeImageHandle()
145    */
146   Any GetNativeImageHandle() const override;
147
148   /**
149    * @copydoc Dali::NativeImageInterface::SourceChanged()
150    */
151   bool SourceChanged() const override;
152
153 private:
154
155   /**
156    * Private constructor; @see NativeImageSourceQueue::New()
157    * @param[in] width The width of the image.
158    * @param[in] height The height of the image.
159    * @param[in] colour depth of the image.
160    * @param[in] nativeImageSourceQueue contains tbm_surface_queue_h or is empty
161    */
162   NativeImageSourceQueueAndroid( uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorDepth depth, Any nativeImageSourceQueue );
163
164 private:
165
166   uint32_t    mWidth;                ///< image width
167   uint32_t    mHeight;               ///< image height
168
169 };
170
171 } // namespace Adaptor
172
173 } // namespace Internal
174
175 } // namespace Dali
176
177 #endif // DALI_INTERNAL_NATIVE_IMAGE_SOURCE_QUEUE_IMPL_ANDROID_H