using System;
using Tizen.NUI.Binding;
+using System.ComponentModel;
namespace Tizen.NUI
{
/// <summary>
/// The Color class.
/// </summary>
- [TypeConverter(typeof(ColorTypeConverter))]
+ [Tizen.NUI.Binding.TypeConverter(typeof(ColorTypeConverter))]
public class Color : global::System.IDisposable
{
- private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+
+ /// <summary>
+ /// Gets the black colored Color class.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public static readonly Color Black = new Color(0.0f, 0.0f, 0.0f, 1.0f);
+
+ /// <summary>
+ /// Gets the white colored Color class.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public static readonly Color White = new Color(1.0f, 1.0f, 1.0f, 1.0f);
+
+ /// <summary>
+ /// Gets the red colored Color class.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public static readonly Color Red = new Color(1.0f, 0.0f, 0.0f, 1.0f);
+
+ /// <summary>
+ /// Gets the green colored Color class.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public static readonly Color Green = new Color(0.0f, 1.0f, 0.0f, 1.0f);
+
+ /// <summary>
+ /// Gets the blue colored Color class.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public static readonly Color Blue = new Color(0.0f, 0.0f, 1.0f, 1.0f);
+
+ /// <summary>
+ /// Gets the yellow colored Color class.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public static readonly Color Yellow = new Color(1.0f, 1.0f, 0.0f, 1.0f);
+
+ /// <summary>
+ /// Gets the magenta colored Color class.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public static readonly Color Magenta = new Color(1.0f, 0.0f, 1.0f, 1.0f);
+
+ /// <summary>
+ /// Gets the cyan colored Color class.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public static readonly Color Cyan = new Color(0.0f, 1.0f, 1.0f, 1.0f);
+
+ /// <summary>
+ /// Gets the transparent colored Color class.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public static readonly Color Transparent = new Color(0.0f, 0.0f, 0.0f, 0.0f);
+
/// <summary>
/// swigCMemOwn
/// </summary>
/// <since_tizen> 3 </since_tizen>
protected bool swigCMemOwn;
- internal Color(global::System.IntPtr cPtr, bool cMemoryOwn)
+ /// <summary>
+ /// A Flat to check if it is already disposed.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ protected bool disposed = false;
+
+ private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+ //A Flag to check who called Dispose(). (By User or DisposeQueue)
+ private bool isDisposeQueued = false;
+
+ private readonly bool hashDummy;
+
+ /// <summary>
+ /// Default constructor
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public Color() : this(NDalicPINVOKE.new_Vector4__SWIG_0(), true)
{
- swigCMemOwn = cMemoryOwn;
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Color obj)
+
+ /// <summary>
+ /// The constructor.
+ /// </summary>
+ /// <param name="r">The red component.</param>
+ /// <param name="g">The green component.</param>
+ /// <param name="b">The blue component.</param>
+ /// <param name="a">The alpha component.</param>
+ /// <since_tizen> 3 </since_tizen>
+ public Color(float r, float g, float b, float a) : this(NDalicPINVOKE.new_Vector4__SWIG_1(ValueCheck(r), ValueCheck(g), ValueCheck(b), ValueCheck(a)), true)
{
- return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- //A Flag to check who called Dispose(). (By User or DisposeQueue)
- private bool isDisposeQueued = false;
-
/// <summary>
- /// A Flat to check if it is already disposed.
+ /// The conversion constructor from an array of four floats.
/// </summary>
+ /// <param name="array">array Array of R,G,B,A.</param>
/// <since_tizen> 3 </since_tizen>
- protected bool disposed = false;
+ public Color(float[] array) : this(NDalicPINVOKE.new_Vector4__SWIG_2(ValueCheck(array)), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ internal Color(global::System.IntPtr cPtr, bool cMemoryOwn)
+ {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+ hashDummy = false;
+ }
/// <summary>
/// Dispose.
/// <since_tizen> 3 </since_tizen>
~Color()
{
- if(!isDisposeQueued)
+ if (!isDisposeQueued)
{
isDisposeQueued = true;
DisposeQueue.Instance.Add(this);
}
/// <summary>
- /// To make a color instance be disposed.
+ /// The red component.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public void Dispose()
+ public float R
{
- //Throw excpetion if Dispose() is called in separate thread.
- if (!Window.IsInstalled())
+ set
{
- throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
+ NDalicPINVOKE.Vector4_r_set(swigCPtr, ValueCheck(value));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ get
+ {
+ float ret = NDalicPINVOKE.Vector4_r_get(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
}
+ }
- if (isDisposeQueued)
+ /// <summary>
+ /// The green component.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public float G
+ {
+ set
{
- Dispose(DisposeTypes.Implicit);
+ NDalicPINVOKE.Vector4_g_set(swigCPtr, ValueCheck(value));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- else
+ get
{
- Dispose(DisposeTypes.Explicit);
- System.GC.SuppressFinalize(this);
+ float ret = NDalicPINVOKE.Vector4_g_get(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
}
}
/// <summary>
- /// Dispose.
+ /// The blue component.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- protected virtual void Dispose(DisposeTypes type)
+ public float B
{
- if (disposed)
+ set
{
- return;
+ NDalicPINVOKE.Vector4_b_set(swigCPtr, ValueCheck(value));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
-
- if(type == DisposeTypes.Explicit)
+ get
{
- //Called by User
- //Release your own managed resources here.
- //You should release all of your own disposable objects here.
+ float ret = NDalicPINVOKE.Vector4_b_get(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
}
+ }
- //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.
+ /// <summary>
+ /// The alpha component.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public float A
+ {
+ set
+ {
+ NDalicPINVOKE.Vector4_a_set(swigCPtr, ValueCheck(value));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ get
+ {
+ float ret = NDalicPINVOKE.Vector4_a_get(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+ }
- if (swigCPtr.Handle != global::System.IntPtr.Zero)
+ /// <summary>
+ /// The array subscript operator overload.
+ /// </summary>
+ /// <param name="index">The subscript index.</param>
+ /// <returns>The float at the given index.</returns>
+ /// <since_tizen> 3 </since_tizen>
+ public float this[uint index]
+ {
+ get
{
- if (swigCMemOwn)
- {
- swigCMemOwn = false;
- NDalicPINVOKE.delete_Vector4(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ return ValueOfIndex(index);
}
- disposed = true;
+ }
+
+ /// <summary>
+ /// Converts the Color class to Vector4 class implicitly.
+ /// </summary>
+ /// <param name="color">A color to be converted to Vector4</param>
+ /// <since_tizen> 3 </since_tizen>
+ public static implicit operator Vector4(Color color)
+ {
+ return new Vector4(color.R, color.G, color.B, color.A);
+ }
+
+ /// <summary>
+ /// Converts Vector4 class to Color class implicitly.
+ /// </summary>
+ /// <param name="vec">A Vector4 to be converted to color.</param>
+ /// <since_tizen> 3 </since_tizen>
+ public static implicit operator Color(Vector4 vec)
+ {
+ return new Color(vec.R, vec.G, vec.B, vec.A);
}
/// <summary>
/// <param name="arg2">The second value.</param>
/// <returns>The color containing the result of the multiplication.</returns>
/// <since_tizen> 3 </since_tizen>
- public static Color operator*(Color arg1, float arg2)
+ public static Color operator *(Color arg1, float arg2)
{
Color result = arg1.Multiply(arg2);
return ValueCheck(result);
/// <param name="arg2">The second value.</param>
/// <returns>The color containing the result of the division.</returns>
/// <since_tizen> 3 </since_tizen>
- public static Color operator/(Color arg1, float arg2)
+ public static Color operator /(Color arg1, float arg2)
{
Color result = arg1.Divide(arg2);
return ValueCheck(result);
}
/// <summary>
- /// The array subscript operator overload.
+ /// To make a color instance be disposed.
/// </summary>
- /// <param name="index">The subscript index.</param>
- /// <returns>The float at the given index.</returns>
/// <since_tizen> 3 </since_tizen>
- public float this[uint index]
+ public void Dispose()
{
- get
+ //Throw excpetion if Dispose() is called in separate thread.
+ if (!Window.IsInstalled())
{
- return ValueOfIndex(index);
+ throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
}
- }
- internal static Color GetColorFromPtr(global::System.IntPtr cPtr)
- {
- Color ret = new Color(cPtr, false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ if (isDisposeQueued)
+ {
+ Dispose(DisposeTypes.Implicit);
+ }
+ else
+ {
+ Dispose(DisposeTypes.Explicit);
+ System.GC.SuppressFinalize(this);
+ }
}
/// <summary>
- /// Default constructor
+ /// Checks if two color classes are same.
/// </summary>
+ /// <param name="rhs">A color to be compared.</param>
+ /// <returns>If two colors are are same, then true.</returns>
/// <since_tizen> 3 </since_tizen>
- public Color() : this(NDalicPINVOKE.new_Vector4__SWIG_0(), true)
+ public bool EqualTo(Color rhs)
{
+ bool ret = NDalicPINVOKE.Vector4_EqualTo(swigCPtr, Color.getCPtr(rhs));
+
+ if (rhs == null) return false;
+
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
}
-
/// <summary>
- /// The constructor.
+ /// Checks if two color classes are different.
/// </summary>
- /// <param name="r">The red component.</param>
- /// <param name="g">The green component.</param>
- /// <param name="b">The blue component.</param>
- /// <param name="a">The alpha component.</param>
+ /// <param name="rhs">A color to be compared.</param>
+ /// <returns>If two colors are are different, then true.</returns>
/// <since_tizen> 3 </since_tizen>
- public Color(float r, float g, float b, float a) : this(NDalicPINVOKE.new_Vector4__SWIG_1(ValueCheck(r), ValueCheck(g), ValueCheck(b), ValueCheck(a)), true)
+ public bool NotEqualTo(Color rhs)
{
+ bool ret = NDalicPINVOKE.Vector4_NotEqualTo(swigCPtr, Color.getCPtr(rhs));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Color obj)
+ {
+ return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+ }
+
+ internal static Color GetColorFromPtr(global::System.IntPtr cPtr)
+ {
+ Color ret = new Color(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ internal static Color ValueCheck(Color color)
+ {
+ if (color.R < 0.0f)
+ {
+ color.R = 0.0f;
+ NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
+ }
+ else if (color.R > 1.0f)
+ {
+ color.R = 1.0f;
+ NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
+ }
+ if (color.G < 0.0f)
+ {
+ color.G = 0.0f;
+ NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
+ }
+ else if (color.G > 1.0f)
+ {
+ color.G = 1.0f;
+ NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
+ }
+ if (color.B < 0.0f)
+ {
+ color.B = 0.0f;
+ NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
+ }
+ else if (color.B > 1.0f)
+ {
+ color.B = 1.0f;
+ NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
+ }
+ if (color.A < 0.0f)
+ {
+ color.A = 0.0f;
+ NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
+ }
+ else if (color.A > 1.0f)
+ {
+ color.A = 1.0f;
+ NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
+ }
+ return color;
+ }
+
+ internal static float ValueCheck(float value)
+ {
+ if (value < 0.0f)
+ {
+ value = 0.0f;
+ NUILog.Error("The value of Parameters is invalid! Should be between [0, 1].");
+ }
+ else if (value > 1.0f)
+ {
+ value = 1.0f;
+ NUILog.Error("The value of Parameters is invalid! Should be between [0, 1].");
+ }
+ return value;
+ }
+
+ internal static float[] ValueCheck(float[] arr)
+ {
+ for (int i = 0; i < arr.Length; i++)
+ {
+ if (arr[i] < 0.0f)
+ {
+ arr[i] = 0.0f;
+ NUILog.Error("The value of Parameters is invalid! Should be between [0, 1].");
+ }
+ else if (arr[i] > 1.0f)
+ {
+ arr[i] = 1.0f;
+ NUILog.Error("The value of Parameters is invalid! Should be between [0, 1].");
+ }
+ }
+ return arr;
}
/// <summary>
- /// The conversion constructor from an array of four floats.
+ /// Dispose.
/// </summary>
- /// <param name="array">array Array of R,G,B,A.</param>
/// <since_tizen> 3 </since_tizen>
- public Color(float[] array) : this(NDalicPINVOKE.new_Vector4__SWIG_2(ValueCheck(array)), true)
+ protected virtual void Dispose(DisposeTypes type)
{
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ 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_Vector4(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ disposed = true;
}
private Color Add(Color rhs)
return ret;
}
- /// <summary>
- /// Checks if two color classes are same.
- /// </summary>
- /// <param name="rhs">A color to be compared.</param>
- /// <returns>If two colors are are same, then true.</returns>
- /// <since_tizen> 3 </since_tizen>
- public bool EqualTo(Color rhs)
- {
- bool ret = NDalicPINVOKE.Vector4_EqualTo(swigCPtr, Color.getCPtr(rhs));
-
- if (rhs == null) return false;
-
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- /// <summary>
- /// Checks if two color classes are different.
- /// </summary>
- /// <param name="rhs">A color to be compared.</param>
- /// <returns>If two colors are are different, then true.</returns>
- /// <since_tizen> 3 </since_tizen>
- public bool NotEqualTo(Color rhs)
- {
- bool ret = NDalicPINVOKE.Vector4_NotEqualTo(swigCPtr, Color.getCPtr(rhs));
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
-
- private float ValueOfIndex(uint index)
- {
- float ret = NDalicPINVOKE.Vector4_ValueOfIndex__SWIG_0(swigCPtr, index);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- /// <summary>
- /// The red component.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public float R
+ private static bool EqualsColorValue(float f1, float f2)
{
- set
- {
- NDalicPINVOKE.Vector4_r_set(swigCPtr, ValueCheck(value));
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- }
- get
+ float EPS = (float)Math.Abs(f1 * .00001);
+ if(Math.Abs(f1 - f2) <= EPS)
{
- float ret = NDalicPINVOKE.Vector4_r_get(swigCPtr);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ return true;
}
- }
-
- /// <summary>
- /// The green component.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public float G
- {
- set
- {
- NDalicPINVOKE.Vector4_g_set(swigCPtr, ValueCheck(value));
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- }
- get
+ else
{
- float ret = NDalicPINVOKE.Vector4_g_get(swigCPtr);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ return false;
}
}
- /// <summary>
- /// The blue component.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public float B
+ private static bool EqualsColor(Color c1, Color c2)
{
- set
- {
- NDalicPINVOKE.Vector4_b_set(swigCPtr, ValueCheck(value));
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- }
- get
- {
- float ret = NDalicPINVOKE.Vector4_b_get(swigCPtr);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
+ return EqualsColorValue(c1.R, c2.R) && EqualsColorValue(c1.G, c2.G)
+ && EqualsColorValue(c1.B, c2.B) && EqualsColorValue(c1.A, c2.A);
}
/// <summary>
- /// The alpha component.
+ /// Determines whether the specified object is equal to the current object.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public float A
+ /// <param name="obj">The object to compare with the current object.</param>
+ /// <returns>true if the specified object is equal to the current object; otherwise, false.</returns>
+ /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(System.Object obj)
{
- set
+ Color color = obj as Color;
+ bool equal = false;
+ if (color == null)
{
- NDalicPINVOKE.Vector4_a_set(swigCPtr, ValueCheck(value));
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return equal;
}
- get
- {
- float ret = NDalicPINVOKE.Vector4_a_get(swigCPtr);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
- }
-
- /// <summary>
- /// Gets the black colored Color class.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public static readonly Color Black = new Color(0.0f, 0.0f, 0.0f, 1.0f);
-
- /// <summary>
- /// Gets the white colored Color class.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public static readonly Color White = new Color(1.0f, 1.0f, 1.0f, 1.0f);
-
- /// <summary>
- /// Gets the red colored Color class.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public static readonly Color Red = new Color(1.0f, 0.0f, 0.0f, 1.0f);
-
- /// <summary>
- /// Gets the green colored Color class.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public static readonly Color Green = new Color(0.0f, 1.0f, 0.0f, 1.0f);
-
- /// <summary>
- /// Gets the blue colored Color class.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public static readonly Color Blue = new Color(0.0f, 0.0f, 1.0f, 1.0f);
-
- /// <summary>
- /// Gets the yellow colored Color class.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public static readonly Color Yellow = new Color(1.0f, 1.0f, 0.0f, 1.0f);
-
- /// <summary>
- /// Gets the magenta colored Color class.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public static readonly Color Magenta = new Color(1.0f, 0.0f, 1.0f, 1.0f);
-
- /// <summary>
- /// Gets the cyan colored Color class.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public static readonly Color Cyan = new Color(0.0f, 1.0f, 1.0f, 1.0f);
-
- /// <summary>
- /// Gets the transparent colored Color class.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public static readonly Color Transparent = new Color(0.0f, 0.0f, 0.0f, 0.0f);
-
- /// <summary>
- /// Converts the Color class to Vector4 class implicitly.
- /// </summary>
- /// <param name="color">A color to be converted to Vector4</param>
- /// <since_tizen> 3 </since_tizen>
- public static implicit operator Vector4(Color color)
- {
- return new Vector4(color.R, color.G, color.B, color.A);
- }
-
- /// <summary>
- /// Converts Vector4 class to Color class implicitly.
- /// </summary>
- /// <param name="vec">A Vector4 to be converted to color.</param>
- /// <since_tizen> 3 </since_tizen>
- public static implicit operator Color(Vector4 vec)
- {
- return new Color(vec.R, vec.G, vec.B, vec.A);
- }
- internal static Color ValueCheck(Color color)
- {
- if (color.R < 0.0f)
- {
- color.R = 0.0f;
- NUILog.Error( "The value of Result is invalid! Should be between [0, 1].");
- }
- else if (color.R > 1.0f)
- {
- color.R = 1.0f;
- NUILog.Error( "The value of Result is invalid! Should be between [0, 1].");
- }
- if (color.G < 0.0f)
- {
- color.G = 0.0f;
- NUILog.Error( "The value of Result is invalid! Should be between [0, 1].");
- }
- else if (color.G > 1.0f)
+ if (EqualsColor(this, color))
{
- color.G = 1.0f;
- NUILog.Error( "The value of Result is invalid! Should be between [0, 1].");
- }
- if (color.B < 0.0f)
- {
- color.B = 0.0f;
- NUILog.Error( "The value of Result is invalid! Should be between [0, 1].");
- }
- else if (color.B > 1.0f)
- {
- color.B = 1.0f;
- NUILog.Error( "The value of Result is invalid! Should be between [0, 1].");
- }
- if (color.A < 0.0f)
- {
- color.A = 0.0f;
- NUILog.Error( "The value of Result is invalid! Should be between [0, 1].");
- }
- else if (color.A > 1.0f)
- {
- color.A = 1.0f;
- NUILog.Error( "The value of Result is invalid! Should be between [0, 1].");
+ equal = true;
}
- return color;
+ return equal;
}
- internal static float ValueCheck(float value)
+ /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode()
{
- if (value < 0.0f)
- {
- value = 0.0f;
- NUILog.Error( "The value of Parameters is invalid! Should be between [0, 1].");
- }
- else if (value > 1.0f)
- {
- value = 1.0f;
- NUILog.Error( "The value of Parameters is invalid! Should be between [0, 1].");
- }
- return value;
+ return hashDummy.GetHashCode();
}
- internal static float[] ValueCheck(float[] arr)
+ private float ValueOfIndex(uint index)
{
- for(int i = 0; i < arr.Length; i++)
- {
- if (arr[i] < 0.0f)
- {
- arr[i] = 0.0f;
- NUILog.Error( "The value of Parameters is invalid! Should be between [0, 1].");
- }
- else if (arr[i] > 1.0f)
- {
- arr[i] = 1.0f;
- NUILog.Error( "The value of Parameters is invalid! Should be between [0, 1].");
- }
- }
- return arr;
+ float ret = NDalicPINVOKE.Vector4_ValueOfIndex__SWIG_0(swigCPtr, index);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
}
}