-// 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.
-//
-//
-// This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
-// Some have been manually changed
+/*
+ * 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;
+using Tizen.NUI.Binding;
+using System.ComponentModel;
namespace Tizen.NUI
{
- using System;
-
/// <summary>
- /// Color class.
+ /// The Color class.
/// </summary>
+ [Tizen.NUI.Binding.TypeConverter(typeof(ColorTypeConverter))]
public class Color : global::System.IDisposable
{
- private global::System.Runtime.InteropServices.HandleRef swigCPtr;
- protected bool swigCMemOwn;
-
- internal Color(global::System.IntPtr cPtr, bool cMemoryOwn)
- {
- swigCMemOwn = cMemoryOwn;
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
- }
-
- 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;
- }
-
- //A Flag to check who called Dispose(). (By User or DisposeQueue)
- private bool isDisposeQueued = false;
- //A Flat to check if it is already disposed.
- protected bool disposed = false;
-
- ~Color()
- {
- if(!isDisposeQueued)
- {
- isDisposeQueued = true;
- DisposeQueue.Instance.Add(this);
- }
- }
/// <summary>
- /// To make Color instance be disposed.
+ /// Gets the black colored Color class.
/// </summary>
- public void Dispose()
- {
- //Throw excpetion if Dispose() is called in separate thread.
- if (!Window.IsInstalled())
- {
- throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
- }
-
- if (isDisposeQueued)
- {
- Dispose(DisposeTypes.Implicit);
- }
- else
- {
- Dispose(DisposeTypes.Explicit);
- System.GC.SuppressFinalize(this);
- }
- }
-
- protected virtual 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.
- }
+ /// <since_tizen> 3 </since_tizen>
+ public static readonly Color Black = new Color(0.0f, 0.0f, 0.0f, 1.0f);
- //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>
+ /// 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);
- 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;
- }
+ /// <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>
- /// Addition operator.
+ /// Gets the green colored Color class.
/// </summary>
- /// <param name="arg1">First value</param>
- /// <param name="arg2">Second value</param>
- /// <returns>A Color containing the result of the addition</returns>
- public static Color operator +(Color arg1, Color arg2)
- {
- Color result = arg1.Add(arg2);
- ValueCheck(result);
- return result;
- }
+ /// <since_tizen> 3 </since_tizen>
+ public static readonly Color Green = new Color(0.0f, 1.0f, 0.0f, 1.0f);
/// <summary>
- /// Subtraction operator.
+ /// Gets the blue colored Color class.
/// </summary>
- /// <param name="arg1">First value</param>
- /// <param name="arg2">Second value</param>
- /// <returns>A Color containing the result of the subtraction</returns>
- public static Color operator -(Color arg1, Color arg2)
- {
- Color result = arg1.Subtract(arg2);
- ValueCheck(result);
- return result;
- }
+ /// <since_tizen> 3 </since_tizen>
+ public static readonly Color Blue = new Color(0.0f, 0.0f, 1.0f, 1.0f);
/// <summary>
- /// Unary negation operator.
+ /// Gets the yellow colored Color class.
/// </summary>
- /// <param name="arg1">Target Value</param>
- /// <returns>A Color containg the negation</returns>
- public static Color operator -(Color arg1)
- {
- Color result = arg1.Subtract();
- ValueCheck(result);
- return result;
- }
+ /// <since_tizen> 3 </since_tizen>
+ public static readonly Color Yellow = new Color(1.0f, 1.0f, 0.0f, 1.0f);
/// <summary>
- /// Multiplication operator.
+ /// Gets the magenta colored Color class.
/// </summary>
- /// <param name="arg1">First Value</param>
- /// <param name="arg2">Second Value</param>
- /// <returns>A Color containing the result of the multiplication</returns>
- public static Color operator *(Color arg1, Color arg2)
- {
- Color result = arg1.Multiply(arg2);
- ValueCheck(result);
- return result;
- }
+ /// <since_tizen> 3 </since_tizen>
+ public static readonly Color Magenta = new Color(1.0f, 0.0f, 1.0f, 1.0f);
- public static Color operator*(Color arg1, float arg2)
- {
- Color result = arg1.Multiply(arg2);
- ValueCheck(result);
- return result;
- }
+ /// <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>
- /// Division operator.
+ /// Gets the transparent colored Color class.
/// </summary>
- /// <param name="arg1">First Value</param>
- /// <param name="arg2">Second Value</param>
- /// <returns>A Color containing the result of the division</returns>
- public static Color operator /(Color arg1, Color arg2)
- {
- Color result = arg1.Divide(arg2);
- ValueCheck(result);
- return result;
- }
+ /// <since_tizen> 3 </since_tizen>
+ public static readonly Color Transparent = new Color(0.0f, 0.0f, 0.0f, 0.0f);
- public static Color operator/(Color arg1, float arg2)
- {
- Color result = arg1.Divide(arg2);
- ValueCheck(result);
- return result;
- }
+ /// <summary>
+ /// swigCMemOwn
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ protected bool swigCMemOwn;
/// <summary>
- /// Array subscript operator overload.
+ /// A Flat to check if it is already disposed.
/// </summary>
- /// <param name="index">Subscript index</param>
- /// <returns>The float at the given index</returns>
- public float this[uint index]
- {
- get
- {
- return ValueOfIndex(index);
- }
- }
+ /// <since_tizen> 3 </since_tizen>
+ protected bool disposed = false;
- internal static Color GetColorFromPtr(global::System.IntPtr cPtr)
- {
- Color ret = new Color(cPtr, false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
+ 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)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
/// <summary>
- /// Constructor.
+ /// The constructor.
/// </summary>
- /// <param name="r">red component</param>
- /// <param name="g">green component</param>
- /// <param name="b">blue component</param>
- /// <param name="a">alpha component</param>
- public Color(float r, float g, float b, float a) : this(NDalicPINVOKE.new_Vector4__SWIG_1(r, g, b, a), true)
+ /// <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)
{
- ValueCheck(ref r);
- ValueCheck(ref g);
- ValueCheck(ref b);
- ValueCheck(ref a);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
- /// Conversion constructor from an array of four floats.
+ /// The conversion constructor from an array of four floats.
/// </summary>
- /// <param name="array">array Array of R,G,B,A</param>
- public Color(float[] array) : this(NDalicPINVOKE.new_Vector4__SWIG_2(array), true)
- {
- ValueCheck(ref array[0]);
- ValueCheck(ref array[1]);
- ValueCheck(ref array[2]);
- ValueCheck(ref array[3]);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- }
-
- private Color Add(Color rhs)
- {
- Color ret = new Color(NDalicPINVOKE.Vector4_Add(swigCPtr, Color.getCPtr(rhs)), true);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- private Color AddAssign(Vector4 rhs)
- {
- Color ret = new Color(NDalicPINVOKE.Vector4_AddAssign(swigCPtr, Color.getCPtr(rhs)), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- private Color Subtract(Color rhs)
- {
- Color ret = new Color(NDalicPINVOKE.Vector4_Subtract__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- private Color SubtractAssign(Color rhs)
- {
- Color ret = new Color(NDalicPINVOKE.Vector4_SubtractAssign(swigCPtr, Color.getCPtr(rhs)), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- private Color Multiply(Color rhs)
- {
- Color ret = new Color(NDalicPINVOKE.Vector4_Multiply__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- private Color Multiply(float rhs)
- {
- Color ret = new Color(NDalicPINVOKE.Vector4_Multiply__SWIG_1(swigCPtr, rhs), true);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- private Color MultiplyAssign(Color rhs)
- {
- Color ret = new Color(NDalicPINVOKE.Vector4_MultiplyAssign__SWIG_0(swigCPtr, Color.getCPtr(rhs)), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- private Color MultiplyAssign(float rhs)
- {
- Color ret = new Color(NDalicPINVOKE.Vector4_MultiplyAssign__SWIG_1(swigCPtr, rhs), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- private Color Divide(Vector4 rhs)
- {
- Color ret = new Color(NDalicPINVOKE.Vector4_Divide__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- private Color Divide(float rhs)
- {
- Color ret = new Color(NDalicPINVOKE.Vector4_Divide__SWIG_1(swigCPtr, rhs), true);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- private Color DivideAssign(Color rhs)
- {
- Color ret = new Color(NDalicPINVOKE.Vector4_DivideAssign__SWIG_0(swigCPtr, Color.getCPtr(rhs)), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- private Color DivideAssign(float rhs)
- {
- Color ret = new Color(NDalicPINVOKE.Vector4_DivideAssign__SWIG_1(swigCPtr, rhs), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- private Color Subtract()
+ /// <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)
{
- Color ret = new Color(NDalicPINVOKE.Vector4_Subtract__SWIG_1(swigCPtr), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
}
- /// <summary>
- /// Check 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>
- public bool EqualTo(Color rhs)
+ internal Color(global::System.IntPtr cPtr, bool cMemoryOwn)
{
- bool ret = NDalicPINVOKE.Vector4_EqualTo(swigCPtr, Color.getCPtr(rhs));
-
- if (rhs == null) return false;
-
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+ hashDummy = false;
}
/// <summary>
- /// Check if two Color classes are different.
+ /// Dispose.
/// </summary>
- /// <param name="rhs">A Color to be compared</param>
- /// <returns>If two Colors are are different, then true.</returns>
- 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)
+ /// <since_tizen> 3 </since_tizen>
+ ~Color()
{
- float ret = NDalicPINVOKE.Vector4_ValueOfIndex__SWIG_0(swigCPtr, index);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ if (!isDisposeQueued)
+ {
+ isDisposeQueued = true;
+ DisposeQueue.Instance.Add(this);
+ }
}
/// <summary>
- /// red component.
+ /// The red component.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
public float R
{
set
{
- ValueCheck(ref value);
- NDalicPINVOKE.Vector4_r_set(swigCPtr, value);
+ NDalicPINVOKE.Vector4_r_set(swigCPtr, ValueCheck(value));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
get
}
/// <summary>
- /// green component.
+ /// The green component.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
public float G
{
set
{
- ValueCheck(ref value);
- NDalicPINVOKE.Vector4_g_set(swigCPtr, value);
+ NDalicPINVOKE.Vector4_g_set(swigCPtr, ValueCheck(value));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
get
}
/// <summary>
- /// blue component.
+ /// The blue component.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
public float B
{
set
{
- ValueCheck(ref value);
- NDalicPINVOKE.Vector4_b_set(swigCPtr, value);
+ NDalicPINVOKE.Vector4_b_set(swigCPtr, ValueCheck(value));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
get
}
/// <summary>
- /// alpha component.
+ /// The alpha component.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
public float A
{
set
{
- ValueCheck(ref value);
- NDalicPINVOKE.Vector4_a_set(swigCPtr, value);
+ NDalicPINVOKE.Vector4_a_set(swigCPtr, ValueCheck(value));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
get
}
/// <summary>
- /// Get black colored Color class.
+ /// The array subscript operator overload.
/// </summary>
- public static Color Black
+ /// <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
{
- global::System.IntPtr cPtr = NDalicPINVOKE.BLACK_get();
- Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ return ValueOfIndex(index);
}
}
/// <summary>
- /// Get white colored Color class.
+ /// Converts the Color class to Vector4 class implicitly.
/// </summary>
- public static Color White
+ /// <param name="color">A color to be converted to Vector4</param>
+ /// <since_tizen> 3 </since_tizen>
+ public static implicit operator Vector4(Color color)
{
- get
- {
- global::System.IntPtr cPtr = NDalicPINVOKE.WHITE_get();
- Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
+ return new Vector4(color.R, color.G, color.B, color.A);
}
/// <summary>
- /// Get red colored Color class.
+ /// Converts Vector4 class to Color class implicitly.
/// </summary>
- public static Color Red
+ /// <param name="vec">A Vector4 to be converted to color.</param>
+ /// <since_tizen> 3 </since_tizen>
+ public static implicit operator Color(Vector4 vec)
{
- get
- {
- global::System.IntPtr cPtr = NDalicPINVOKE.RED_get();
- Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
+ return new Color(vec.R, vec.G, vec.B, vec.A);
}
/// <summary>
- /// Get green colored Color class.
+ /// The addition operator.
/// </summary>
- public static Color Green
+ /// <param name="arg1">The first value.</param>
+ /// <param name="arg2">The second value.</param>
+ /// <returns>The color containing the result of the addition.</returns>
+ /// <since_tizen> 3 </since_tizen>
+ public static Color operator +(Color arg1, Color arg2)
{
- get
- {
- global::System.IntPtr cPtr = NDalicPINVOKE.GREEN_get();
- Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
+ Color result = arg1.Add(arg2);
+ return ValueCheck(result);
}
/// <summary>
- /// Get blue colored Color class.
+ /// The subtraction operator.
/// </summary>
- public static Color Blue
+ /// <param name="arg1">The first value.</param>
+ /// <param name="arg2">The second value.</param>
+ /// <returns>The color containing the result of the subtraction.</returns>
+ /// <since_tizen> 3 </since_tizen>
+ public static Color operator -(Color arg1, Color arg2)
{
- get
- {
- global::System.IntPtr cPtr = NDalicPINVOKE.BLUE_get();
- Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
+ Color result = arg1.Subtract(arg2);
+ return ValueCheck(result);
}
/// <summary>
- /// Get yellow colored Color class.
+ /// The unary negation operator.
/// </summary>
- public static Color Yellow
+ /// <param name="arg1">The target value.</param>
+ /// <returns>The color containg the negation.</returns>
+ /// <since_tizen> 3 </since_tizen>
+ public static Color operator -(Color arg1)
{
- get
- {
- global::System.IntPtr cPtr = NDalicPINVOKE.YELLOW_get();
- Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
+ Color result = arg1.Subtract();
+ return ValueCheck(result);
}
/// <summary>
- /// Get magenta colored Color class.
+ /// The multiplication operator.
/// </summary>
- public static Color Magenta
+ /// <param name="arg1">The first value.</param>
+ /// <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, Color arg2)
{
- get
- {
- global::System.IntPtr cPtr = NDalicPINVOKE.MAGENTA_get();
- Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
+ Color result = arg1.Multiply(arg2);
+ return ValueCheck(result);
}
/// <summary>
- /// Get cyan colored Color class.
+ /// The multiplication operator.
/// </summary>
- public static Color Cyan
+ /// <param name="arg1">The first value.</param>
+ /// <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)
{
- get
- {
- global::System.IntPtr cPtr = NDalicPINVOKE.CYAN_get();
- Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
+ Color result = arg1.Multiply(arg2);
+ return ValueCheck(result);
}
/// <summary>
- /// Get transparent colored Color class.
+ /// The division operator.
/// </summary>
- public static Color Transparent
+ /// <param name="arg1">The first value.</param>
+ /// <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, Color arg2)
{
- get
+ Color result = arg1.Divide(arg2);
+ return ValueCheck(result);
+ }
+
+ /// <summary>
+ /// The division operator.
+ /// </summary>
+ /// <param name="arg1">The first value.</param>
+ /// <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)
+ {
+ Color result = arg1.Divide(arg2);
+ return ValueCheck(result);
+ }
+
+ /// <summary>
+ /// To make a color instance be disposed.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public void Dispose()
+ {
+ //Throw excpetion if Dispose() is called in separate thread.
+ if (!Window.IsInstalled())
{
- global::System.IntPtr cPtr = NDalicPINVOKE.TRANSPARENT_get();
- Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
+ }
+
+ if (isDisposeQueued)
+ {
+ Dispose(DisposeTypes.Implicit);
+ }
+ else
+ {
+ Dispose(DisposeTypes.Explicit);
+ System.GC.SuppressFinalize(this);
}
}
/// <summary>
- /// convert Color class to Vector4 class implicitly.
+ /// Checks if two color classes are same.
/// </summary>
- /// <param name="color">A Color to be converted to Vector4</param>
- public static implicit operator Vector4(Color color)
+ /// <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)
{
- return new Vector4(color.R, color.G, color.B, color.A);
+ 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>
- /// convert Vector4 class to Color class implicitly.
+ /// Checks if two color classes are different.
/// </summary>
- /// <param name="vec">A Vector4 to be converted to Color</param></param>
- public static implicit operator Color(Vector4 vec)
+ /// <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)
{
- return new Color(vec.R, vec.G, vec.B, vec.A);
+ 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 void ValueCheck(Color color)
+ 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;
- Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1].");
+ NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
}
else if (color.R > 1.0f)
{
color.R = 1.0f;
- Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1].");
+ NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
}
if (color.G < 0.0f)
{
color.G = 0.0f;
- Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1].");
+ NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
}
else if (color.G > 1.0f)
{
color.G = 1.0f;
- Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1].");
+ NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
}
if (color.B < 0.0f)
{
color.B = 0.0f;
- Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1].");
+ NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
}
else if (color.B > 1.0f)
{
color.B = 1.0f;
- Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1].");
+ NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
}
if (color.A < 0.0f)
{
color.A = 0.0f;
- Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1].");
+ NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
}
else if (color.A > 1.0f)
{
color.A = 1.0f;
- Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1].");
+ NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
}
+ return color;
}
- internal static void ValueCheck(ref float value)
+ internal static float ValueCheck(float value)
{
if (value < 0.0f)
{
value = 0.0f;
- Tizen.Log.Fatal("NUI", "The value of Parameters is invalid! Should be between [0, 1].");
+ NUILog.Error("The value of Parameters is invalid! Should be between [0, 1].");
}
else if (value > 1.0f)
{
value = 1.0f;
- Tizen.Log.Fatal("NUI", "The value of Parameters is invalid! Should be between [0, 1].");
+ 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>
+ /// Dispose.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ protected virtual 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_Vector4(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ disposed = true;
+ }
+
+ private Color Add(Color rhs)
+ {
+ Color ret = new Color(NDalicPINVOKE.Vector4_Add(swigCPtr, Color.getCPtr(rhs)), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ private Color AddAssign(Vector4 rhs)
+ {
+ Color ret = new Color(NDalicPINVOKE.Vector4_AddAssign(swigCPtr, Color.getCPtr(rhs)), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ private Color Subtract(Color rhs)
+ {
+ Color ret = new Color(NDalicPINVOKE.Vector4_Subtract__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ private Color SubtractAssign(Color rhs)
+ {
+ Color ret = new Color(NDalicPINVOKE.Vector4_SubtractAssign(swigCPtr, Color.getCPtr(rhs)), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ private Color Multiply(Color rhs)
+ {
+ Color ret = new Color(NDalicPINVOKE.Vector4_Multiply__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ private Color Multiply(float rhs)
+ {
+ Color ret = new Color(NDalicPINVOKE.Vector4_Multiply__SWIG_1(swigCPtr, rhs), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ private Color MultiplyAssign(Color rhs)
+ {
+ Color ret = new Color(NDalicPINVOKE.Vector4_MultiplyAssign__SWIG_0(swigCPtr, Color.getCPtr(rhs)), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ private Color MultiplyAssign(float rhs)
+ {
+ Color ret = new Color(NDalicPINVOKE.Vector4_MultiplyAssign__SWIG_1(swigCPtr, rhs), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ private Color Divide(Vector4 rhs)
+ {
+ Color ret = new Color(NDalicPINVOKE.Vector4_Divide__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ private Color Divide(float rhs)
+ {
+ Color ret = new Color(NDalicPINVOKE.Vector4_Divide__SWIG_1(swigCPtr, rhs), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ private Color DivideAssign(Color rhs)
+ {
+ Color ret = new Color(NDalicPINVOKE.Vector4_DivideAssign__SWIG_0(swigCPtr, Color.getCPtr(rhs)), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ private Color DivideAssign(float rhs)
+ {
+ Color ret = new Color(NDalicPINVOKE.Vector4_DivideAssign__SWIG_1(swigCPtr, rhs), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ private Color Subtract()
+ {
+ Color ret = new Color(NDalicPINVOKE.Vector4_Subtract__SWIG_1(swigCPtr), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ private static bool EqualsColorValue(float f1, float f2)
+ {
+ float EPS = (float)Math.Abs(f1 * .00001);
+ if(Math.Abs(f1 - f2) <= EPS)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ private static bool EqualsColor(Color c1, Color c2)
+ {
+ return EqualsColorValue(c1.R, c2.R) && EqualsColorValue(c1.G, c2.G)
+ && EqualsColorValue(c1.B, c2.B) && EqualsColorValue(c1.A, c2.A);
+ }
+
+ /// <summary>
+ /// Determines whether the specified object is equal to the current object.
+ /// </summary>
+ /// <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)
+ {
+ Color color = obj as Color;
+ bool equal = false;
+ if (color == null)
+ {
+ return equal;
+ }
+
+ if (EqualsColor(this, color))
+ {
+ equal = true;
+ }
+ return equal;
+ }
+
+ /// 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()
+ {
+ return hashDummy.GetHashCode();
+ }
+
+ private float ValueOfIndex(uint index)
+ {
+ float ret = NDalicPINVOKE.Vector4_ValueOfIndex__SWIG_0(swigCPtr, index);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
}
}