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>
27 #include <dali/public-api/dali-adaptor-common.h>
32 * @addtogroup dali_adaptor_framework
36 namespace Internal DALI_INTERNAL
40 class NativeImageSourceQueue;
44 class NativeImageSourceQueue;
47 * @brief Pointer to Dali::NativeImageSourceQueue.
49 typedef Dali::IntrusivePtr< Dali::NativeImageSourceQueue > NativeImageSourceQueuePtr;
52 * @brief Used for displaying native images.
54 * NativeImageSource can be created internally or externally by native image source.
55 * NativeImage is a platform specific way of providing pixel data to the GPU for rendering,for example via an EGL image.
57 class DALI_ADAPTOR_API NativeImageSourceQueue : public NativeImageInterface
62 * @brief Enumeration for the instance when creating a native image, the color depth has to be specified.
66 COLOR_DEPTH_DEFAULT, ///< Uses the current screen default depth (recommended)
67 COLOR_DEPTH_24, ///< 24 bits per pixel
68 COLOR_DEPTH_32 ///< 32 bits per pixel
72 * @brief Creates a new NativeImageSourceQueue.
73 * Depending on hardware, the width and height may have to be a power of two.
74 * @param[in] width The width of the image
75 * @param[in] height The height of the image
76 * @param[in] depth color depth of the image
77 * @return A smart-pointer to a newly allocated image
79 static NativeImageSourceQueuePtr New( unsigned int width, unsigned int height, ColorDepth depth );
82 * @brief Creates a new NativeImageSourceQueue from an existing native image source.
84 * @param[in] nativeImageSourceQueue NativeImageSourceQueue must be a any handle with native image source
85 * @return A smart-pointer to a newly allocated image
86 * @see NativeImageInterface
88 static NativeImageSourceQueuePtr New( Any nativeImageSourceQueue );
91 * @brief Retrieves the internal native image.
93 * @return Any object containing the internal native image source queue
95 Any GetNativeImageSourceQueue();
98 * @brief Sets an existing source.
100 * @param[in] source Any handle with the source
102 void SetSource( Any source );
104 private: // native image
107 * @copydoc Dali::NativeImageInterface::GlExtensionCreate()
109 virtual bool GlExtensionCreate();
112 * @copydoc Dali::NativeImageInterface::GlExtensionDestroy()
114 virtual void GlExtensionDestroy();
117 * @copydoc Dali::NativeImageInterface::TargetTexture()
119 virtual unsigned int TargetTexture();
122 * @copydoc Dali::NativeImageInterface::PrepareTexture()
124 virtual void PrepareTexture();
127 * @copydoc Dali::NativeImageInterface::GetWidth()
129 virtual unsigned int GetWidth() const;
132 * @copydoc Dali::NativeImageInterface::GetHeight()
134 virtual unsigned int GetHeight() const;
137 * @copydoc Dali::NativeImageInterface::RequiresBlending()
139 virtual bool RequiresBlending() const;
142 * @copydoc Dali::NativeImageInterface::GetExtension()
144 NativeImageInterface::Extension* GetExtension();
150 * @brief Private constructor.
151 * @param[in] width The width of the image
152 * @param[in] height The height of the image
153 * @param[in] depth color depth of the image
154 * @param[in] nativeImageSourceQueue contains either: native image source or is empty
156 DALI_INTERNAL NativeImageSourceQueue( unsigned int width, unsigned int height, ColorDepth depth, Any nativeImageSourceQueue );
159 * @brief A reference counted object may only be deleted by calling Unreference().
161 * The implementation should destroy the NativeImage resources.
163 DALI_INTERNAL virtual ~NativeImageSourceQueue();
166 * @brief Undefined copy constructor.
168 * This avoids accidental calls to a default copy constructor.
169 * @param[in] nativeImageSourceQueue A reference to the object to copy
171 DALI_INTERNAL NativeImageSourceQueue( const NativeImageSourceQueue& nativeImageSourceQueue );
174 * @brief Undefined assignment operator.
176 * This avoids accidental calls to a default assignment operator.
177 * @param[in] rhs A reference to the object to copy
179 DALI_INTERNAL NativeImageSourceQueue& operator=(const NativeImageSourceQueue& rhs);
185 std::unique_ptr< Internal::Adaptor::NativeImageSourceQueue > mImpl; ///< Implementation pointer
194 #endif // DALI_NATIVE_IMAGE_SOURCE_QUEUE_H