86035a092b3d2a8834fe37e685b3d5ac7bba953e
[platform/core/uifw/dali-toolkit.git] / optional / dali-toolkit / public-api / shader-effects / dissolve-local-effect.h
1 #ifndef __DALI_TOOLKIT_SHADER_EFFECT_LOCAL_DISSOLVE_H__
2 #define __DALI_TOOLKIT_SHADER_EFFECT_LOCAL_DISSOLVE_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/shader-effects/shader-effect.h>
23
24 namespace Dali DALI_IMPORT_API
25 {
26
27 namespace Toolkit
28 {
29
30 /**
31  * DissolveLocalEffect is a custom shader effect to achieve Dissolve effects in multiple small areas of Image actors
32  */
33 class DissolveLocalEffect : public ShaderEffect
34 {
35 public:
36
37   /**
38    * Create an uninitialized DissolveLocalEffect; this can be initialized with DissolveLocalEffect::New()
39    * Calling member functions with an uninitialized Dali::Object is not allowed.
40    */
41   DissolveLocalEffect();
42
43   /**
44    * @brief Destructor
45    *
46    * This is non-virtual since derived Handle types must not contain data or virtual methods.
47    */
48   ~DissolveLocalEffect();
49
50   /**
51    * Create an initialized DissolveLocalEffect.
52    * @param[in] numberOfDimples The number of dimples
53    * @return A handle to a newly allocated Dali resource.
54    */
55   static DissolveLocalEffect New( unsigned int numberOfDimples );
56
57   /**
58    * Get the number of dimples the shader supports.
59    * @return The number of dimples in the shader.
60    */
61   unsigned int GetNumberOfDimples() const;
62
63   /**
64   * Set the transparency of the drifted pixels.
65   * @param[in] transparency The transparency of the drifted pixels.
66   */
67   void SetTransparency( float transparency);
68
69   /**
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
74    */
75   void SetCenter( unsigned int index, const Vector2& center );
76
77   /**
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
82    */
83   void SetRadius( unsigned int index, float radius );
84
85   /**
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
91    */
92   void SetDistortion( unsigned int index, float distortion );
93
94   /**
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
99    */
100   std::string GetCenterPropertyName( unsigned int index ) const;
101
102   /**
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
107    */
108   std::string GetRadiusPropertyName( unsigned int index ) const;
109
110   /**
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
115    */
116   std::string GetDistortionPropertyName( unsigned int index ) const;
117
118 private: // Not intended for application developers
119
120   DissolveLocalEffect( ShaderEffect handle );
121
122 private:
123
124   unsigned int mNumberOfDimples;  ///< The number of dimples the shader supports
125
126 };
127
128 } // namespace Toolkit
129
130 } // namespace Dali
131
132 #endif // __DALI_TOOLKIT_SHADER_EFFECT_LOCAL_DISSOLVE_H__