[SRUK] Initial copy from Tizen 2.2 version
[platform/core/uifw/dali-toolkit.git] / 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 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
10 //
11 //     http://floralicense.org/license/
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 // INTERNAL INCLUDES
21 #include <dali/dali.h>
22
23 namespace Dali DALI_IMPORT_API
24 {
25
26 namespace Toolkit
27 {
28
29 /**
30  * DissolveLocalEffect is a custom shader effect to achieve Dissolve effects in multiple small areas of Image actors
31  */
32 class DissolveLocalEffect : public ShaderEffect
33 {
34 public:
35
36   /**
37    * Create an uninitialized DissolveLocalEffect; this can be initialized with DissolveLocalEffect::New()
38    * Calling member functions with an uninitialized Dali::Object is not allowed.
39    */
40   DissolveLocalEffect();
41
42   /**
43    * Virtual destructor.
44    */
45   virtual ~DissolveLocalEffect();
46
47   /**
48    * Create an initialized DissolveLocalEffect.
49    * @param[in] numberOfDimples The number of dimples
50    * @return A handle to a newly allocated Dali resource.
51    */
52   static DissolveLocalEffect New( unsigned int numberOfDimples );
53
54   /**
55    * Get the number of dimples the shader supports.
56    * @return The number of dimples in the shader.
57    */
58   unsigned int GetNumberOfDimples() const;
59
60   /**
61   * Set the transparency of the drifted pixels.
62   * @param[in] transparency The transparency of the drifted pixels.
63   */
64   void SetTransparency( float transparency);
65
66   /**
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
71    */
72   void SetCenter( unsigned int index, const Vector2& center );
73
74   /**
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
79    */
80   void SetRadius( unsigned int index, float radius );
81
82   /**
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
88    */
89   void SetDistortion( unsigned int index, float distortion );
90
91   /**
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
96    */
97   std::string GetCenterPropertyName( unsigned int index ) const;
98
99   /**
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
104    */
105   std::string GetRadiusPropertyName( unsigned int index ) const;
106
107   /**
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
112    */
113   std::string GetDistortionPropertyName( unsigned int index ) const;
114
115 private: // Not intended for application developers
116
117   DissolveLocalEffect( ShaderEffect handle );
118
119 private:
120
121   unsigned int mNumberOfDimples;  ///< The number of dimples the shader supports
122
123 };
124
125 } // namespace Toolkit
126
127 } // namespace Dali
128
129 #endif // __DALI_TOOLKIT_SHADER_EFFECT_LOCAL_DISSOLVE_H__