Add missed doxygen documentation
[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  * @SINCE_1_0.0
39  */
40 class NativeImageInterface : public Dali::RefObject
41 {
42 public:
43
44   class Extension; ///< Forward declare future extension interface
45
46   /**
47    * @brief Create the GL resource for the NativeImage.
48    *
49    * e.g. For the EglImageKHR extension, this corresponds to calling eglCreateImageKHR()
50    * @SINCE_1_0.0
51    * @return false If the initialization fails.
52    * @pre There is a GL context for the current thread.
53    */
54   virtual bool GlExtensionCreate() = 0;
55
56   /**
57    * @brief Destroy the GL resource for the NativeImage.
58    *
59    * e.g. For the EglImageKHR extension, this corresponds to calling eglDestroyImageKHR()
60    * @SINCE_1_0.0
61    * @pre There is a GL context for the current thread.
62    */
63   virtual void GlExtensionDestroy() = 0;
64
65   /**
66    * @brief Use the NativeImage as a texture for rendering.
67    *
68    * @SINCE_1_0.0
69    * @return A GL error code
70    * @pre There is a GL context for the current thread.
71    */
72   virtual unsigned int TargetTexture() = 0;
73
74   /**
75    * @brief Called internally for each Bind call for this texture to allow implementation specific operations.
76    *
77    * The correct texture sampler has already been bound before the function gets called.
78    * @SINCE_1_0.0
79    * @pre glAbstraction is being used by context in current thread
80    */
81   virtual void PrepareTexture() = 0;
82
83   /**
84    * @brief Returns the width of the NativeImage.
85    *
86    * @SINCE_1_0.0
87    * @return Width
88    */
89   virtual unsigned int GetWidth() const = 0;
90
91   /**
92    * @brief Returns the height of the NativeImage.
93    *
94    * @SINCE_1_0.0
95    * @return Height
96    */
97   virtual unsigned int GetHeight() const = 0;
98
99  /**
100   * @brief Query whether blending is required
101   * @SINCE_1_0.0
102   * @return true if blending is required
103   */
104   virtual bool RequiresBlending() const = 0;
105
106   /**
107    * @brief Retrieve the extension for the interface.
108    *
109    * @SINCE_1_0.0
110    * @return The extension if available, NULL otherwise
111    */
112   virtual Extension* GetExtension()
113   {
114     return NULL;
115   }
116
117 protected:
118
119   /**
120    * @brief A reference counted object may only be deleted by calling Unreference().
121    *
122    * The implementation should destroy the NativeImage resources.
123    * @SINCE_1_0.0
124    */
125   virtual ~NativeImageInterface()
126   {
127   }
128
129 };
130
131 /**
132  * @brief Pointer to Dali::NativeImageInterface
133  * @SINCE_1_0.0
134  */
135 typedef Dali::IntrusivePtr<NativeImageInterface>  NativeImageInterfacePtr;
136
137 /**
138  * @}
139  */
140 } // namespace Dali
141
142 #endif // __DALI_INTEGRATION_NATIVE_IMAGE_INTERFACE_H__