#define DALI_TOOLKIT_INTERNAL_IMAGE_VIEW_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
protected:
/**
* Construct a new ImageView.
+ *
+ * @param[in] additionalBehaviour additional behaviour flags for this ImageView
*/
- ImageView();
+ ImageView(ControlBehaviour additionalBehaviour);
/**
* A reference counted object may only be deleted by calling Unreference()
public:
/**
* Create a new ImageView.
+ *
+ * @param[in] additionalBehaviour custom behavior flags for this ImageView. Default is CONTROL_BEHAVIOUR_DEFAULT
* @return A smart-pointer to the newly allocated ImageView.
*/
- static Toolkit::ImageView New();
+ static Toolkit::ImageView New(ControlBehaviour additionalBehaviour = ControlBehaviour::CONTROL_BEHAVIOUR_DEFAULT);
/**
* @brief Sets this ImageView from an Dali::Property::Map
void SetImage(const std::string& imageUrl, ImageDimensions size);
/**
+ * @brief Unregister ImageView IMAGE visual
+ *
+ * ImageView will display nothing
+ */
+ void ClearImageVisual();
+
+ /**
* @brief Set whether the Pre-multiplied Alpha Blending is required
*
* @param[in] preMultipled whether alpha is pre-multiplied.
*/
void SetDepthIndex(int depthIndex);
+ /**
+ * @brief Set the placeholder url
+ */
+ void SetPlaceholderUrl(const std::string& url);
+
+ /**
+ * @brief Get the placeholder url
+ */
+ std::string GetPlaceholderUrl() const;
+
+ /**
+ * @brief Enable the transition effect
+ */
+ void EnableTransitionEffect(bool effectEnable);
+
+ /**
+ * @brief Query whether transition effect is enabled
+ */
+ bool IsTransitionEffectEnabled() const;
+
+ /**
+ * @brief callback when animation for placeholder or previous visual transition effect is finished
+ */
+ void OnTransitionAnimationFinishedCallback(Animation& animation);
+
private: // From Control
/**
* @copydoc Toolkit::Control::OnInitialize
/**
* @brief Apply fittingMode
- * param[in] finalSize The size for fittingMode
- * param[in] textureSize The size of texture
- * param[in] offset The offset for fittingMode
- * param[in] zeroPadding whether padding is zero
- * param[in] transformMap The map for fitting image
*/
- void ApplyFittingMode(Vector2 finalSize, Vector2 textureSize, Vector2 offset, bool zeroPadding, Property::Map& transformMap);
+ void ApplyFittingMode(const Vector2& size);
+
+ /**
+ * @brief Create placeholder image if it set. placeholder image is shown when image view is waiting for the image to load.
+ */
+ void CreatePlaceholderImage();
+
+ /**
+ * @brief Show placeholder image if it set. placeholder image is shown when image view is waiting for the image to load.
+ */
+ void ShowPlaceholderImage();
+
+ /**
+ * @brief Hide placeholder image if it set.
+ */
+ void HidePlaceholderImage();
+
+ /**
+ * @brief Transition image with effect when image is replaced.
+ */
+ void TransitionImageWithEffect();
+
+ /**
+ * @brief Clear the transition animation
+ */
+ void ClearTransitionAnimation();
private:
// Undefined
private:
Toolkit::Visual::Base mVisual;
-
- std::string mUrl; ///< the url for the image if the image came from a URL, empty otherwise
- Property::Map mPropertyMap; ///< the Property::Map if the image came from a Property::Map, empty otherwise
- Property::Map mShaderMap; ///< the Property::Map if the custom shader is set, empty otherwise
- ImageDimensions mImageSize; ///< the image size
-
- bool mImageVisualPaddingSetByTransform : 1; //< Flag to indicate Padding was set using a transform.
- bool mImageViewPixelAreaSetByFittingMode : 1; //< Flag to indicate pixel area was set by fitting Mode
+ Toolkit::Visual::Base mPreviousVisual;
+ Toolkit::Visual::Base mPlaceholderVisual;
+
+ std::string mUrl; ///< the url for the image if the image came from a URL, empty otherwise
+ std::string mPlaceholderUrl; ///< the url for the placeholder image if the image came from a PLACEHOLDER_IMAGE, empty otherwise
+ Property::Map mPropertyMap; ///< the Property::Map if the image came from a Property::Map, empty otherwise
+ Property::Map mShaderMap; ///< the Property::Map if the custom shader is set, empty otherwise
+ ImageDimensions mImageSize; ///< the image size
+
+ Animation mTransitionAnimation; ///< the animation for transition effect
+ float mTransitionTargetAlpha; ///< Keep image's alpha value
+ bool mImageVisualPaddingSetByTransform : 1; ///< Flag to indicate Padding was set using a transform.
+ bool mImageViewPixelAreaSetByFittingMode : 1; ///< Flag to indicate pixel area was set by fitting Mode
+ bool mTransitionEffect :1; ///< Flag to indicate TransitionEffect is enabled
+ bool mNeedLazyFittingMode:1; ///< Flag to indicate FittingMode will be applying lazy
+ bool mImageReplaced:1; ///< Flag to indicate image is replaced
};
} // namespace Internal