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.
22 public class Color : global::System.IDisposable {
23 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
24 protected bool swigCMemOwn;
26 internal Color(global::System.IntPtr cPtr, bool cMemoryOwn) {
27 swigCMemOwn = cMemoryOwn;
28 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
31 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Color obj) {
32 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
36 DisposeQueue.Instance.Add(this);
39 public virtual void Dispose() {
40 if (!Stage.IsInstalled()) {
41 DisposeQueue.Instance.Add(this);
46 if (swigCPtr.Handle != global::System.IntPtr.Zero) {
49 NDalicPINVOKE.delete_Vector4(swigCPtr);
51 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
53 global::System.GC.SuppressFinalize(this);
58 public static Color operator+(Color arg1, Color arg2) {
59 return arg1.Add(arg2);
62 public static Color operator-(Color arg1, Color arg2) {
63 return arg1.Subtract(arg2);
66 public static Color operator-(Color arg1) {
67 return arg1.Subtract();
70 public static Color operator*(Color arg1, Color arg2) {
71 return arg1.Multiply(arg2);
74 public static Color operator*(Color arg1, float arg2) {
75 return arg1.Multiply(arg2);
78 public static Color operator/(Color arg1, Color arg2) {
79 return arg1.Divide(arg2);
82 public static Color operator/(Color arg1, float arg2) {
83 return arg1.Divide(arg2);
87 public float this[uint index]
91 return ValueOfIndex(index);
95 public static Color GetColorFromPtr(global::System.IntPtr cPtr) {
96 Color ret = new Color(cPtr, false);
97 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
102 public Color() : this(NDalicPINVOKE.new_Vector4__SWIG_0(), true) {
103 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
106 public Color(float r, float g, float b, float a) : this(NDalicPINVOKE.new_Vector4__SWIG_1(r, g, b, a), true) {
107 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
110 public Color(float[] array) : this(NDalicPINVOKE.new_Vector4__SWIG_2(array), true) {
111 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
114 private Color Add(Color rhs) {
115 Color ret = new Color(NDalicPINVOKE.Vector4_Add(swigCPtr, Color.getCPtr(rhs)), true);
116 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
120 private Color AddAssign(Vector4 rhs) {
121 Color ret = new Color(NDalicPINVOKE.Vector4_AddAssign(swigCPtr, Color.getCPtr(rhs)), false);
122 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
126 private Color Subtract(Color rhs) {
127 Color ret = new Color(NDalicPINVOKE.Vector4_Subtract__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true);
128 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
132 private Color SubtractAssign(Color rhs) {
133 Color ret = new Color(NDalicPINVOKE.Vector4_SubtractAssign(swigCPtr, Color.getCPtr(rhs)), false);
134 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
138 private Color Multiply(Color rhs) {
139 Color ret = new Color(NDalicPINVOKE.Vector4_Multiply__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true);
140 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
144 private Color Multiply(float rhs) {
145 Color ret = new Color(NDalicPINVOKE.Vector4_Multiply__SWIG_1(swigCPtr, rhs), true);
146 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
150 private Color MultiplyAssign(Color rhs) {
151 Color ret = new Color(NDalicPINVOKE.Vector4_MultiplyAssign__SWIG_0(swigCPtr, Color.getCPtr(rhs)), false);
152 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
156 private Color MultiplyAssign(float rhs) {
157 Color ret = new Color(NDalicPINVOKE.Vector4_MultiplyAssign__SWIG_1(swigCPtr, rhs), false);
158 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
162 private Color Divide(Vector4 rhs) {
163 Color ret = new Color(NDalicPINVOKE.Vector4_Divide__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true);
164 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168 private Color Divide(float rhs) {
169 Color ret = new Color(NDalicPINVOKE.Vector4_Divide__SWIG_1(swigCPtr, rhs), true);
170 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
174 private Color DivideAssign(Color rhs) {
175 Color ret = new Color(NDalicPINVOKE.Vector4_DivideAssign__SWIG_0(swigCPtr, Color.getCPtr(rhs)), false);
176 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
180 private Color DivideAssign(float rhs) {
181 Color ret = new Color(NDalicPINVOKE.Vector4_DivideAssign__SWIG_1(swigCPtr, rhs), false);
182 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
186 private Color Subtract() {
187 Color ret = new Color(NDalicPINVOKE.Vector4_Subtract__SWIG_1(swigCPtr), true);
188 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
192 public bool EqualTo(Color rhs) {
193 bool ret = NDalicPINVOKE.Vector4_EqualTo(swigCPtr, Color.getCPtr(rhs));
195 if(rhs == null) return false;
197 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
201 public bool NotEqualTo(Color rhs) {
202 bool ret = NDalicPINVOKE.Vector4_NotEqualTo(swigCPtr, Color.getCPtr(rhs));
203 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
208 private float ValueOfIndex(uint index) {
209 float ret = NDalicPINVOKE.Vector4_ValueOfIndex__SWIG_0(swigCPtr, index);
210 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
216 NDalicPINVOKE.Vector4_r_set(swigCPtr, value);
217 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
220 float ret = NDalicPINVOKE.Vector4_r_get(swigCPtr);
221 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
228 NDalicPINVOKE.Vector4_g_set(swigCPtr, value);
229 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
232 float ret = NDalicPINVOKE.Vector4_g_get(swigCPtr);
233 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
240 NDalicPINVOKE.Vector4_b_set(swigCPtr, value);
241 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
244 float ret = NDalicPINVOKE.Vector4_b_get(swigCPtr);
245 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
252 NDalicPINVOKE.Vector4_a_set(swigCPtr, value);
253 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
256 float ret = NDalicPINVOKE.Vector4_a_get(swigCPtr);
257 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
262 public static Color Black {
264 global::System.IntPtr cPtr = NDalicPINVOKE.BLACK_get();
265 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
266 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
271 public static Color White {
273 global::System.IntPtr cPtr = NDalicPINVOKE.WHITE_get();
274 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
275 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
280 public static Color Red {
282 global::System.IntPtr cPtr = NDalicPINVOKE.RED_get();
283 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
284 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
289 public static Color Green {
291 global::System.IntPtr cPtr = NDalicPINVOKE.GREEN_get();
292 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
293 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
298 public static Color Blue {
300 global::System.IntPtr cPtr = NDalicPINVOKE.BLUE_get();
301 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
302 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
307 public static Color Yellow {
309 global::System.IntPtr cPtr = NDalicPINVOKE.YELLOW_get();
310 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
311 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
316 public static Color Magenta {
318 global::System.IntPtr cPtr = NDalicPINVOKE.MAGENTA_get();
319 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
320 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
325 public static Color Cyan {
327 global::System.IntPtr cPtr = NDalicPINVOKE.CYAN_get();
328 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
329 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
334 public static Color Transparent {
336 global::System.IntPtr cPtr = NDalicPINVOKE.TRANSPARENT_get();
337 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
338 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
343 public static implicit operator Vector4(Color color)
345 return new Vector4(color.R, color.G, color.B, color.A);
348 public static implicit operator Color(Vector4 vec)
350 return new Color(vec.r, vec.g, vec.b, vec.a);