1 #ifndef DALI_NATIVE_IMAGE_SOURCE_QUEUE_H
2 #define DALI_NATIVE_IMAGE_SOURCE_QUEUE_H
5 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/images/native-image-interface.h>
23 #include <dali/public-api/object/any.h>
29 * @addtogroup dali_adaptor_framework
33 namespace Internal DALI_INTERNAL
37 class NativeImageSourceQueue;
41 class NativeImageSourceQueue;
44 * @brief Pointer to Dali::NativeImageSourceQueue.
46 typedef Dali::IntrusivePtr< Dali::NativeImageSourceQueue > NativeImageSourceQueuePtr;
49 * @brief Used for displaying native images.
51 * NativeImageSource can be created internally or externally by native image source.
52 * NativeImage is a platform specific way of providing pixel data to the GPU for rendering,for example via an EGL image.
54 class DALI_IMPORT_API NativeImageSourceQueue : public NativeImageInterface
59 * @brief Enumeration for the instance when creating a native image, the color depth has to be specified.
63 COLOR_DEPTH_DEFAULT, ///< Uses the current screen default depth (recommended)
64 COLOR_DEPTH_24, ///< 24 bits per pixel
65 COLOR_DEPTH_32 ///< 32 bits per pixel
69 * @brief Creates a new NativeImageSourceQueue.
70 * Depending on hardware, the width and height may have to be a power of two.
71 * @param[in] width The width of the image
72 * @param[in] height The height of the image
73 * @param[in] depth color depth of the image
74 * @return A smart-pointer to a newly allocated image
76 static NativeImageSourceQueuePtr New( unsigned int width, unsigned int height, ColorDepth depth );
79 * @brief Creates a new NativeImageSourceQueue from an existing native image source.
81 * @param[in] nativeImageSourceQueue NativeImageSourceQueue must be a any handle with native image source
82 * @return A smart-pointer to a newly allocated image
83 * @see NativeImageInterface
85 static NativeImageSourceQueuePtr New( Any nativeImageSourceQueue );
88 * @brief Retrieves the internal native image.
90 * @return Any object containing the internal native image source queue
92 Any GetNativeImageSourceQueue();
95 * @brief Sets an existing source.
97 * @param[in] source Any handle with the source
99 void SetSource( Any source );
101 private: // native image
104 * @copydoc Dali::NativeImageInterface::GlExtensionCreate()
106 virtual bool GlExtensionCreate();
109 * @copydoc Dali::NativeImageInterface::GlExtensionDestroy()
111 virtual void GlExtensionDestroy();
114 * @copydoc Dali::NativeImageInterface::TargetTexture()
116 virtual unsigned int TargetTexture();
119 * @copydoc Dali::NativeImageInterface::PrepareTexture()
121 virtual void PrepareTexture();
124 * @copydoc Dali::NativeImageInterface::GetWidth()
126 virtual unsigned int GetWidth() const;
129 * @copydoc Dali::NativeImageInterface::GetHeight()
131 virtual unsigned int GetHeight() const;
134 * @copydoc Dali::NativeImageInterface::RequiresBlending()
136 virtual bool RequiresBlending() const;
139 * @copydoc Dali::NativeImageInterface::GetExtension()
141 NativeImageInterface::Extension* GetExtension();
147 * @brief Private constructor.
148 * @param[in] width The width of the image
149 * @param[in] height The height of the image
150 * @param[in] depth color depth of the image
151 * @param[in] nativeImageSourceQueue contains either: native image source or is empty
153 DALI_INTERNAL NativeImageSourceQueue( unsigned int width, unsigned int height, ColorDepth depth, Any nativeImageSourceQueue );
156 * @brief A reference counted object may only be deleted by calling Unreference().
158 * The implementation should destroy the NativeImage resources.
160 DALI_INTERNAL virtual ~NativeImageSourceQueue();
163 * @brief Undefined copy constructor.
165 * This avoids accidental calls to a default copy constructor.
166 * @param[in] nativeImageSourceQueue A reference to the object to copy
168 DALI_INTERNAL NativeImageSourceQueue( const NativeImageSourceQueue& nativeImageSourceQueue );
171 * @brief Undefined assignment operator.
173 * This avoids accidental calls to a default assignment operator.
174 * @param[in] rhs A reference to the object to copy
176 DALI_INTERNAL NativeImageSourceQueue& operator=(const NativeImageSourceQueue& rhs);
182 std::unique_ptr< Internal::Adaptor::NativeImageSourceQueue > mImpl; ///< Implementation pointer
191 #endif // DALI_NATIVE_IMAGE_SOURCE_QUEUE_H