Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / KeyFrames.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
17 using System;
18
19 namespace Tizen.NUI
20 {
21
22     /// <summary>
23     /// A set of key frames for a property that can be animated using Dali Animation.<br>
24     /// This allows the generation of key frame objects from individual Property::Values.<br>
25     /// </summary>
26     public class KeyFrames : BaseHandle
27     {
28         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
29
30         internal KeyFrames(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.KeyFrames_SWIGUpcast(cPtr), cMemoryOwn)
31         {
32             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
33         }
34
35         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(KeyFrames obj)
36         {
37             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
38         }
39
40         protected override void Dispose(DisposeTypes type)
41         {
42             if(disposed)
43             {
44                 return;
45             }
46
47             if(type == DisposeTypes.Explicit)
48             {
49                 //Called by User
50                 //Release your own managed resources here.
51                 //You should release all of your own disposable objects here.
52             }
53
54             //Release your own unmanaged resources here.
55             //You should not access any managed member here except static instance.
56             //because the execution order of Finalizes is non-deterministic.
57
58             if (swigCPtr.Handle != global::System.IntPtr.Zero)
59             {
60                 if (swigCMemOwn)
61                 {
62                     swigCMemOwn = false;
63                     NDalicPINVOKE.delete_KeyFrames(swigCPtr);
64                 }
65                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
66             }
67
68             base.Dispose(type);
69         }
70
71
72
73         /// <summary>
74         /// Adds a key frame.
75         /// </summary>
76         /// <param name="progress">A progress value between 0.0 and 1.0</param>
77         /// <param name="value">A value</param>
78         public void Add(float progress, object value)
79         {
80             PropertyValue val = PropertyValue.CreateFromObject(value);
81             Add(progress, val);
82         }
83
84         /// <summary>
85         /// Adds a key frame.
86         /// </summary>
87         /// <param name="progress">A progress value between 0.0 and 1.0</param>
88         /// <param name="value">A value</param>
89         /// <param name="alpha">The alpha function used to blend to the next keyframe</param>
90         public void Add(float progress, object value, AlphaFunction alpha)
91         {
92             PropertyValue val = PropertyValue.CreateFromObject(value);
93             Add(progress, val, alpha);
94         }
95
96         /// <summary>
97         /// Creates an initialized KeyFrames handle.
98         /// </summary>
99         public KeyFrames() : this(NDalicPINVOKE.KeyFrames_New(), true)
100         {
101             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
102
103         }
104
105         [Obsolete("Please do not use! this will be deprecated")]
106         public static KeyFrames DownCast(BaseHandle handle)
107         {
108             KeyFrames ret =  Registry.GetManagedBaseHandleFromNativePtr(handle) as KeyFrames;
109             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
110             return ret;
111         }
112
113         /// <summary>
114         /// Gets the type of the key frame.
115         /// </summary>
116         /// <returns>The key frame property type</returns>
117         public PropertyType GetType()
118         {
119             PropertyType ret = (PropertyType)NDalicPINVOKE.KeyFrames_GetType(swigCPtr);
120             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
121             return ret;
122         }
123
124         /// <summary>
125         /// Adds a key frame.
126         /// </summary>
127         /// <param name="progress">A progress value between 0.0 and 1.0</param>
128         /// <param name="value">A value</param>
129         public void Add(float progress, PropertyValue value)
130         {
131             NDalicPINVOKE.KeyFrames_Add__SWIG_0(swigCPtr, progress, PropertyValue.getCPtr(value));
132             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
133         }
134
135         /// <summary>
136         /// Adds a key frame.
137         /// </summary>
138         /// <param name="progress">A progress value between 0.0 and 1.0</param>
139         /// <param name="value">A value</param>
140         /// <param name="alpha">The alpha function used to blend to the next keyframe</param>
141         public void Add(float progress, PropertyValue value, AlphaFunction alpha)
142         {
143             NDalicPINVOKE.KeyFrames_Add__SWIG_1(swigCPtr, progress, PropertyValue.getCPtr(value), AlphaFunction.getCPtr(alpha));
144             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
145         }
146
147     }
148
149 }