nui 0.2.32 manual merge, mapping to dali 1.2.32
[platform/core/csapi/tizenfx.git] / NUISamples / Tizen.NUI / src / public / AlphaFunction.cs
1 // Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 //
16 // This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
17 // Some have been manually changed
18
19 namespace Tizen.NUI
20 {
21
22     /// <summary>
23     /// Alpha functions are used in animations to specify the rate of change of the animation parameter over time.
24     /// Understanding an animation as a parametric function over time, the alpha function is applied to the parameter of
25     /// the animation before computing the final animation value.
26     /// </summary>
27     public class AlphaFunction : global::System.IDisposable
28     {
29         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
30         protected bool swigCMemOwn;
31
32         internal AlphaFunction(global::System.IntPtr cPtr, bool cMemoryOwn)
33         {
34             swigCMemOwn = cMemoryOwn;
35             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
36         }
37
38         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(AlphaFunction obj)
39         {
40             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
41         }
42
43         ~AlphaFunction()
44         {
45             DisposeQueue.Instance.Add(this);
46         }
47
48         /// <summary>
49         /// To make AlphaFunction instance be disposed.
50         /// </summary>
51         public virtual void Dispose()
52         {
53             if (!Stage.IsInstalled())
54             {
55                 DisposeQueue.Instance.Add(this);
56                 return;
57             }
58
59             lock (this)
60             {
61                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
62                 {
63                     if (swigCMemOwn)
64                     {
65                         swigCMemOwn = false;
66                         NDalicPINVOKE.delete_AlphaFunction(swigCPtr);
67                     }
68                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
69                 }
70                 global::System.GC.SuppressFinalize(this);
71             }
72         }
73
74         /// <summary>
75         /// Constructor.
76         /// Creates an alpha function object with user defined alpha function.
77         /// </summary>
78         /// <param name="func">User defined fuction. It must be a method formatted as float alphafunction(float progress)</param>
79         public AlphaFunction(System.Delegate func) : this(NDalicPINVOKE.new_AlphaFunction__SWIG_2(SWIGTYPE_p_f_float__float.getCPtr(new SWIGTYPE_p_f_float__float(System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func), true))), true)
80         {
81             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
82         }
83
84         /// <summary>
85         /// Default constructor.
86         /// Creates an alpha function object with the default built-in alpha function.
87         /// </summary>
88         public AlphaFunction() : this(NDalicPINVOKE.new_AlphaFunction__SWIG_0(), true)
89         {
90             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
91         }
92
93         /// <summary>
94         /// Constructor.
95         /// Creates an alpha function object with the built-in alpha function passed as a parameter to the constructor.
96         /// </summary>
97         /// <param name="function">One of the built-in alpha functions</param>
98         public AlphaFunction(AlphaFunction.BuiltinFunctions function) : this(NDalicPINVOKE.new_AlphaFunction__SWIG_1((int)function), true)
99         {
100             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
101         }
102
103         internal AlphaFunction(SWIGTYPE_p_f_float__float function) : this(NDalicPINVOKE.new_AlphaFunction__SWIG_2(SWIGTYPE_p_f_float__float.getCPtr(function)), true)
104         {
105             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
106         }
107
108         /// <summary>
109         /// Constructor.
110         /// Creates a bezier alpha function.The bezier will have the first point at(0,0) and the end point at(1,1).
111         /// Note : The x components of the control points will be clamped to the range[0, 1] to prevent non monotonic curves.
112         /// </summary>
113         /// <param name="controlPoint0">A Vector2 which will be used as the first control point of the curve</param>
114         /// <param name="controlPoint1">A Vector2 which will be used as the second control point of the curve</param>
115         public AlphaFunction(Vector2 controlPoint0, Vector2 controlPoint1) : this(NDalicPINVOKE.new_AlphaFunction__SWIG_3(Vector2.getCPtr(controlPoint0), Vector2.getCPtr(controlPoint1)), true)
116         {
117             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
118         }
119
120         /// <summary>
121         /// Retrives the control points of the alpha function.
122         /// </summary>
123         /// <param name="controlPoint0">A Vector2 which is used as the first control point of the curve</param>
124         /// <param name="controlPoint1">A Vector2 which is used as the second control point of the curve</param>
125         public void GetBezierControlPoints(out Vector2 controlPoint0, out Vector2 controlPoint1)
126         {
127             Vector4 ret = new Vector4(NDalicPINVOKE.AlphaFunction_GetBezierControlPoints(swigCPtr), true);
128             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
129
130             controlPoint0 = new Vector2(ret.X, ret.Y);
131             controlPoint1 = new Vector2(ret.Z, ret.W);
132         }
133
134         internal SWIGTYPE_p_f_float__float GetCustomFunction()
135         {
136             global::System.IntPtr cPtr = NDalicPINVOKE.AlphaFunction_GetCustomFunction(swigCPtr);
137             SWIGTYPE_p_f_float__float ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_f_float__float(cPtr, false);
138             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
139             return ret;
140         }
141
142         /// <summary>
143         /// Returns the built-in function used by the alpha function. 
144         /// In case no built-in function has been specified, it will return AlphaFunction::DEFAULT
145         /// </summary>
146         /// <returns>One of the built-in alpha functions.</returns>
147         public AlphaFunction.BuiltinFunctions GetBuiltinFunction()
148         {
149             AlphaFunction.BuiltinFunctions ret = (AlphaFunction.BuiltinFunctions)NDalicPINVOKE.AlphaFunction_GetBuiltinFunction(swigCPtr);
150             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
151             return ret;
152         }
153
154         /// <summary>
155         ///  Returns the functioning mode of the alpha function
156         /// </summary>
157         /// <returns>The functioning mode of the alpha function</returns>
158         public AlphaFunction.Modes GetMode()
159         {
160             AlphaFunction.Modes ret = (AlphaFunction.Modes)NDalicPINVOKE.AlphaFunction_GetMode(swigCPtr);
161             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
162             return ret;
163         }
164
165         /// <summary>
166         /// This specifies the various types of BuiltinFunctions
167         /// </summary>
168         public enum BuiltinFunctions
169         {
170             Default,
171             Linear,
172             Reverse,
173             EaseInSquare,
174             EaseOutSquare,
175             EaseIn,
176             EaseOut,
177             EaseInOut,
178             EaseInSine,
179             EaseOutSine,
180             EaseInOutSine,
181             Bounce,
182             Sin,
183             EaseOutBack,
184             Count
185         }
186
187         /// <summary>
188         /// This specifies which mode is set for AlphaFuction
189         /// </summary>
190         public enum Modes
191         {
192             CustomFunction = 1,
193             Bezier
194         }
195
196     }
197
198 }