manual nui merge 0.2.38
[platform/core/csapi/nui.git] / Tizen.NUI / src / public / Color.cs
1 // Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 //
16 // This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
17 // Some have been manually changed
18
19 namespace Tizen.NUI
20 {
21
22     using System;
23
24     /// <summary>
25     /// Color class.
26     /// </summary>
27     public class Color : global::System.IDisposable
28     {
29         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
30         protected bool swigCMemOwn;
31
32         internal Color(global::System.IntPtr cPtr, bool cMemoryOwn)
33         {
34             swigCMemOwn = cMemoryOwn;
35             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
36         }
37
38         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Color obj)
39         {
40             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
41         }
42
43         ~Color()
44         {
45             DisposeQueue.Instance.Add(this);
46         }
47
48         /// <summary>
49         /// To make Color instance be disposed.
50         /// </summary>
51         public virtual void Dispose()
52         {
53             if (!Window.IsInstalled())
54             {
55                 DisposeQueue.Instance.Add(this);
56                 return;
57             }
58
59             lock (this)
60             {
61                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
62                 {
63                     if (swigCMemOwn)
64                     {
65                         swigCMemOwn = false;
66                         NDalicPINVOKE.delete_Vector4(swigCPtr);
67                     }
68                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
69                 }
70                 global::System.GC.SuppressFinalize(this);
71             }
72         }
73
74         /// <summary>
75         /// Addition operator.
76         /// </summary>
77         /// <param name="arg1">First value</param>
78         /// <param name="arg2">Second value</param>
79         /// <returns>A Color containing the result of the addition</returns>
80         public static Color operator +(Color arg1, Color arg2)
81         {
82             return arg1.Add(arg2);
83         }
84
85         /// <summary>
86         /// Subtraction operator.
87         /// </summary>
88         /// <param name="arg1">First value</param>
89         /// <param name="arg2">Second value</param>
90         /// <returns>A Color containing the result of the subtraction</returns>
91         public static Color operator -(Color arg1, Color arg2)
92         {
93             return arg1.Subtract(arg2);
94         }
95
96         /// <summary>
97         /// Unary negation operator.
98         /// </summary>
99         /// <param name="arg1">Target Value</param>
100         /// <returns>A Color containg the negation</returns>
101         public static Color operator -(Color arg1)
102         {
103             return arg1.Subtract();
104         }
105
106         /// <summary>
107         /// Multiplication operator.
108         /// </summary>
109         /// <param name="arg1">First Value</param>
110         /// <param name="arg2">Second Value</param>
111         /// <returns>A Color containing the result of the multiplication</returns>
112         public static Color operator *(Color arg1, Color arg2)
113         {
114             return arg1.Multiply(arg2);
115         }
116
117         /// <summary>
118         /// Division operator.
119         /// </summary>
120         /// <param name="arg1">First Value</param>
121         /// <param name="arg2">Second Value</param>
122         /// <returns>A Color containing the result of the division</returns>
123         public static Color operator /(Color arg1, Color arg2)
124         {
125             return arg1.Divide(arg2);
126         }
127
128         /// <summary>
129         /// Array subscript operator overload.
130         /// </summary>
131         /// <param name="index">Subscript index</param>
132         /// <returns>The float at the given index</returns>
133         public float this[uint index]
134         {
135             get
136             {
137                 return ValueOfIndex(index);
138             }
139         }
140
141         internal static Color GetColorFromPtr(global::System.IntPtr cPtr)
142         {
143             Color ret = new Color(cPtr, false);
144             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
145             return ret;
146         }
147
148         /// <summary>
149         /// Default constructor
150         /// </summary>
151         public Color() : this(NDalicPINVOKE.new_Vector4__SWIG_0(), true)
152         {
153             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154         }
155
156
157         /// <summary>
158         /// Constructor.
159         /// </summary>
160         /// <param name="r">red component</param>
161         /// <param name="g">green component</param>
162         /// <param name="b">blue component</param>
163         /// <param name="a">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)
165         {
166             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
167         }
168
169         /// <summary>
170         /// Conversion constructor from an array of four floats.
171         /// </summary>
172         /// <param name="array">array Array of R,G,B,A</param>
173         public Color(float[] array) : this(NDalicPINVOKE.new_Vector4__SWIG_2(array), true)
174         {
175             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
176         }
177
178         private Color Add(Color rhs)
179         {
180             Color ret = new Color(NDalicPINVOKE.Vector4_Add(swigCPtr, Color.getCPtr(rhs)), true);
181             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
182             return ret;
183         }
184
185         private Color AddAssign(Vector4 rhs)
186         {
187             Color ret = new Color(NDalicPINVOKE.Vector4_AddAssign(swigCPtr, Color.getCPtr(rhs)), false);
188             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
189             return ret;
190         }
191
192         private Color Subtract(Color rhs)
193         {
194             Color ret = new Color(NDalicPINVOKE.Vector4_Subtract__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true);
195             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
196             return ret;
197         }
198
199         private Color SubtractAssign(Color rhs)
200         {
201             Color ret = new Color(NDalicPINVOKE.Vector4_SubtractAssign(swigCPtr, Color.getCPtr(rhs)), false);
202             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
203             return ret;
204         }
205
206         private Color Multiply(Color rhs)
207         {
208             Color ret = new Color(NDalicPINVOKE.Vector4_Multiply__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true);
209             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
210             return ret;
211         }
212
213         private Color MultiplyAssign(Color rhs)
214         {
215             Color ret = new Color(NDalicPINVOKE.Vector4_MultiplyAssign__SWIG_0(swigCPtr, Color.getCPtr(rhs)), false);
216             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
217             return ret;
218         }
219
220         private Color MultiplyAssign(float rhs)
221         {
222             Color ret = new Color(NDalicPINVOKE.Vector4_MultiplyAssign__SWIG_1(swigCPtr, rhs), false);
223             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
224             return ret;
225         }
226
227         private Color Divide(Vector4 rhs)
228         {
229             Color ret = new Color(NDalicPINVOKE.Vector4_Divide__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true);
230             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
231             return ret;
232         }
233
234
235         private Color DivideAssign(Color rhs)
236         {
237             Color ret = new Color(NDalicPINVOKE.Vector4_DivideAssign__SWIG_0(swigCPtr, Color.getCPtr(rhs)), false);
238             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
239             return ret;
240         }
241
242         private Color DivideAssign(float rhs)
243         {
244             Color ret = new Color(NDalicPINVOKE.Vector4_DivideAssign__SWIG_1(swigCPtr, rhs), false);
245             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
246             return ret;
247         }
248
249         private Color Subtract()
250         {
251             Color ret = new Color(NDalicPINVOKE.Vector4_Subtract__SWIG_1(swigCPtr), true);
252             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
253             return ret;
254         }
255
256         /// <summary>
257         /// Check if two Color classes are same.
258         /// </summary>
259         /// <param name="rhs">A Color to be compared</param>
260         /// <returns>If two Colors are are same, then true.</returns>
261         public bool EqualTo(Color rhs)
262         {
263             bool ret = NDalicPINVOKE.Vector4_EqualTo(swigCPtr, Color.getCPtr(rhs));
264
265             if (rhs == null) return false;
266
267             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
268             return ret;
269         }
270
271         /// <summary>
272         /// Check if two Color classes are different.
273         /// </summary>
274         /// <param name="rhs">A Color to be compared</param>
275         /// <returns>If two Colors are are different, then true.</returns>
276         public bool NotEqualTo(Color rhs)
277         {
278             bool ret = NDalicPINVOKE.Vector4_NotEqualTo(swigCPtr, Color.getCPtr(rhs));
279             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
280             return ret;
281         }
282
283
284         private float ValueOfIndex(uint index)
285         {
286             float ret = NDalicPINVOKE.Vector4_ValueOfIndex__SWIG_0(swigCPtr, index);
287             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
288             return ret;
289         }
290
291         /// <summary>
292         /// red component.
293         /// </summary>
294         public float R
295         {
296             set
297             {
298                 NDalicPINVOKE.Vector4_r_set(swigCPtr, value);
299                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
300             }
301             get
302             {
303                 float ret = NDalicPINVOKE.Vector4_r_get(swigCPtr);
304                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
305                 return ret;
306             }
307         }
308
309         /// <summary>
310         /// green component.
311         /// </summary>
312         public float G
313         {
314             set
315             {
316                 NDalicPINVOKE.Vector4_g_set(swigCPtr, value);
317                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
318             }
319             get
320             {
321                 float ret = NDalicPINVOKE.Vector4_g_get(swigCPtr);
322                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
323                 return ret;
324             }
325         }
326
327         /// <summary>
328         /// blue component.
329         /// </summary>
330         public float B
331         {
332             set
333             {
334                 NDalicPINVOKE.Vector4_b_set(swigCPtr, value);
335                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
336             }
337             get
338             {
339                 float ret = NDalicPINVOKE.Vector4_b_get(swigCPtr);
340                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
341                 return ret;
342             }
343         }
344
345         /// <summary>
346         /// alpha component.
347         /// </summary>
348         public float A
349         {
350             set
351             {
352                 NDalicPINVOKE.Vector4_a_set(swigCPtr, value);
353                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
354             }
355             get
356             {
357                 float ret = NDalicPINVOKE.Vector4_a_get(swigCPtr);
358                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
359                 return ret;
360             }
361         }
362
363         /// <summary>
364         /// Get black colored Color class.
365         /// </summary>
366         public static Color Black
367         {
368             get
369             {
370                 global::System.IntPtr cPtr = NDalicPINVOKE.BLACK_get();
371                 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
372                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
373                 return ret;
374             }
375         }
376
377         /// <summary>
378         /// Get white colored Color class.
379         /// </summary>
380         public static Color White
381         {
382             get
383             {
384                 global::System.IntPtr cPtr = NDalicPINVOKE.WHITE_get();
385                 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
386                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
387                 return ret;
388             }
389         }
390
391         /// <summary>
392         /// Get red colored Color class.
393         /// </summary>
394         public static Color Red
395         {
396             get
397             {
398                 global::System.IntPtr cPtr = NDalicPINVOKE.RED_get();
399                 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
400                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
401                 return ret;
402             }
403         }
404
405         /// <summary>
406         /// Get green colored Color class.
407         /// </summary>
408         public static Color Green
409         {
410             get
411             {
412                 global::System.IntPtr cPtr = NDalicPINVOKE.GREEN_get();
413                 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
414                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
415                 return ret;
416             }
417         }
418
419         /// <summary>
420         /// Get blue colored Color class.
421         /// </summary>
422         public static Color Blue
423         {
424             get
425             {
426                 global::System.IntPtr cPtr = NDalicPINVOKE.BLUE_get();
427                 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
428                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
429                 return ret;
430             }
431         }
432
433         /// <summary>
434         /// Get yellow colored Color class.
435         /// </summary>
436         public static Color Yellow
437         {
438             get
439             {
440                 global::System.IntPtr cPtr = NDalicPINVOKE.YELLOW_get();
441                 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
442                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
443                 return ret;
444             }
445         }
446
447         /// <summary>
448         /// Get magenta colored Color class.
449         /// </summary>
450         public static Color Magenta
451         {
452             get
453             {
454                 global::System.IntPtr cPtr = NDalicPINVOKE.MAGENTA_get();
455                 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
456                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
457                 return ret;
458             }
459         }
460
461         /// <summary>
462         /// Get cyan colored Color class.
463         /// </summary>
464         public static Color Cyan
465         {
466             get
467             {
468                 global::System.IntPtr cPtr = NDalicPINVOKE.CYAN_get();
469                 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
470                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
471                 return ret;
472             }
473         }
474
475         /// <summary>
476         /// Get transparent colored Color class.
477         /// </summary>
478         public static Color Transparent
479         {
480             get
481             {
482                 global::System.IntPtr cPtr = NDalicPINVOKE.TRANSPARENT_get();
483                 Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false);
484                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
485                 return ret;
486             }
487         }
488
489         /// <summary>
490         /// convert Color class to Vector4 class implicitly.
491         /// </summary>
492         /// <param name="color">A Color to be converted to Vector4</param>
493         public static implicit operator Vector4(Color color)
494         {
495             return new Vector4(color.R, color.G, color.B, color.A);
496         }
497
498         /// <summary>
499         /// convert Vector4 class to Color class implicitly.
500         /// </summary>
501         /// <param name="vec">A Vector4 to be converted to Color</param></param>
502         public static implicit operator Color(Vector4 vec)
503         {
504             return new Color(vec.R, vec.G, vec.B, vec.A);
505         }
506
507     }
508
509 }
510
511