Merge "Update the doxygen comment for CameraActor " into devel/master
[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 used for rendering.
42  *
43  * Image objects can be shared between Actors. This is practical if you have a visual element on screen
44  * which is repeatedly used.
45  *
46  * The image resource is released as soon as the last Image handle is released.
47  * @SINCE_1_0.0
48  * @note If a resource was shared between Image objects it exists until its last reference is gone.
49  *
50  * Image objects are responsible for the underlying resource's lifetime.
51  *
52  * Signals
53  * | %Signal Name           | Method                       |
54  * |------------------------|------------------------------|
55  * | uploaded               | @ref UploadedSignal()        |
56  * @SINCE_1_0.0
57  */
58 class DALI_IMPORT_API Image : public BaseHandle
59 {
60 public:
61
62   /**
63    * @brief Type of signal for Image Uploaded.
64    * @SINCE_1_0.0
65    */
66   typedef Signal< void (Image) > ImageSignalType;
67
68 public:
69
70   /**
71    * @brief Constructor which creates an empty Image handle.
72    *
73    * This class has no New method.
74    * Use the appropriate New method of its subclasses to create an initialized handle.
75    * (Dali::BufferImage::New(), Dali::EncodedBufferImage::New(), Dali::FrameBufferImage::New(),
76    * Dali::NativeImage::New(), Dali::ResourceImage::New())
77    * @SINCE_1_0.0
78    */
79   Image();
80
81   /**
82    * @brief Destructor
83    *
84    * This is non-virtual since derived Handle types must not contain data or virtual methods.
85    * @SINCE_1_0.0
86    */
87   ~Image();
88
89   /**
90    * @brief This copy constructor is required for (smart) pointer semantics.
91    *
92    * @SINCE_1_0.0
93    * @param [in] handle A reference to the copied handle
94    */
95   Image(const Image& handle);
96
97   /**
98    * @brief This assignment operator is required for (smart) pointer semantics.
99    *
100    * @SINCE_1_0.0
101    * @param [in] rhs  A reference to the copied handle
102    * @return A reference to this
103    */
104   Image& operator=(const Image& rhs);
105
106   /**
107    * @brief Downcast a handle to Image handle.
108    *
109    * If handle points to a Image object the
110    * downcast produces valid handle. If not the returned handle is left uninitialized.
111    * @SINCE_1_0.0
112    * @param[in] handle Handle to an object
113    * @return Handle to a Image object or an uninitialized handle
114    */
115   static Image DownCast( BaseHandle handle );
116
117   /**
118    * @brief Returns the width of the image.
119    *
120    * Returns either the requested width or the actual loaded width if no specific size was requested.
121    *
122    * @SINCE_1_0.0
123    * @return Width of the image in pixels.
124    */
125   unsigned int GetWidth() const;
126
127   /**
128    * @brief Returns the height of the image.
129    *
130    * Returns either the requested height or the actual loaded height if no specific size was requested.
131    *
132    * @SINCE_1_0.0
133    * @return Height of the image in pixels.
134    */
135   unsigned int GetHeight() const;
136
137 public: // Signals
138
139   /**
140    * @brief This signal is emitted when the image data gets uploaded to GL.
141    *
142    * It Will be sent after an actor using the image is added to
143    * the stage, when such a staged image is reloaded, or when a staged
144    * BufferImage calls Update().
145    * @SINCE_1_0.0
146    * @return A signal object to Connect() with.
147    */
148   ImageSignalType& UploadedSignal();
149
150 public: // Not intended for application developers
151
152   explicit DALI_INTERNAL Image(Internal::Image*);
153 };
154
155 /**
156  * @}
157  */
158 } // namespace Dali
159
160 #endif // __DALI_IMAGE_H__