1 #ifndef __DALI_TOOLKIT_SHADER_EFFECT_LOCAL_DISSOLVE_H__
2 #define __DALI_TOOLKIT_SHADER_EFFECT_LOCAL_DISSOLVE_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
21 #include <dali/dali.h>
23 namespace Dali DALI_IMPORT_API
30 * DissolveLocalEffect is a custom shader effect to achieve Dissolve effects in multiple small areas of Image actors
32 class DissolveLocalEffect : public ShaderEffect
37 * Create an uninitialized DissolveLocalEffect; this can be initialized with DissolveLocalEffect::New()
38 * Calling member functions with an uninitialized Dali::Object is not allowed.
40 DissolveLocalEffect();
45 virtual ~DissolveLocalEffect();
48 * Create an initialized DissolveLocalEffect.
49 * @param[in] numberOfDimples The number of dimples
50 * @return A handle to a newly allocated Dali resource.
52 static DissolveLocalEffect New( unsigned int numberOfDimples );
55 * Get the number of dimples the shader supports.
56 * @return The number of dimples in the shader.
58 unsigned int GetNumberOfDimples() const;
61 * Set the transparency of the drifted pixels.
62 * @param[in] transparency The transparency of the drifted pixels.
64 void SetTransparency( float transparency);
67 * Set the certer position of a dimple.
68 * @param[in] index The index of the dimple to change.
69 * @param[in] center The center position of the dimple.
70 * @pre index has to be between 0 and GetNumberOfDimples() - 1
72 void SetCenter( unsigned int index, const Vector2& center );
75 * Set the propogation radius of a dimple.
76 * @param[in] index The index of the dimple to change.
77 * @param[in] radius The propagation radius of the dimple.
78 * @pre index has to be between 0 and GetNumberOfDimples() - 1
80 void SetRadius( unsigned int index, float radius );
83 * Sets the distortion applied to the effect texture.
84 * This value is proportional to the distortion applied; a value of zero means no distortion.
85 * @param[in] index The index of the dimple to change.
86 * @param[in] distortion The distortion value.
87 * @pre index has to be between 0 and GetNumberOfDimples() - 1
89 void SetDistortion( unsigned int index, float distortion );
92 * Get the name of the center property of a dimple.
93 * @param[in] index The index of the dimple.
94 * @return A std::string containing the property name.
95 * @pre index has to be between 0 and GetNumberOfDimples() - 1
97 std::string GetCenterPropertyName( unsigned int index ) const;
100 * Get the name of the radius property of a dimple.
101 * @param[in] index The index of the dimple.
102 * @return A std::string containing the property name
103 * @pre index has to be between 0 and GetNumberOfDimples() - 1
105 std::string GetRadiusPropertyName( unsigned int index ) const;
108 * Get the name for the distortion property of a dimple
109 * @param[in] index the index of a dimple.
110 * @return A std::string containing the property name
111 * @pre index has to be between 0 and GetNumberOfDimples() - 1
113 std::string GetDistortionPropertyName( unsigned int index ) const;
115 private: // Not intended for application developers
117 DissolveLocalEffect( ShaderEffect handle );
121 unsigned int mNumberOfDimples; ///< The number of dimples the shader supports
125 } // namespace Toolkit
129 #endif // __DALI_TOOLKIT_SHADER_EFFECT_LOCAL_DISSOLVE_H__