1 #ifndef __DALI_IMAGE_H__
2 #define __DALI_IMAGE_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
25 #include <dali/public-api/object/base-handle.h>
26 #include <dali/public-api/signals/dali-signal.h>
31 * @addtogroup dali_core_images
35 namespace Internal DALI_INTERNAL
41 * @brief An Image object represents an image resource that can be used for rendering.
43 * Image objects can be shared between Actors. This is practical if you have a visual element on screen
44 * which is repeatedly used.
46 * The image resource is released as soon as the last Image handle is released.
48 * @note If a resource was shared between Image objects it exists until its last reference is gone.
50 * Image objects are responsible for the underlying resource's lifetime.
53 * | %Signal Name | Method |
54 * |------------------------|------------------------------|
55 * | uploaded | @ref UploadedSignal() |
58 class DALI_IMPORT_API Image : public BaseHandle
63 * @DEPRECATED_1_1.3. Image resource is released as soon as last handle is released.
64 * @brief ReleasePolicy controls the way images are deleted from memory.
66 * @remarks This is an experimental feature and might not be supported in the next release.
67 * We do recommend not to use it.
71 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
72 NEVER ///< keep image data for the lifetime of the object. (default) @SINCE_1_0.0
76 * @brief Type of signal for Image Uploaded.
79 typedef Signal< void (Image) > ImageSignalType;
84 * @brief Constructor which creates an empty Image handle.
86 * Use the appropriate New method to create an initialized handle.
94 * This is non-virtual since derived Handle types must not contain data or virtual methods.
100 * @brief This copy constructor is required for (smart) pointer semantics.
103 * @param [in] handle A reference to the copied handle
105 Image(const Image& handle);
108 * @brief This assignment operator is required for (smart) pointer semantics.
111 * @param [in] rhs A reference to the copied handle
112 * @return A reference to this
114 Image& operator=(const Image& rhs);
117 * @brief Downcast a handle to Image handle.
119 * If handle points to a Image object the
120 * downcast produces valid handle. If not the returned handle is left uninitialized.
122 * @param[in] handle Handle to an object
123 * @return Handle to a Image object or an uninitialized handle
125 static Image DownCast( BaseHandle handle );
130 * @brief Return resource release policy.
133 * @remarks This is an experimental feature and might not be supported in the next release.
134 * We do recommend not to use it.
135 * @return Resource release policy
137 ReleasePolicy GetReleasePolicy() const;
140 * @brief Returns the width of the image.
142 * Returns either the requested width or the actual loaded width if no specific size was requested.
145 * @return Width of the image in pixels.
147 unsigned int GetWidth() const;
150 * @brief Returns the height of the image.
152 * Returns either the requested height or the actual loaded height if no specific size was requested.
155 * @return Height of the image in pixels.
157 unsigned int GetHeight() const;
162 * @brief This signal is emitted when the image data gets uploaded to GL.
164 * It Will be sent after an actor using the image is added to
165 * the stage, when such a staged image is reloaded, or when a staged
166 * BufferImage calls Update().
168 * @return A signal object to Connect() with.
170 ImageSignalType& UploadedSignal();
172 public: // Not intended for application developers
174 explicit DALI_INTERNAL Image(Internal::Image*);
182 #endif // __DALI_IMAGE_H__