/** Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using System;
namespace Tizen.NUI
{
///
/// A set of key frames for a property that can be animated using Dali Animation.
/// This allows the generation of key frame objects from individual Property::Values.
///
public class KeyFrames : BaseHandle
{
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
internal KeyFrames(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.KeyFrames_SWIGUpcast(cPtr), cMemoryOwn)
{
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(KeyFrames obj)
{
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
protected override void Dispose(DisposeTypes type)
{
if(disposed)
{
return;
}
if(type == DisposeTypes.Explicit)
{
//Called by User
//Release your own managed resources here.
//You should release all of your own disposable objects here.
}
//Release your own unmanaged resources here.
//You should not access any managed member here except static instance.
//because the execution order of Finalizes is non-deterministic.
if (swigCPtr.Handle != global::System.IntPtr.Zero)
{
if (swigCMemOwn)
{
swigCMemOwn = false;
NDalicPINVOKE.delete_KeyFrames(swigCPtr);
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
base.Dispose(type);
}
///
/// Adds a key frame.
///
/// A progress value between 0.0 and 1.0
/// A value
public void Add(float progress, object value)
{
PropertyValue val = PropertyValue.CreateFromObject(value);
Add(progress, val);
}
///
/// Adds a key frame.
///
/// A progress value between 0.0 and 1.0
/// A value
/// The alpha function used to blend to the next keyframe
public void Add(float progress, object value, AlphaFunction alpha)
{
PropertyValue val = PropertyValue.CreateFromObject(value);
Add(progress, val, alpha);
}
///
/// Creates an initialized KeyFrames handle.
///
public KeyFrames() : this(NDalicPINVOKE.KeyFrames_New(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
[Obsolete("Please do not use! this will be deprecated")]
public static KeyFrames DownCast(BaseHandle handle)
{
KeyFrames ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as KeyFrames;
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Gets the type of the key frame.
///
/// The key frame property type
public PropertyType GetType()
{
PropertyType ret = (PropertyType)NDalicPINVOKE.KeyFrames_GetType(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Adds a key frame.
///
/// A progress value between 0.0 and 1.0
/// A value
public void Add(float progress, PropertyValue value)
{
NDalicPINVOKE.KeyFrames_Add__SWIG_0(swigCPtr, progress, PropertyValue.getCPtr(value));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Adds a key frame.
///
/// A progress value between 0.0 and 1.0
/// A value
/// The alpha function used to blend to the next keyframe
public void Add(float progress, PropertyValue value, AlphaFunction alpha)
{
NDalicPINVOKE.KeyFrames_Add__SWIG_1(swigCPtr, progress, PropertyValue.getCPtr(value), AlphaFunction.getCPtr(alpha));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}
}