Update Images' public header comments
[platform/core/uifw/dali-core.git] / dali / public-api / images / image.h
1 #ifndef __DALI_IMAGE_H__
2 #define __DALI_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 // EXTERNAL INCLUDES
22 #include <string>
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/object/base-handle.h>
26 #include <dali/public-api/signals/dali-signal.h>
27
28 namespace Dali
29 {
30 /**
31  * @addtogroup dali_core_images
32  * @{
33  */
34
35 namespace Internal DALI_INTERNAL
36 {
37 class Image;
38 }
39
40 /**
41  * @brief An Image object represents an image resource that can be added to ImageViews.
42  *
43  * Image objects can be shared between ImageViews. This is practical if you have a visual element on screen
44  * which is repeatedly used. An example would be a button background image.
45  * The image resource is discarded when all ImageViews using the Image object are discarded.
46  * @SINCE_1_0.0
47  * @note If a resource was shared between Image objects it exists until its last reference is gone.
48  *
49  * Image objects are responsible for the underlying resource's lifetime.
50  *
51  * Signals
52  * | %Signal Name           | Method                       |
53  * |------------------------|------------------------------|
54  * | uploaded               | @ref UploadedSignal()        |
55  * @SINCE_1_0.0
56  */
57 class DALI_IMPORT_API Image : public BaseHandle
58 {
59 public:
60   /**
61    * @brief Resource management options.
62    */
63
64   /**
65    * @DEPRECATED_1_1.3. Image resource is released as soon as last handle is released.
66    * @brief ReleasePolicy controls the way images are deleted from memory.
67    * @SINCE_1_0.0
68    * @remarks This is an experimental feature and might not be supported in the next release.
69    * We do recommend not to use it.
70    */
71   enum ReleasePolicy
72   {
73     UNUSED, ///< release resource once image is not in use anymore (eg. all actors using it become offstage). Reload when resource is required again. @SINCE_1_0.0
74     NEVER   ///< keep image data for the lifetime of the object. (default) @SINCE_1_0.0
75   };
76
77   /**
78    * @brief Type of signal for Image Uploaded.
79    * @SINCE_1_0.0
80    */
81   typedef Signal< void (Image) > ImageSignalType;
82
83 public:
84
85   /**
86    * @brief Constructor which creates an empty Image handle.
87    *
88    * Use the appropriate New method to create an initialized handle.
89    * @SINCE_1_0.0
90    */
91   Image();
92
93   /**
94    * @brief Destructor
95    *
96    * This is non-virtual since derived Handle types must not contain data or virtual methods.
97    * @SINCE_1_0.0
98    */
99   ~Image();
100
101   /**
102    * @brief This copy constructor is required for (smart) pointer semantics.
103    *
104    * @SINCE_1_0.0
105    * @param [in] handle A reference to the copied handle
106    */
107   Image(const Image& handle);
108
109   /**
110    * @brief This assignment operator is required for (smart) pointer semantics.
111    *
112    * @SINCE_1_0.0
113    * @param [in] rhs  A reference to the copied handle
114    * @return A reference to this
115    */
116   Image& operator=(const Image& rhs);
117
118   /**
119    * @brief Downcast a handle to Image handle.
120    *
121    * If handle points to a Image object the
122    * downcast produces valid handle. If not the returned handle is left uninitialized.
123    * @SINCE_1_0.0
124    * @param[in] handle Handle to an object
125    * @return Handle to a Image object or an uninitialized handle
126    */
127   static Image DownCast( BaseHandle handle );
128
129   /**
130    * @DEPRECATED_1_1.3
131    *
132    * @brief Return resource release policy.
133    *
134    * @SINCE_1_0.0
135    * @remarks This is an experimental feature and might not be supported in the next release.
136    * We do recommend not to use it.
137    * @return Resource release policy
138    */
139   ReleasePolicy GetReleasePolicy() const;
140
141   /**
142    * @brief Returns the width of the image.
143    *
144    * Returns either the requested width or the actual loaded width if no specific size was requested.
145    *
146    * @SINCE_1_0.0
147    * @return Width of the image in pixels.
148    */
149   unsigned int GetWidth() const;
150
151   /**
152    * @brief Returns the height of the image.
153    *
154    * Returns either the requested height or the actual loaded height if no specific size was requested.
155    *
156    * @SINCE_1_0.0
157    * @return Height of the image in pixels.
158    */
159   unsigned int GetHeight() const;
160
161 public: // Signals
162
163   /**
164    * @brief This signal is emitted when the image data gets uploaded to GL.
165    *
166    * It Will be sent after an actor using the image is added to
167    * the stage, when such a staged image is reloaded, or when a staged
168    * BufferImage calls Update().
169    * @SINCE_1_0.0
170    * @return A signal object to Connect() with.
171    */
172   ImageSignalType& UploadedSignal();
173
174 public: // Not intended for application developers
175
176   explicit DALI_INTERNAL Image(Internal::Image*);
177 };
178
179 /**
180  * @}
181  */
182 } // namespace Dali
183
184 #endif // __DALI_IMAGE_H__