Modify doxygen group names
[platform/core/uifw/dali-core.git] / dali / public-api / images / native-image-interface.h
1 #ifndef __DALI_INTEGRATION_NATIVE_IMAGE_INTERFACE_H__
2 #define __DALI_INTEGRATION_NATIVE_IMAGE_INTERFACE_H__
3
4 /*
5  * Copyright (c) 2015 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 #include <cstddef>
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/object/ref-object.h>
26
27 namespace Dali
28 {
29 /**
30  * @addtogroup dali_core_images
31  * @{
32  */
33
34 /**
35  * @brief Abstract interface to provide platform-specific support for handling image data.
36  *
37  * For example, an implementation could use EGL extensions, etc.
38  */
39 class NativeImageInterface : public Dali::RefObject
40 {
41 public:
42
43   class Extension; ///< Forward declare future extension interface
44
45   /**
46    * @brief Create the GL resource for the NativeImage.
47    *
48    * e.g. For the EglImageKHR extension, this corresponds to calling eglCreateImageKHR()
49    * @pre There is a GL context for the current thread.
50    * @return false If the initialization fails.
51    */
52   virtual bool GlExtensionCreate() = 0;
53
54   /**
55    * @brief Destroy the GL resource for the NativeImage.
56    *
57    * e.g. For the EglImageKHR extension, this corresponds to calling eglDestroyImageKHR()
58    * @pre There is a GL context for the current thread.
59    */
60   virtual void GlExtensionDestroy() = 0;
61
62   /**
63    * @brief Use the NativeImage as a texture for rendering.
64    *
65    * @pre There is a GL context for the current thread.
66    * @return A GL error code
67    */
68   virtual unsigned int TargetTexture() = 0;
69
70   /**
71    * @brief Called in each NativeTexture::Bind() call to allow implementation specific operations.
72    *
73    * The correct texture sampler has already been bound before the function gets called.
74    * @pre glAbstraction is being used by context in current thread
75    */
76   virtual void PrepareTexture() = 0;
77
78   /**
79    * @brief Returns the width of the NativeImage.
80    *
81    * @return width
82    */
83   virtual unsigned int GetWidth() const = 0;
84
85   /**
86    * @brief Returns the height of the NativeImage.
87    *
88    * @return height
89    */
90   virtual unsigned int GetHeight() const = 0;
91
92  /**
93   * Query whether blending is required
94   */
95   virtual bool RequiresBlending() const = 0;
96
97   /**
98    * @brief Retrieve the extension for the interface.
99    *
100    * @return The extension if available, NULL otherwise
101    */
102   virtual Extension* GetExtension()
103   {
104     return NULL;
105   }
106
107 protected:
108
109   /**
110    * @brief A reference counted object may only be deleted by calling Unreference().
111    *
112    * The implementation should destroy the NativeImage resources.
113    */
114   virtual ~NativeImageInterface()
115   {
116   }
117
118 };
119
120 /**
121  * @brief Pointer to Dali::NativeImageInterface
122  */
123 typedef IntrusivePtr<NativeImageInterface>  NativeImageInterfacePtr;
124
125 /**
126  * @}
127  */
128 } // namespace Dali
129
130 #endif // __DALI_INTEGRATION_NATIVE_IMAGE_INTERFACE_H__