2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
26 public class Color : global::System.IDisposable
28 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
29 protected bool swigCMemOwn;
31 internal Color(global::System.IntPtr cPtr, bool cMemoryOwn)
33 swigCMemOwn = cMemoryOwn;
34 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
37 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Color obj)
39 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
44 DisposeQueue.Instance.Add(this);
47 public virtual void Dispose()
49 if (!Stage.IsInstalled())
51 DisposeQueue.Instance.Add(this);
57 if (swigCPtr.Handle != global::System.IntPtr.Zero)
62 NDalicPINVOKE.delete_Vector4(swigCPtr);
64 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
66 global::System.GC.SuppressFinalize(this);
72 /// Addition operator.
74 public static Color operator +(Color arg1, Color arg2)
76 return arg1.Add(arg2);
80 /// Subtraction operator.
82 public static Color operator -(Color arg1, Color arg2)
84 return arg1.Subtract(arg2);
88 /// Subtraction operator, void
90 public static Color operator -(Color arg1)
92 return arg1.Subtract();
96 /// Multiplication operator.
98 public static Color operator *(Color arg1, Color arg2)
100 return arg1.Multiply(arg2);
104 /// Multiplication operator, using float.
106 public static Color operator *(Color arg1, float arg2)
108 return arg1.Multiply(arg2);
112 /// Division operator.
114 public static Color operator /(Color arg1, Color arg2)
116 return arg1.Divide(arg2);
120 /// Division operator, using float.
122 public static Color operator /(Color arg1, float arg2)
124 return arg1.Divide(arg2);
128 /// Array subscript operator.
130 public float this[uint index]
134 return ValueOfIndex(index);
141 public static Color GetColorFromPtr(global::System.IntPtr cPtr)
143 Color ret = new Color(cPtr, false);
144 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
152 public Color() : this(NDalicPINVOKE.new_Vector4__SWIG_0(), true)
154 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
160 /// <param name="r">The red component</param>
161 /// <param name="g">The green component</param>
162 /// <param name="b">The blue component</param>
163 /// <param name="a">The alpha component</param>
164 public Color(float r, float g, float b, float a) : this(NDalicPINVOKE.new_Vector4__SWIG_1(r, g, b, a), true)
166 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
172 /// <param name="array">The array</param>
173 public Color(float[] array) : this(NDalicPINVOKE.new_Vector4__SWIG_2(array), true)
175 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
181 /// <param name="rhs">A reference to the copied handle</param>
182 /// <returns>A reference to this</returns>
183 private Color Add(Color rhs)
185 Color ret = new Color(NDalicPINVOKE.Vector4_Add(swigCPtr, Color.getCPtr(rhs)), true);
186 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
191 /// Add assignment operator.
193 /// <param name="rhs">A reference to the copied handle</param>
194 /// <returns>A reference to this</returns>
195 private Color AddAssign(Vector4 rhs)
197 Color ret = new Color(NDalicPINVOKE.Vector4_AddAssign(swigCPtr, Color.getCPtr(rhs)), false);
198 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
202 private Color Subtract(Color rhs)
204 Color ret = new Color(NDalicPINVOKE.Vector4_Subtract__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true);
205 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
209 private Color SubtractAssign(Color rhs)
211 Color ret = new Color(NDalicPINVOKE.Vector4_SubtractAssign(swigCPtr, Color.getCPtr(rhs)), false);
212 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
216 private Color Multiply(Color rhs)
218 Color ret = new Color(NDalicPINVOKE.Vector4_Multiply__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true);
219 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
223 private Color Multiply(float rhs)
225 Color ret = new Color(NDalicPINVOKE.Vector4_Multiply__SWIG_1(swigCPtr, rhs), true);
226 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
230 private Color MultiplyAssign(Color rhs)
232 Color ret = new Color(NDalicPINVOKE.Vector4_MultiplyAssign__SWIG_0(swigCPtr, Color.getCPtr(rhs)), false);
233 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
237 private Color MultiplyAssign(float rhs)
239 Color ret = new Color(NDalicPINVOKE.Vector4_MultiplyAssign__SWIG_1(swigCPtr, rhs), false);
240 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
244 private Color Divide(Vector4 rhs)
246 Color ret = new Color(NDalicPINVOKE.Vector4_Divide__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true);
247 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
251 private Color Divide(float rhs)
253 Color ret = new Color(NDalicPINVOKE.Vector4_Divide__SWIG_1(swigCPtr, rhs), true);
254 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
258 private Color DivideAssign(Color rhs)
260 Color ret = new Color(NDalicPINVOKE.Vector4_DivideAssign__SWIG_0(swigCPtr, Color.getCPtr(rhs)), false);
261 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
265 private Color DivideAssign(float rhs)
267 Color ret = new Color(NDalicPINVOKE.Vector4_DivideAssign__SWIG_1(swigCPtr, rhs), false);
268 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
272 private Color Subtract()
274 Color ret = new Color(NDalicPINVOKE.Vector4_Subtract__SWIG_1(swigCPtr), true);
275 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
280 /// Assignment operator.
282 /// <param name="rhs">A reference to the copied handle</param>
283 /// <returns>A reference to this</returns>
284 public bool EqualTo(Color rhs)
286 bool ret = NDalicPINVOKE.Vector4_EqualTo(swigCPtr, Color.getCPtr(rhs));
288 if (rhs == null) return false;
290 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
295 /// Assignment operator.
297 /// <param name="rhs">A reference to the copied handle</param>
298 /// <returns>A reference to this</returns>
299 public bool NotEqualTo(Color rhs)
301 bool ret = NDalicPINVOKE.Vector4_NotEqualTo(swigCPtr, Color.getCPtr(rhs));
302 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
307 private float ValueOfIndex(uint index)
309 float ret = NDalicPINVOKE.Vector4_ValueOfIndex__SWIG_0(swigCPtr, index);
310 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
315 /// The red component
321 NDalicPINVOKE.Vector4_r_set(swigCPtr, value);
322 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
326 float ret = NDalicPINVOKE.Vector4_r_get(swigCPtr);
327 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
333 /// The Green Component.
339 NDalicPINVOKE.Vector4_g_set(swigCPtr, value);
340 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
344 float ret = NDalicPINVOKE.Vector4_g_get(swigCPtr);
345 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
351 /// The Blue Component.
357 NDalicPINVOKE.Vector4_b_set(swigCPtr, value);
358 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
362 float ret = NDalicPINVOKE.Vector4_b_get(swigCPtr);
363 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
369 /// The Alpha Component.
375 NDalicPINVOKE.Vector4_a_set(swigCPtr, value);
376 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
380 float ret = NDalicPINVOKE.Vector4_a_get(swigCPtr);
381 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
389 public static Color Black
393 global::System.IntPtr cPtr = NDalicPINVOKE.BLACK_get();
394 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
395 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
403 public static Color White
407 global::System.IntPtr cPtr = NDalicPINVOKE.WHITE_get();
408 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
409 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
417 public static Color Red
421 global::System.IntPtr cPtr = NDalicPINVOKE.RED_get();
422 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
423 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
431 public static Color Green
435 global::System.IntPtr cPtr = NDalicPINVOKE.GREEN_get();
436 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
437 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
445 public static Color Blue
449 global::System.IntPtr cPtr = NDalicPINVOKE.BLUE_get();
450 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
451 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
457 /// The Yellow Color.
459 public static Color Yellow
463 global::System.IntPtr cPtr = NDalicPINVOKE.YELLOW_get();
464 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
465 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
471 /// The Magenta Color.
473 public static Color Magenta
477 global::System.IntPtr cPtr = NDalicPINVOKE.MAGENTA_get();
478 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
479 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
487 public static Color Cyan
491 global::System.IntPtr cPtr = NDalicPINVOKE.CYAN_get();
492 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
493 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
499 /// The Transparent Color.
501 public static Color Transparent
505 global::System.IntPtr cPtr = NDalicPINVOKE.TRANSPARENT_get();
506 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
507 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
512 public static implicit operator Vector4(Color color)
514 return new Vector4(color.R, color.G, color.B, color.A);
517 public static implicit operator Color(Vector4 vec)
519 return new Color(vec.R, vec.G, vec.B, vec.A);