0ab784f7aabad1ad1fd680381b63535ec3f6c510
[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 // INTERNAL INCLUDES
22 #include <dali/dali.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    * Virtual destructor.
45    */
46   virtual ~DissolveLocalEffect();
47
48   /**
49    * Create an initialized DissolveLocalEffect.
50    * @param[in] numberOfDimples The number of dimples
51    * @return A handle to a newly allocated Dali resource.
52    */
53   static DissolveLocalEffect New( unsigned int numberOfDimples );
54
55   /**
56    * Get the number of dimples the shader supports.
57    * @return The number of dimples in the shader.
58    */
59   unsigned int GetNumberOfDimples() const;
60
61   /**
62   * Set the transparency of the drifted pixels.
63   * @param[in] transparency The transparency of the drifted pixels.
64   */
65   void SetTransparency( float transparency);
66
67   /**
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
72    */
73   void SetCenter( unsigned int index, const Vector2& center );
74
75   /**
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
80    */
81   void SetRadius( unsigned int index, float radius );
82
83   /**
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
89    */
90   void SetDistortion( unsigned int index, float distortion );
91
92   /**
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
97    */
98   std::string GetCenterPropertyName( unsigned int index ) const;
99
100   /**
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
105    */
106   std::string GetRadiusPropertyName( unsigned int index ) const;
107
108   /**
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
113    */
114   std::string GetDistortionPropertyName( unsigned int index ) const;
115
116 private: // Not intended for application developers
117
118   DissolveLocalEffect( ShaderEffect handle );
119
120 private:
121
122   unsigned int mNumberOfDimples;  ///< The number of dimples the shader supports
123
124 };
125
126 } // namespace Toolkit
127
128 } // namespace Dali
129
130 #endif // __DALI_TOOLKIT_SHADER_EFFECT_LOCAL_DISSOLVE_H__