Merge "Update Animation's public header comments" into devel/master
[platform/core/uifw/dali-core.git] / dali / public-api / images / native-image.h
1 #ifndef __DALI_NATIVE_IMAGE_H__
2 #define __DALI_NATIVE_IMAGE_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 // INTERNAL INCLUDES
22 #include <dali/public-api/images/image.h>
23 #include <dali/public-api/images/native-image-interface.h>
24
25 namespace Dali
26 {
27 /**
28  * @addtogroup dali_core_images
29  * @{
30  */
31
32 namespace Internal DALI_INTERNAL
33 {
34 class NativeImage;
35 }
36
37 /**
38  * @brief NativeImage represents a platform specific image resource.
39  * Its data is provided by native resources, such as shared bitmap memory or pixmap.
40  * @SINCE_1_0.0
41  */
42 class DALI_IMPORT_API  NativeImage : public Image
43 {
44 public:
45
46   /**
47    * @brief Constructor with creates an uninitialized NativeImage object.
48    *
49    * Use NativeImage::New(...) to create an initialised object.
50    * @SINCE_1_0.0
51    */
52   NativeImage();
53
54   /**
55    * @brief Destructor.
56    *
57    * This is non-virtual since derived Handle types must not contain data or virtual methods.
58    * @SINCE_1_0.0
59    */
60    ~NativeImage();
61
62    /**
63     * @brief This copy constructor is required for (smart) pointer semantics.
64     *
65     * @SINCE_1_0.0
66     * @param [in] handle A reference to the copied handle
67     */
68    NativeImage( const NativeImage& handle );
69
70   /**
71    * @brief This assignment operator is required for (smart) pointer semantics.
72    *
73    * @SINCE_1_0.0
74    * @param[in] rhs A reference to the copied handle.
75    * @return A reference to this.
76    */
77   NativeImage& operator=( const NativeImage& rhs );
78
79   /**
80    * @brief Trigger asynchronous creation of backing GL texture immediately.
81    *
82    * The normal policy is for a GL texture to created lazily when needed.
83    * This function forces the allocation of a texture to happen at the earliest
84    * opportunity.
85    *
86    * @SINCE_1_0.0
87    * @note If the application loses its GL context, native images may lose their
88    * GL textures. This function can be called again after context regain to force
89    * the creation of the GL texture if still needed.
90    */
91   void CreateGlTexture();
92
93   /**
94    * @brief Create a new NativeImage, which used native resources.
95    *
96    * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE
97    * @SINCE_1_0.0
98    * @param [in] nativeImageInterface An reference to the object of the interface implementation.
99    * @return A handle to a newly allocated object.
100    */
101   static NativeImage New( NativeImageInterface& nativeImageInterface );
102
103   /**
104    * @brief Downcast an Object handle to NativeImage handle.
105    *
106    * If handle points to a NativeImage object, the downcast produces valid handle.
107    * If not, the returned handle is left unintialized.
108    * @SINCE_1_0.0
109    * @param[in] handle Handle to an object.
110    * @return Handle to a NativeImage or an uninitialized handle.
111    */
112   static NativeImage DownCast( BaseHandle handle );
113
114   /**
115    * @brief Get custom fragment prefix for rendering a native image.
116    *
117    * @return String for custom fragment prefix
118    */
119   const char* GetCustomFragmentPreFix();
120
121   /**
122    * @brief Get custom sampler type name for rendering a native image.
123    *
124    * @return String for custom sampler type name
125    */
126   const char* GetCustomSamplerTypename();
127
128 public: // Not intended for application developers
129
130   explicit DALI_INTERNAL NativeImage( Internal::NativeImage* );
131
132 };
133
134 /**
135  * @}
136  */
137 } // namespace Dali
138
139 #endif // __DALI_NATIVE_IMAGE_H__