bb1050e5205d2f83f6b9b371fa330fd6c69a7208
[platform/core/uifw/dali-toolkit.git] / capi / dali-toolkit / public-api / shader-effects / iris-effect.h
1 #ifndef __DALI_TOOLKIT_SHADER_EFFECT_IRIS_H__
2 #define __DALI_TOOLKIT_SHADER_EFFECT_IRIS_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 /**
22  * @addtogroup CAPI_DALI_TOOLKIT_SHADER_EFFECTS_MODULE
23  * @{
24  */
25
26 // INTERNAL INCLUDES
27 #include <dali/dali.h>
28
29 namespace Dali DALI_IMPORT_API
30 {
31
32 namespace Toolkit
33 {
34
35 /**
36  * @brief IrisEffect is a custom shader effect to achieve iris effects in Image actors
37  */
38 class IrisEffect : public ShaderEffect
39 {
40
41 public:
42
43   /**
44    * @brief Create an uninitialized IrisEffect; this can be initialized with IrisEffect::New().
45    *
46    * Calling member functions with an uninitialized Dali::Object is not allowed.
47    */
48   IrisEffect();
49
50   /**
51    * @brief Virtual destructor.
52    */
53   virtual ~IrisEffect();
54
55   /**
56    * @brief Create an initialized IrisEffect.
57    *
58    * @return A handle to a newly allocated Dali resource.
59    */
60   static IrisEffect New();
61
62   /**
63    * @brief Set the radius of the iris effect in texture coordinate distance,
64    * i.e. 0.0 (no circle) to 1.0 (complete circle), to > 1.0 (extending
65    * outside of texture).
66    *
67    * @note For Atlas Textures results may be unpredictable.
68    *
69    * @param [in] radius The new radius.
70    */
71   void SetRadius(float radius);
72
73   /**
74    * @brief Set the blend factor of the iris effect.
75    *
76    * The lower the value, the larger the blending portion
77    * (between Opaque & Transparent)
78    *
79    * Blending will account for 1 / blendFactor of the radius
80    * of the texture.
81    *
82    * @param [in] value The new blend Factor.
83    */
84   void SetBlendFactor(float value);
85
86   /**
87    * @brief Sets the center point of the iris (in texture coordinates).
88    *
89    * @param[in] center The center point.
90    */
91   void SetCenter( const Vector2& center );
92
93   /**
94    * @brief Get the name for the radius property which can be used in Animation APIs.
95    *
96    * @return A std::string containing the property name
97    */
98   const std::string& GetRadiusPropertyName() const;
99
100   /**
101    * @brief Get the name for the blend factor property.
102    *
103    * @return A std::string containing the property name
104    */
105   const std::string& GetBlendFactorPropertyName() const;
106
107   /**
108    * @brief Get the name for the center property.
109    *
110    * @return A std::string containing the property name
111    */
112   const std::string& GetCenterPropertyName() const;
113
114
115 private: // Not intended for application developers
116   IrisEffect(ShaderEffect handle);
117 };
118
119 }
120 }
121
122 /**
123  * @}
124  */
125 #endif