Merge "UTC added for Text, Multi-language." into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / shader-effects / distance-field-effect.h
1 #ifndef __DALI_TOOLKIT_SHADER_EFFECT_DISTANCEFIELD_H__
2 #define __DALI_TOOLKIT_SHADER_EFFECT_DISTANCEFIELD_H__
3
4 /*
5  * Copyright (c) 2015 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
25 {
26
27 namespace Toolkit
28 {
29
30 /**
31  * DistanceFieldEffect is a custom shader effect to achieve distance field on Image actors
32  */
33 class DALI_IMPORT_API DistanceFieldEffect : public ShaderEffect
34 {
35 public:
36
37   /**
38    * Create an uninitialized DistanceFieldEffect; this can be initialized with DistanceFieldEffect::New()
39    * Calling member functions with an uninitialized Dali::Object is not allowed.
40    */
41   DistanceFieldEffect();
42
43   /**
44    * @brief Destructor
45    *
46    * This is non-virtual since derived Handle types must not contain data or virtual methods.
47    */
48   ~DistanceFieldEffect();
49
50   /**
51    * Create an initialized DistanceFieldEffect.
52    * @return A handle to a newly allocated Dali resource.
53    */
54   static DistanceFieldEffect New();
55
56   /**
57    * Set the shadow state
58    * @param[in] shadowEnable value - true, enable shadow.
59    * @note Shadow cannot be used with glow/and or outline.
60    */
61   void SetShadow(bool shadowEnable);
62
63   /**
64    * Set the shadow color multiplier (e.g. output RGB)
65    * @param[in] color Shadow color value
66    */
67   void SetShadowColor(const Vector4& color);
68
69   /**
70    * Set the shadow offset
71    * @param[in] color shadow offset value
72    */
73   void SetShadowOffset(const Vector2& color);
74
75   /**
76    * Set the glow state
77    * @param[in] glowEnable value - true, enable glow.
78    */
79
80   void SetGlow(bool glowEnable);
81
82   /**
83    * Set the glow color multiplier (e.g. output RGB)
84    * @param[in] color Glow color value
85    */
86   void SetGlowColor(const Vector4& color);
87
88   /**
89    * Set the glow boundary factor
90    * @param[in] glowBoundary glow boundary
91    */
92   void SetGlowBoundary(float glowBoundary);
93
94   /**
95    * Set the outline state
96    * @param[in] outlineEnable value - true, enable outline.
97    */
98
99   void SetOutline(bool outlineEnable);
100
101   /**
102    * Set the outline color multiplier (e.g. output RGB)
103    * @param[in] color Outline color value
104    */
105   void SetOutlineColor(const Vector4& color);
106
107   /**
108    * Sets the outline parameters.
109    * @param[in] outlineParams  Thickness of outline. The outline thickness is determined by two parameters.
110    *              params[0] (0-1) Specifies the distance field value for the center of the outline.
111    *                      0 <= params[0] <= 1
112    *              params[1] (0-1) Specifies the softness/width/anti-aliasing of the outlines inner edge.
113    *                      0 <= params[0] <= 1
114    */
115   void SetOutlineParams(const Vector2& outlineParams);
116
117   /**
118    * Set soft edge smoothing
119    * @param[in] smoothing Specify the distance field value for the center of the edge.
120    *                      0 <= params <= 1
121    */
122   void SetSmoothingEdge(float smoothing);
123
124   /**
125    * Get the name for the outline-enable property
126    * @return A std::string containing the property name
127    */
128   const std::string& GetOutlineEnablePropertyName() const;
129
130   /**
131    * Get the name for the glow-enable property
132    * @return A std::string containing the property name
133    */
134   const std::string& GetGlowEnablePropertyName() const;
135
136   /**
137    * Get the name for the shadow-enable property
138    * @return A std::string containing the property name
139    */
140   const std::string& GetShadowEnablePropertyName() const;
141
142   /**
143    * Get the name for the radius property
144    * @return A std::string containing the property name
145    */
146   const std::string& GetColorPropertyName() const;
147
148   /**
149    * Get the name for the smoothing property
150    * @return A std::string containing the property name
151    */
152   const std::string& GetSmoothingPropertyName() const;
153
154   /**
155    * Get the name for the outline color property
156    * @return A std::string containing the property name
157    */
158   const std::string& GetOutlineColorPropertyName() const;
159
160   /**
161    * Get the name for the outline size property
162    * @return A std::string containing the property name
163    */
164   const std::string& GetOutlineSizePropertyName() const;
165
166   /**
167    * Get the name for the shadow color property
168    * @return A std::string containing the property name
169    */
170   const std::string& GetShadowColorPropertyName() const;
171
172   /**
173    * Get the name for the shadow offset property
174    * @return A std::string containing the property name
175    */
176   const std::string& GetShadowOffsetPropertyName() const;
177
178   /**
179    * Get the name for the glow color property
180    * @return A std::string containing the property name
181    */
182   const std::string& GetGlowColorPropertyName() const;
183
184   /**
185    * Get the name for the glow boundary property
186    * @return A std::string containing the property name
187    */
188   const std::string& GetGlowBoundaryPropertyName() const;
189
190 private:
191   DALI_INTERNAL DistanceFieldEffect(ShaderEffect handle);
192
193 };
194
195 } // namespace Toolkit
196
197 } // namespace Dali
198
199 #endif // __DALI_TOOLKIT_SHADER_EFFECT_SPOT_H__