-#ifndef __DALI_TOOLKIT_IMAGE_VIEW_H__
-#define __DALI_TOOLKIT_IMAGE_VIEW_H__
+#ifndef DALI_TOOLKIT_IMAGE_VIEW_H
+#define DALI_TOOLKIT_IMAGE_VIEW_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal DALI_INTERNAL
{
class ImageView;
*/
/**
+ * @brief ImageView is a class for displaying an image resource.
+ *
+ * An instance of ImageView can be created using a URL or an Image instance.
+ *
+ * Some resources can be loaded before the ImageView is staged ( already cached ), in these cases if the connection to
+ * ResouceReadySignal is done after the resource is set then signal will be missed.
+ *
+ * To protect against this, IsResourceReady() can be checked before connecting to ResourceReadySignal,
+ * or the signal connection can be done before setting the resource.
+ *
+ * @code
+ * auto myImageView = ImageView::New( resourceUrl );
+ * if ( myImageView.IsResourceReady() )
+ * {
+ * // do something
+ * }
+ * else
+ * {
+ * myImageView.ResourceReadySignal.Connect( .... )
+ * }
+ * @endcode
+ *
+ * OR Connect to signal before setting resource
+ *
+ * @code
+ * auto myImageView = ImageView::New();
+ * myImageView.ResourceReadySignal.Connect( .... )
+ * myImageView.SetProperty( ImageView::Property::IMAGE, resourceUrl );
+ * @endcode
+ *
+ * @SINCE_1_0.0
*
- * @brief ImageView is a class for displaying an Image.
*/
-class DALI_IMPORT_API ImageView : public Control
+class DALI_TOOLKIT_API ImageView : public Control
{
public:
/**
- * @brief The start and end property ranges for this control.
+ * @brief Enumeration for the start and end property ranges for this control.
+ * @SINCE_1_0.0
*/
enum PropertyRange
{
- PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
- PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000, ///< Reserve property indices
+ PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, ///< @SINCE_1_0.0
+ PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000, ///< Reserve property indices @SINCE_1_0.0
- ANIMATABLE_PROPERTY_START_INDEX = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX, ///< @since DALi 1.1.18
- ANIMATABLE_PROPERTY_END_INDEX = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1000 ///< Reserve animatable property indices, @since DALi 1.1.18
+ ANIMATABLE_PROPERTY_START_INDEX = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX, ///< @SINCE_1_1.18
+ ANIMATABLE_PROPERTY_END_INDEX = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1000 ///< Reserve animatable property indices, @SINCE_1_1.18
};
/**
- * @brief An enumeration of properties belonging to the ImageView class.
+ * @brief Enumeration for the instance of properties belonging to the ImageView class.
+ * @SINCE_1_0.0
*/
struct Property
{
+ /**
+ * @brief Enumeration for the instance of properties belonging to the ImageView class.
+ * @SINCE_1_0.0
+ */
enum
{
// Event side properties
- RESOURCE_URL = PROPERTY_START_INDEX, ///< name "resourceUrl", @deprecated DALi 1.1.16 Use IMAGE instead. type string
- IMAGE, ///< name "image", @see SetImage(), type string if it is a url, map otherwise
+
+ /**
+ * @brief name "image", type string if it is a url, map otherwise.
+ * @SINCE_1_0.0
+ */
+ IMAGE = PROPERTY_START_INDEX,
+
+ /**
+ * @brief name "preMultipliedAlpha", type Boolean.
+ * @SINCE_1_1.18
+ * @pre image must be initialized.
+ */
+ PRE_MULTIPLIED_ALPHA,
// Animatable properties
- PIXEL_AREA = ANIMATABLE_PROPERTY_START_INDEX, ///< name "pixelArea", @since DALi 1.1.18 type Vector4, Pixel area is a relative value with the whole image area as [0.0, 0.0, 1.0, 1.0].
+
+ /**
+ * @brief name "pixelArea", type Vector4.
+ * @details Pixel area is a relative value with the whole image area as [0.0, 0.0, 1.0, 1.0].
+ * @SINCE_1_1.18
+ */
+ PIXEL_AREA = ANIMATABLE_PROPERTY_START_INDEX,
};
};
public:
-
/**
- * @brief Create an uninitialized ImageView.
+ * @brief Creates an uninitialized ImageView.
+ * @SINCE_1_0.0
*/
ImageView();
/**
* @brief Create an initialized ImageView.
*
- * @return A handle to a newly allocated Dali ImageView.
+ * @SINCE_1_0.0
+ * @return A handle to a newly allocated Dali ImageView
*
* @note ImageView will not display anything.
*/
static ImageView New();
/**
- * @brief Create an initialized ImageView from an Image.
- *
- * If the handle is empty, ImageView will not display anything.
- *
- * @param[in] image The Image to display.
- * @return A handle to a newly allocated ImageView.
- */
- static ImageView New( Image image );
-
- /**
- * @brief Create an initialized ImageView from an Image resource URL
+ * @brief Creates an initialized ImageView from an URL to an image resource.
*
* If the string is empty, ImageView will not display anything.
*
- * @param[in] url The url of the image resource to display.
- * @return A handle to a newly allocated ImageView.
+ * @SINCE_1_0.0
+ * @REMARK_INTERNET
+ * @REMARK_STORAGE
+ * @param[in] url The url of the image resource to display
+ * @return A handle to a newly allocated ImageView
*/
- static ImageView New( const std::string& url );
+ static ImageView New(const std::string& url);
/**
- * @brief Create an initialized ImageView from an Image resource URL
+ * @brief Creates an initialized ImageView from a URL to an image resource.
*
* If the string is empty, ImageView will not display anything.
*
- * @since DALi 1.1.10
- *
- * @param[in] url The url of the image resource to display.
- * @param [in] size The width and height to fit the loaded image to.
- * @return A handle to a newly allocated ImageView.
- *
+ * @SINCE_1_1.10
+ * @REMARK_INTERNET
+ * @REMARK_STORAGE
+ * @param[in] url The url of the image resource to display
+ * @param [in] size The width and height to which to fit the loaded image
+ * @return A handle to a newly allocated ImageView
* @note A valid size is preferable for efficiency.
* However, do not set a size that is bigger than the actual image size, as up-scaling is not available.
* The content of the area not covered by the actual image is undefined and will not be cleared.
*/
- static ImageView New( const std::string& url, ImageDimensions size );
+ static ImageView New(const std::string& url, ImageDimensions size);
/**
- * @brief Destructor
+ * @brief Destructor.
*
* This is non-virtual since derived Handle types must not contain data or virtual methods.
+ * @SINCE_1_0.0
*/
~ImageView();
/**
* @brief Copy constructor.
*
+ * @SINCE_1_0.0
* @param[in] imageView ImageView to copy. The copied ImageView will point at the same implementation
*/
- ImageView( const ImageView& imageView );
+ ImageView(const ImageView& imageView);
/**
- * @brief Assignment operator.
+ * @brief Move constructor
+ * @SINCE_1_9.23
*
- * @param[in] imageView The ImageView to assign from.
- * @return The updated ImageView.
+ * @param[in] rhs A reference to the moved handle
*/
- ImageView& operator=( const ImageView& imageView );
+ ImageView(ImageView&& rhs);
/**
- * @brief Downcast an Object handle to ImageView.
- *
- * If handle points to a ImageView the downcast produces valid
- * handle. If not the returned handle is left uninitialized.
+ * @brief Assignment operator.
*
- * @param[in] handle Handle to an object
- * @return handle to a ImageView or an uninitialized handle
+ * @SINCE_1_0.0
+ * @param[in] imageView The ImageView to assign from
+ * @return The updated ImageView
*/
- static ImageView DownCast( BaseHandle handle );
+ ImageView& operator=(const ImageView& imageView);
/**
- * @brief Sets this ImageView from an Image
+ * @brief Move assignment
+ * @SINCE_1_9.23
*
- * If the handle is empty, ImageView will display nothing
- * @param[in] image The Image to display.
+ * @param[in] rhs A reference to the moved handle
+ * @return A reference to this
*/
- void SetImage( Image image );
+ ImageView& operator=(ImageView&& rhs);
/**
- * @brief Sets this ImageView from an Image URL
+ * @brief Downcasts a handle to ImageView handle.
*
- * If the URL is empty, ImageView will not display anything.
- *
- * @since DALi 1.1.4
+ * If handle points to a ImageView, the downcast produces valid handle.
+ * If not, the returned handle is left uninitialized.
*
- * @param[in] url The Image resource to display.
+ * @SINCE_1_0.0
+ * @param[in] handle Handle to an object
+ * @return Handle to a ImageView or an uninitialized handle
*/
- void SetImage( const std::string& url );
+ static ImageView DownCast(BaseHandle handle);
/**
- * @brief Sets this ImageView from an Image URL
+ * @brief Sets this ImageView from the given URL.
*
* If the URL is empty, ImageView will not display anything.
*
- * @since DALi 1.1.10
- *
- * @param[in] url A URL to the image resource to display.
- * @param [in] size The width and height to fit the loaded image to.
+ * @SINCE_1_1.4
+ * @REMARK_INTERNET
+ * @REMARK_STORAGE
+ * @param[in] url The URL to the image resource to display
*/
- void SetImage( const std::string& url, ImageDimensions size );
+ void SetImage(const std::string& url);
/**
- * @deprecated Gets the Image
+ * @brief Sets this ImageView from the given URL.
*
- * @return The Image currently set to this ImageView
+ * If the URL is empty, ImageView will not display anything.
+ *
+ * @SINCE_1_1.10
+ * @REMARK_INTERNET
+ * @REMARK_STORAGE
+ * @param[in] url The URL to the image resource to display
+ * @param [in] size The width and height to fit the loaded image to
*/
- Image GetImage() const;
+ void SetImage(const std::string& url, ImageDimensions size);
public: // Not intended for application developers
-
+ /// @cond internal
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
*
- * @param[in] implementation The ImageView implementation.
+ * @SINCE_1_0.0
+ * @param[in] implementation The ImageView implementation
*/
- DALI_INTERNAL ImageView( Internal::ImageView& implementation );
+ DALI_INTERNAL ImageView(Internal::ImageView& implementation);
/**
* @brief Allows the creation of this ImageView from an Internal::CustomActor pointer.
*
- * @param[in] internal A pointer to the internal CustomActor.
+ * @SINCE_1_0.0
+ * @param[in] internal A pointer to the internal CustomActor
*/
- DALI_INTERNAL ImageView( Dali::Internal::CustomActor* internal );
-
+ DALI_INTERNAL ImageView(Dali::Internal::CustomActor* internal);
+ /// @endcond
};
/**
} // namespace Dali
-#endif // __DALI_TOOLKIT_IMAGE_VIEW_H__
+#endif // DALI_TOOLKIT_IMAGE_VIEW_H