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/public-api/shader-effects/shader-effect.h>
31 * DissolveLocalEffect is a custom shader effect to achieve Dissolve effects in multiple small areas of Image actors
33 class DALI_IMPORT_API 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 * This is non-virtual since derived Handle types must not contain data or virtual methods.
48 ~DissolveLocalEffect();
51 * Create an initialized DissolveLocalEffect.
52 * @param[in] numberOfDimples The number of dimples
53 * @return A handle to a newly allocated Dali resource.
55 static DissolveLocalEffect New( unsigned int numberOfDimples );
58 * Get the number of dimples the shader supports.
59 * @return The number of dimples in the shader.
61 unsigned int GetNumberOfDimples() const;
64 * Set the transparency of the drifted pixels.
65 * @param[in] transparency The transparency of the drifted pixels.
67 void SetTransparency( float transparency);
70 * Set the certer position of a dimple.
71 * @param[in] index The index of the dimple to change.
72 * @param[in] center The center position of the dimple.
73 * @pre index has to be between 0 and GetNumberOfDimples() - 1
75 void SetCenter( unsigned int index, const Vector2& center );
78 * Set the propogation radius of a dimple.
79 * @param[in] index The index of the dimple to change.
80 * @param[in] radius The propagation radius of the dimple.
81 * @pre index has to be between 0 and GetNumberOfDimples() - 1
83 void SetRadius( unsigned int index, float radius );
86 * Sets the distortion applied to the effect texture.
87 * This value is proportional to the distortion applied; a value of zero means no distortion.
88 * @param[in] index The index of the dimple to change.
89 * @param[in] distortion The distortion value.
90 * @pre index has to be between 0 and GetNumberOfDimples() - 1
92 void SetDistortion( unsigned int index, float distortion );
95 * Get the name of the center property of a dimple.
96 * @param[in] index The index of the dimple.
97 * @return A std::string containing the property name.
98 * @pre index has to be between 0 and GetNumberOfDimples() - 1
100 std::string GetCenterPropertyName( unsigned int index ) const;
103 * Get the name of the radius property of a dimple.
104 * @param[in] index The index of the dimple.
105 * @return A std::string containing the property name
106 * @pre index has to be between 0 and GetNumberOfDimples() - 1
108 std::string GetRadiusPropertyName( unsigned int index ) const;
111 * Get the name for the distortion property of a dimple
112 * @param[in] index the index of a dimple.
113 * @return A std::string containing the property name
114 * @pre index has to be between 0 and GetNumberOfDimples() - 1
116 std::string GetDistortionPropertyName( unsigned int index ) const;
118 private: // Not intended for application developers
120 DALI_INTERNAL DissolveLocalEffect( ShaderEffect handle );
124 unsigned int mNumberOfDimples; ///< The number of dimples the shader supports
128 } // namespace Toolkit
132 #endif // __DALI_TOOLKIT_SHADER_EFFECT_LOCAL_DISSOLVE_H__