1 #ifndef __DALI_TOOLKIT_IMAGE_VIEW_H__
2 #define __DALI_TOOLKIT_IMAGE_VIEW_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.
22 #include <dali-toolkit/public-api/controls/control.h>
25 #include <dali/public-api/images/image-operations.h>
33 namespace Internal DALI_INTERNAL
38 * @addtogroup dali_toolkit_controls_image_view
44 * @brief ImageView is a class for displaying an Image.
46 class DALI_IMPORT_API ImageView : public Control
50 * @brief The start and end property ranges for this control.
54 PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
55 PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserve property indices
59 * @brief An enumeration of properties belonging to the ImageView class.
65 RESOURCE_URL = PROPERTY_START_INDEX, ///< name "resourceUrl", @deprecated DALi 1.1.16 Use IMAGE instead. type string
66 IMAGE, ///< name "image", @see SetImage(), type string if it is a url, map otherwise
73 * @brief Create an uninitialized ImageView.
78 * @brief Create an initialized ImageView.
80 * @return A handle to a newly allocated Dali ImageView.
82 * @note ImageView will not display anything.
84 static ImageView New();
87 * @brief Create an initialized ImageView from an Image.
89 * If the handle is empty, ImageView will not display anything.
91 * @param[in] image The Image to display.
92 * @return A handle to a newly allocated ImageView.
94 static ImageView New( Image image );
97 * @brief Create an initialized ImageView from an Image resource URL
99 * If the string is empty, ImageView will not display anything.
101 * @param[in] url The url of the image resource to display.
102 * @return A handle to a newly allocated ImageView.
104 static ImageView New( const std::string& url );
107 * @brief Create an initialized ImageView from an Image resource URL
109 * If the string is empty, ImageView will not display anything.
113 * @param[in] url The url of the image resource to display.
114 * @param [in] size The width and height to fit the loaded image to.
115 * @return A handle to a newly allocated ImageView.
117 * @note A valid size is preferable for efficiency.
118 * However, do not set a size that is bigger than the actual image size, as up-scaling is not available.
119 * The content of the area not covered by the actual image is undefined and will not be cleared.
121 static ImageView New( const std::string& url, ImageDimensions size );
126 * This is non-virtual since derived Handle types must not contain data or virtual methods.
131 * @brief Copy constructor.
133 * @param[in] imageView ImageView to copy. The copied ImageView will point at the same implementation
135 ImageView( const ImageView& imageView );
138 * @brief Assignment operator.
140 * @param[in] imageView The ImageView to assign from.
141 * @return The updated ImageView.
143 ImageView& operator=( const ImageView& imageView );
146 * @brief Downcast an Object handle to ImageView.
148 * If handle points to a ImageView the downcast produces valid
149 * handle. If not the returned handle is left uninitialized.
151 * @param[in] handle Handle to an object
152 * @return handle to a ImageView or an uninitialized handle
154 static ImageView DownCast( BaseHandle handle );
157 * @brief Sets this ImageView from an Image
159 * If the handle is empty, ImageView will display nothing
160 * @param[in] image The Image to display.
162 void SetImage( Image image );
165 * @brief Sets this ImageView from an Image URL
167 * If the URL is empty, ImageView will not display anything.
171 * @param[in] url The Image resource to display.
173 void SetImage( const std::string& url );
176 * @brief Sets this ImageView from an Image URL
178 * If the URL is empty, ImageView will not display anything.
182 * @param[in] url A URL to the image resource to display.
183 * @param [in] size The width and height to fit the loaded image to.
185 void SetImage( const std::string& url, ImageDimensions size );
188 * @deprecated Gets the Image
190 * @return The Image currently set to this ImageView
192 Image GetImage() const;
194 public: // Not intended for application developers
197 * @brief Creates a handle using the Toolkit::Internal implementation.
199 * @param[in] implementation The ImageView implementation.
201 DALI_INTERNAL ImageView( Internal::ImageView& implementation );
204 * @brief Allows the creation of this ImageView from an Internal::CustomActor pointer.
206 * @param[in] internal A pointer to the internal CustomActor.
208 DALI_INTERNAL ImageView( Dali::Internal::CustomActor* internal );
215 } // namespace Toolkit
219 #endif // __DALI_TOOLKIT_IMAGE_VIEW_H__