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 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/dali.h>
24 namespace Dali DALI_IMPORT_API
31 * DissolveLocalEffect is a custom shader effect to achieve Dissolve effects in multiple small areas of Image actors
33 class DissolveLocalEffect : public ShaderEffect
38 * Create an uninitialized DissolveLocalEffect; this can be initialized with DissolveLocalEffect::New()
39 * Calling member functions with an uninitialized Dali::Object is not allowed.
41 DissolveLocalEffect();
46 virtual ~DissolveLocalEffect();
49 * Create an initialized DissolveLocalEffect.
50 * @param[in] numberOfDimples The number of dimples
51 * @return A handle to a newly allocated Dali resource.
53 static DissolveLocalEffect New( unsigned int numberOfDimples );
56 * Get the number of dimples the shader supports.
57 * @return The number of dimples in the shader.
59 unsigned int GetNumberOfDimples() const;
62 * Set the transparency of the drifted pixels.
63 * @param[in] transparency The transparency of the drifted pixels.
65 void SetTransparency( float transparency);
68 * Set the certer position of a dimple.
69 * @param[in] index The index of the dimple to change.
70 * @param[in] center The center position of the dimple.
71 * @pre index has to be between 0 and GetNumberOfDimples() - 1
73 void SetCenter( unsigned int index, const Vector2& center );
76 * Set the propogation radius of a dimple.
77 * @param[in] index The index of the dimple to change.
78 * @param[in] radius The propagation radius of the dimple.
79 * @pre index has to be between 0 and GetNumberOfDimples() - 1
81 void SetRadius( unsigned int index, float radius );
84 * Sets the distortion applied to the effect texture.
85 * This value is proportional to the distortion applied; a value of zero means no distortion.
86 * @param[in] index The index of the dimple to change.
87 * @param[in] distortion The distortion value.
88 * @pre index has to be between 0 and GetNumberOfDimples() - 1
90 void SetDistortion( unsigned int index, float distortion );
93 * Get the name of the center property of a dimple.
94 * @param[in] index The index of the dimple.
95 * @return A std::string containing the property name.
96 * @pre index has to be between 0 and GetNumberOfDimples() - 1
98 std::string GetCenterPropertyName( unsigned int index ) const;
101 * Get the name of the radius property of a dimple.
102 * @param[in] index The index of the dimple.
103 * @return A std::string containing the property name
104 * @pre index has to be between 0 and GetNumberOfDimples() - 1
106 std::string GetRadiusPropertyName( unsigned int index ) const;
109 * Get the name for the distortion property of a dimple
110 * @param[in] index the index of a dimple.
111 * @return A std::string containing the property name
112 * @pre index has to be between 0 and GetNumberOfDimples() - 1
114 std::string GetDistortionPropertyName( unsigned int index ) const;
116 private: // Not intended for application developers
118 DissolveLocalEffect( ShaderEffect handle );
122 unsigned int mNumberOfDimples; ///< The number of dimples the shader supports
126 } // namespace Toolkit
130 #endif // __DALI_TOOLKIT_SHADER_EFFECT_LOCAL_DISSOLVE_H__