Size, Position, Color high level class added
[platform/core/uifw/dali-toolkit.git] / plugins / dali-swig / manual / csharp / Color.cs
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 namespace Dali {
19
20 using System;
21
22 public class Color : global::System.IDisposable {
23   private global::System.Runtime.InteropServices.HandleRef swigCPtr;
24   protected bool swigCMemOwn;
25
26   internal Color(global::System.IntPtr cPtr, bool cMemoryOwn) {
27     swigCMemOwn = cMemoryOwn;
28     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
29   }
30
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;
33   }
34
35   ~Color() {
36     DisposeQueue.Instance.Add(this);
37   }
38
39   public virtual void Dispose() {
40     if (!Stage.IsInstalled()) {
41       DisposeQueue.Instance.Add(this);
42       return;
43     }
44
45     lock(this) {
46       if (swigCPtr.Handle != global::System.IntPtr.Zero) {
47         if (swigCMemOwn) {
48           swigCMemOwn = false;
49           NDalicPINVOKE.delete_Vector4(swigCPtr);
50         }
51         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
52       }
53       global::System.GC.SuppressFinalize(this);
54     }
55   }
56
57
58   public static Color operator+(Color arg1, Color arg2) {
59     return arg1.Add(arg2);
60   }
61
62   public static Color operator-(Color arg1, Color arg2) {
63     return arg1.Subtract(arg2);
64   }
65
66   public static Color operator-(Color arg1) {
67     return arg1.Subtract();
68   }
69
70   public static Color operator*(Color arg1, Color arg2) {
71     return arg1.Multiply(arg2);
72   }
73
74   public static Color operator*(Color arg1, float arg2) {
75     return arg1.Multiply(arg2);
76   }
77
78   public static Color operator/(Color arg1, Color arg2) {
79     return arg1.Divide(arg2);
80   }
81
82   public static Color operator/(Color arg1, float arg2) {
83     return arg1.Divide(arg2);
84   }
85
86
87   public float this[uint index]
88   {
89     get
90     {
91       return ValueOfIndex(index);
92     }
93   }
94
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();
98        return ret;
99   }
100
101
102   public Color() : this(NDalicPINVOKE.new_Vector4__SWIG_0(), true) {
103     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
104   }
105
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();
108   }
109
110   public Color(float[] array) : this(NDalicPINVOKE.new_Vector4__SWIG_2(array), true) {
111     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
112   }
113
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();
117     return ret;
118   }
119
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();
123     return ret;
124   }
125
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();
129     return ret;
130   }
131
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();
135     return ret;
136   }
137
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();
141     return ret;
142   }
143
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();
147     return ret;
148   }
149
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();
153     return ret;
154   }
155
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();
159     return ret;
160   }
161
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();
165     return ret;
166   }
167
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();
171     return ret;
172   }
173
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();
177     return ret;
178   }
179
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();
183     return ret;
184   }
185
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();
189     return ret;
190   }
191
192   public bool EqualTo(Color rhs) {
193     bool ret = NDalicPINVOKE.Vector4_EqualTo(swigCPtr, Color.getCPtr(rhs));
194
195     if(rhs == null) return false;
196
197     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
198     return ret;
199   }
200
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();
204     return ret;
205   }
206
207
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();
211     return ret;
212   }
213
214   public float R {
215     set {
216       NDalicPINVOKE.Vector4_r_set(swigCPtr, value);
217       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
218     }
219     get {
220       float ret = NDalicPINVOKE.Vector4_r_get(swigCPtr);
221       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
222       return ret;
223     }
224   }
225
226   public float G {
227     set {
228       NDalicPINVOKE.Vector4_g_set(swigCPtr, value);
229       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
230     }
231     get {
232       float ret = NDalicPINVOKE.Vector4_g_get(swigCPtr);
233       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
234       return ret;
235     }
236   }
237
238   public float B {
239     set {
240       NDalicPINVOKE.Vector4_b_set(swigCPtr, value);
241       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
242     }
243     get {
244       float ret = NDalicPINVOKE.Vector4_b_get(swigCPtr);
245       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
246       return ret;
247     }
248   }
249
250   public float A {
251     set {
252       NDalicPINVOKE.Vector4_a_set(swigCPtr, value);
253       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
254     }
255     get {
256       float ret = NDalicPINVOKE.Vector4_a_get(swigCPtr);
257       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
258       return ret;
259     }
260   }
261
262   public static Color Black {
263     get {
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();
267       return ret;
268     }
269   }
270
271   public static Color White {
272     get {
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();
276       return ret;
277     }
278   }
279
280   public static Color Red {
281     get {
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();
285       return ret;
286     }
287   }
288
289   public static Color Green {
290     get {
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();
294       return ret;
295     }
296   }
297
298   public static Color Blue {
299     get {
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();
303       return ret;
304     }
305   }
306
307   public static Color Yellow {
308     get {
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();
312       return ret;
313     }
314   }
315
316   public static Color Magenta {
317     get {
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();
321       return ret;
322     }
323   }
324
325   public static Color Cyan {
326     get {
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();
330       return ret;
331     }
332   }
333
334   public static Color Transparent {
335     get {
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();
339       return ret;
340     }
341   }
342
343   public static implicit operator Vector4(Color color)
344   {
345     return new Vector4(color.R, color.G, color.B, color.A);
346   }
347
348   public static implicit operator Color(Vector4 vec)
349   {
350     return new Color(vec.r, vec.g, vec.b, vec.a);
351   }
352
353 }
354
355 }
356
357