-#ifndef __DALI_TOOLKIT_SHADER_EFFECT_DISSOLVE_H__
-#define __DALI_TOOLKIT_SHADER_EFFECT_DISSOLVE_H__
+#ifndef DALI_TOOLKIT_SHADER_EFFECT_DISSOLVE_H
+#define DALI_TOOLKIT_SHADER_EFFECT_DISSOLVE_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/object/property-map.h>
+#include <string.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/dali-toolkit-common.h>
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
namespace Dali
{
-
namespace Toolkit
{
-
/**
- * @brief DissolveEffect is a custom shader effect to achieve Dissolve effects in Image actors.
+ * @brief Set the dissolve central line.
+ *
+ * Use one point (position) and one direction ( displacement ) vector to define this line
+ * As we use the texture coordinate as pixel position to calculate random offset,
+ * the line should passing through rectangle {(0,0),(0,1),(1,0),(1,1)},
+ * so make the position parameter with two component values between 0.0 to 1.0
+ * @param[in] actor The actor that registers the uniform properties
+ * @param[in] position The point ( locates within rectangle {(0,0),(0,1),(1,0),(1,1)} ) passed through by the central line
+ * @param[in] displacement The direction of the central line
+ * @param[in] initialProgress The normalised initial progress of the shader
*/
-class DALI_IMPORT_API DissolveEffect : public ShaderEffect
-{
-public:
-
- /**
- * @brief Create an uninitialized DissolveEffect; this can be initialized with DissolveEffect::New().
- *
- * Calling member functions with an uninitialized Dali::Object is not allowed.
- */
- DissolveEffect();
-
- /**
- * @brief Destructor
- *
- * This is non-virtual since derived Handle types must not contain data or virtual methods.
- */
- ~DissolveEffect();
-
- /**
- * @brief Create an initialized DissolveEffect.
- *
- * @param[in] useHighPrecision True if using high precision in fragment shader for fully random noise, false otherwise
- * @return A handle to a newly allocated Dali resource.
- */
- static DissolveEffect New( bool useHighPrecision = true);
+DALI_TOOLKIT_API void DissolveEffectSetCentralLine(Actor& actor, const Vector2& position, const Vector2& displacement, float initialProgress);
- /**
- * @brief Set the dissolve central line.
- *
- * Use one point (position) and one direction ( displacement ) vector to define this line
- * As we use the texture coordinate as pixel position to calculate random offset,
- * the line should passing through rectangle {(0,0),(0,1),(1,0),(1,1)},
- * so make the position parameter with two component values between 0.0 to 1.0
- * @param[in] position The point ( locates within rectangle {(0,0),(0,1),(1,0),(1,1)} ) passed through by the central line
- * @param[in] displacement The direction of the central line
- */
- void SetCentralLine( const Vector2& position, const Vector2& displacement );
-
- /**
- * @brief Sets the distortion applied to the effect texture.
- *
- * This value is proportional to the distortion applied; a value of zero means no distortion.
- * @param [in] distortion The distortion value.
- */
- void SetDistortion( float distortion );
-
- /**
- * @brief Get the name for the distortion property.
- *
- * @return A std::string containing the property name
- */
- const std::string& GetDistortionPropertyName() const;
+/**
+ * @brief Create a new Dissolve effect
+ *
+ * DissolveEffect is a custom shader effect to achieve Dissolve effects in image views.
+ *
+ * Animatable/Constrainable uniforms:
+ * "uPercentage" - This value is proportional to the distortion applied; a value of zero means no distortion.
+ *
+ * @param[in] useHighPrecision True if using high precision in fragment shader for fully random noise, false otherwise
+ * @return The newly created Property::Map with the dissolve effect
+ */
-private: // Not intended for application developers
- DALI_INTERNAL DissolveEffect(ShaderEffect handle);
-};
+DALI_TOOLKIT_API Property::Map CreateDissolveEffect(bool useHighPrecision = true);
} // namespace Toolkit
} // namespace Dali
-#endif // __DALI_TOOLKIT_SHADER_EFFECT_DISSOLVE_H__
+#endif // DALI_TOOLKIT_SHADER_EFFECT_DISSOLVE_H