1 #ifndef __DALI_INTEGRATION_NATIVE_IMAGE_H__
2 #define __DALI_INTEGRATION_NATIVE_IMAGE_H__
5 * Copyright (c) 2014 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/pixel.h>
23 #include <dali/public-api/object/ref-object.h>
29 * @brief Abstract interface to provide platform-specific support for handling image data.
31 * For example, an implementation could use EGL extensions, etc.
33 class NativeImage : public Dali::RefObject
38 * @brief Create the GL resource for the NativeImage.
40 * e.g. For the EglImageKHR extension, this corresponds to calling eglCreateImageKHR()
41 * @pre There is a GL context for the current thread.
42 * @return false If the initialization fails.
44 virtual bool GlExtensionCreate() = 0;
47 * @brief Destroy the GL resource for the NativeImage.
49 * e.g. For the EglImageKHR extension, this corresponds to calling eglDestroyImageKHR()
50 * @pre There is a GL context for the current thread.
52 virtual void GlExtensionDestroy() = 0;
55 * @brief Use the NativeImage as a texture for rendering.
57 * @pre There is a GL context for the current thread.
58 * @return A GL error code
60 virtual unsigned int TargetTexture() = 0;
63 * @brief Called in each NativeTexture::Bind() call to allow implementation specific operations.
65 * The correct texture sampler has already been bound before the function gets called.
66 * @pre glAbstraction is being used by context in current thread
68 virtual void PrepareTexture() = 0;
71 * @brief Returns the width of the NativeImage.
75 virtual unsigned int GetWidth() const = 0;
78 * @brief Returns the height of the NativeImage.
82 virtual unsigned int GetHeight() const = 0;
85 * @brief Returns the internal pixel NativeImage::PixelFormat of the NativeImage.
87 * @return pixel format
89 virtual Pixel::Format GetPixelFormat() const = 0;
94 * @brief A reference counted object may only be deleted by calling Unreference().
96 * The implementation should destroy the NativeImage resources.
98 virtual ~NativeImage()
105 * @brief Pointer to Dali::NativeImage
107 typedef IntrusivePtr<NativeImage> NativeImagePtr;
111 #endif // __DALI_INTEGRATION_NATIVE_IMAGE_H__