1 #ifndef __DALI_INTEGRATION_NATIVE_IMAGE_INTERFACE_H__
2 #define __DALI_INTEGRATION_NATIVE_IMAGE_INTERFACE_H__
5 * Copyright (c) 2015 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.
25 #include <dali/public-api/object/ref-object.h>
30 * @addtogroup dali_core_images
35 * @brief Abstract interface to provide platform-specific support for handling image data.
37 * For example, an implementation could use EGL extensions, etc.
40 class NativeImageInterface : public Dali::RefObject
44 class Extension; ///< Forward declare future extension interface
47 * @brief Creates the GL resource for the NativeImage.
49 * e.g. For the EglImageKHR extension, this corresponds to calling eglCreateImageKHR().
51 * @return false If the initialization fails
52 * @pre There is a GL context for the current thread.
54 virtual bool GlExtensionCreate() = 0;
57 * @brief Destroys the GL resource for the NativeImage.
59 * e.g. For the EglImageKHR extension, this corresponds to calling eglDestroyImageKHR().
61 * @pre There is a GL context for the current thread.
63 virtual void GlExtensionDestroy() = 0;
66 * @brief Uses the NativeImage as a texture for rendering.
69 * @return A GL error code
70 * @pre There is a GL context for the current thread.
72 virtual unsigned int TargetTexture() = 0;
75 * @brief Called internally for each Bind call for this texture to allow implementation specific operations.
77 * The correct texture sampler has already been bound before the function gets called.
79 * @pre glAbstraction is being used by context in current thread
81 virtual void PrepareTexture() = 0;
84 * @brief Returns the width of the NativeImage.
89 virtual unsigned int GetWidth() const = 0;
92 * @brief Returns the height of the NativeImage.
97 virtual unsigned int GetHeight() const = 0;
100 * @brief Queries whether blending is required.
102 * @return True if blending is required
104 virtual bool RequiresBlending() const = 0;
107 * @brief Retrieves the extension for the interface.
110 * @return The extension if available, NULL otherwise
112 virtual Extension* GetExtension()
120 * @brief A reference counted object may only be deleted by calling Unreference().
122 * The implementation should destroy the NativeImage resources.
125 virtual ~NativeImageInterface()
132 * @brief Pointer to Dali::NativeImageInterface.
135 typedef Dali::IntrusivePtr<NativeImageInterface> NativeImageInterfacePtr;
142 #endif // __DALI_INTEGRATION_NATIVE_IMAGE_INTERFACE_H__