sync with devel/master branch
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Vector2.cs
1 //------------------------------------------------------------------------------
2 // <auto-generated />
3 //
4 // This file was automatically generated by SWIG (http://www.swig.org).
5 // Version 3.0.9
6 //
7 // Do not make changes to this file unless you know what you are doing--modify
8 // the SWIG interface file instead.
9 //------------------------------------------------------------------------------
10
11 namespace Tizen.NUI
12 {
13
14     /// <summary>
15     /// A two dimensional vector.
16     /// </summary>
17     public class Vector2 : global::System.IDisposable
18     {
19         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
20         protected bool swigCMemOwn;
21
22         internal Vector2(global::System.IntPtr cPtr, bool cMemoryOwn)
23         {
24             swigCMemOwn = cMemoryOwn;
25             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
26         }
27
28         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Vector2 obj)
29         {
30             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
31         }
32
33         //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) 
34
35         //A Flag to check who called Dispose(). (By User or DisposeQueue)
36         private bool isDisposeQueued = false;
37         //A Flat to check if it is already disposed.
38         protected bool disposed = false;
39
40         ~Vector2()
41         {
42             if(!isDisposeQueued)
43             {
44                 isDisposeQueued = true;
45                 DisposeQueue.Instance.Add(this);
46             }
47         }
48
49         public void Dispose()
50         {
51             //Throw excpetion if Dispose() is called in separate thread.
52             if (!Window.IsInstalled())
53             {
54                 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
55             }
56
57             if (isDisposeQueued)
58             {
59                 Dispose(DisposeTypes.Implicit);
60             }
61             else
62             {
63                 Dispose(DisposeTypes.Explicit);
64                 System.GC.SuppressFinalize(this);
65             }
66         }
67
68         protected virtual void Dispose(DisposeTypes type)
69         {
70             if (disposed)
71             {
72                 return;
73             }
74
75             if(type == DisposeTypes.Explicit)
76             {
77                 //Called by User
78                 //Release your own managed resources here.
79                 //You should release all of your own disposable objects here.
80             }
81
82             //Release your own unmanaged resources here.
83             //You should not access any managed member here except static instance.
84             //because the execution order of Finalizes is non-deterministic.
85
86             if (swigCPtr.Handle != global::System.IntPtr.Zero)
87             {
88                 if (swigCMemOwn)
89                 {
90                     swigCMemOwn = false;
91                     NDalicPINVOKE.delete_Vector2(swigCPtr);
92                 }
93                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
94             }
95             disposed = true;
96         }
97
98         /// <summary>
99         /// Addition operator.
100         /// </summary>
101         /// <param name="arg1">First value</param>
102         /// <param name="arg2">Second value</param>
103         /// <returns>A vector containing the result of the addition</returns>
104         public static Vector2 operator +(Vector2 arg1, Vector2 arg2)
105         {
106             return arg1.Add(arg2);
107         }
108
109         /// <summary>
110         /// Subtraction operator.
111         /// </summary>
112         /// <param name="arg1">First value</param>
113         /// <param name="arg2">Second value</param>
114         /// <returns>A vector containing the result of the subtraction</returns>
115         public static Vector2 operator -(Vector2 arg1, Vector2 arg2)
116         {
117             return arg1.Subtract(arg2);
118         }
119
120         /// <summary>
121         /// Unary negation operator.
122         /// </summary>
123         /// <param name="arg1">Target Value</param>
124         /// <returns>A vector containg the negation</returns>
125         public static Vector2 operator -(Vector2 arg1)
126         {
127             return arg1.Subtract();
128         }
129
130         /// <summary>
131         /// Multiplication operator.
132         /// </summary>
133         /// <param name="arg1">First Value</param>
134         /// <param name="arg2">Second Value</param>
135         /// <returns>A vector containing the result of the multiplication</returns>
136         public static Vector2 operator *(Vector2 arg1, Vector2 arg2)
137         {
138             return arg1.Multiply(arg2);
139         }
140
141         /// <summary>
142         /// Multiplication operator.
143         /// </summary>
144         /// <param name="arg1">First Value</param>
145         /// <param name="arg2">The float value to scale the vector</param>
146         /// <returns>A vector containing the result of the scaling</returns>
147         public static Vector2 operator *(Vector2 arg1, float arg2)
148         {
149             return arg1.Multiply(arg2);
150         }
151
152         /// <summary>
153         /// Division operator.
154         /// </summary>
155         /// <param name="arg1">First Value</param>
156         /// <param name="arg2">Second Value</param>
157         /// <returns>A vector containing the result of the division</returns>
158         public static Vector2 operator /(Vector2 arg1, Vector2 arg2)
159         {
160             return arg1.Divide(arg2);
161         }
162
163         /// <summary>
164         /// Division operator.
165         /// </summary>
166         /// <param name="arg1">First Value</param>
167         /// <param name="arg2">The float value to scale the vector by</param>
168         /// <returns>A vector containing the result of the scaling</returns>
169         public static Vector2 operator /(Vector2 arg1, float arg2)
170         {
171             return arg1.Divide(arg2);
172         }
173
174         /// <summary>
175         /// Array subscript operator overload.
176         /// </summary>
177         /// <param name="index">Subscript index</param>
178         /// <returns>The float at the given index</returns>
179         public float this[uint index]
180         {
181             get
182             {
183                 return ValueOfIndex(index);
184             }
185         }
186
187         internal static Vector2 GetVector2FromPtr(global::System.IntPtr cPtr)
188         {
189             Vector2 ret = new Vector2(cPtr, false);
190             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
191             return ret;
192         }
193
194         /// <summary>
195         /// Default constructor, initializes the vector to 0.
196         /// </summary>
197         public Vector2() : this(NDalicPINVOKE.new_Vector2__SWIG_0(), true)
198         {
199             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
200         }
201
202         /// <summary>
203         /// Constructor.
204         /// </summary>
205         /// <param name="x">x or width component</param>
206         /// <param name="y">y or height component</param>
207         public Vector2(float x, float y) : this(NDalicPINVOKE.new_Vector2__SWIG_1(x, y), true)
208         {
209             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
210         }
211
212         /// <summary>
213         /// Conversion constructor from an array of two floats.
214         /// </summary>
215         /// <param name="array">Array of xy</param>
216         public Vector2(float[] array) : this(NDalicPINVOKE.new_Vector2__SWIG_2(array), true)
217         {
218             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
219         }
220
221         /// <summary>
222         /// Constructor.
223         /// </summary>
224         /// <param name="vec3">Vector3 to create this vector from</param>
225         public Vector2(Vector3 vec3) : this(NDalicPINVOKE.new_Vector2__SWIG_3(Vector3.getCPtr(vec3)), true)
226         {
227             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
228         }
229
230         /// <summary>
231         /// Constructor.
232         /// </summary>
233         /// <param name="vec4">Vector4 to create this vector from</param>
234         public Vector2(Vector4 vec4) : this(NDalicPINVOKE.new_Vector2__SWIG_4(Vector4.getCPtr(vec4)), true)
235         {
236             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
237         }
238
239         /// <summary>
240         /// (1.0f,1.0f)
241         /// </summary>
242         public static Vector2 One
243         {
244             get
245             {
246                 global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_ONE_get();
247                 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
248                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
249                 return ret;
250             }
251         }
252
253         /// <summary>
254         /// Vector representing the X axis
255         /// </summary>
256         public static Vector2 XAxis
257         {
258             get
259             {
260                 global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_XAXIS_get();
261                 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
262                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
263                 return ret;
264             }
265         }
266
267         /// <summary>
268         /// Vector representing the Y axis
269         /// </summary>
270         public static Vector2 YAxis
271         {
272             get
273             {
274                 global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_YAXIS_get();
275                 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
276                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
277                 return ret;
278             }
279         }
280
281         /// <summary>
282         /// Vector representing the negative X axis
283         /// </summary>
284         public static Vector2 NegativeXAxis
285         {
286             get
287             {
288                 global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_NEGATIVE_XAXIS_get();
289                 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
290                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
291                 return ret;
292             }
293         }
294
295         /// <summary>
296         /// Vector representing the negative Y axis
297         /// </summary>
298         public static Vector2 NegativeYAxis
299         {
300             get
301             {
302                 global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_NEGATIVE_YAXIS_get();
303                 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
304                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
305                 return ret;
306             }
307         }
308
309         /// <summary>
310         /// (0.0f, 0.0f)
311         /// </summary>
312         public static Vector2 Zero
313         {
314             get
315             {
316                 global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_ZERO_get();
317                 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
318                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
319                 return ret;
320             }
321         }
322
323         internal Vector2 Assign(float[] array)
324         {
325             Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Assign__SWIG_0(swigCPtr, array), false);
326             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
327             return ret;
328         }
329
330         internal Vector2 Assign(Vector3 rhs)
331         {
332             Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Assign__SWIG_1(swigCPtr, Vector3.getCPtr(rhs)), false);
333             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
334             return ret;
335         }
336
337         internal Vector2 Assign(Vector4 rhs)
338         {
339             Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Assign__SWIG_2(swigCPtr, Vector4.getCPtr(rhs)), false);
340             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
341             return ret;
342         }
343
344         internal Vector2 Add(Vector2 rhs)
345         {
346             Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Add(swigCPtr, Vector2.getCPtr(rhs)), true);
347             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
348             return ret;
349         }
350
351         internal Vector2 AddAssign(Vector2 rhs)
352         {
353             Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_AddAssign(swigCPtr, Vector2.getCPtr(rhs)), false);
354             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
355             return ret;
356         }
357
358         internal Vector2 Subtract(Vector2 rhs)
359         {
360             Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Subtract__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), true);
361             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
362             return ret;
363         }
364
365         internal Vector2 SubtractAssign(Vector2 rhs)
366         {
367             Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_SubtractAssign(swigCPtr, Vector2.getCPtr(rhs)), false);
368             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
369             return ret;
370         }
371
372         internal Vector2 Multiply(Vector2 rhs)
373         {
374             Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Multiply__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), true);
375             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
376             return ret;
377         }
378
379         internal Vector2 Multiply(float rhs)
380         {
381             Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Multiply__SWIG_1(swigCPtr, rhs), true);
382             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
383             return ret;
384         }
385
386         internal Vector2 MultiplyAssign(Vector2 rhs)
387         {
388             Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_MultiplyAssign__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), false);
389             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
390             return ret;
391         }
392
393         internal Vector2 MultiplyAssign(float rhs)
394         {
395             Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_MultiplyAssign__SWIG_1(swigCPtr, rhs), false);
396             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
397             return ret;
398         }
399
400         internal Vector2 Divide(Vector2 rhs)
401         {
402             Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Divide__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), true);
403             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
404             return ret;
405         }
406
407         internal Vector2 Divide(float rhs)
408         {
409             Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Divide__SWIG_1(swigCPtr, rhs), true);
410             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
411             return ret;
412         }
413
414         internal Vector2 DivideAssign(Vector2 rhs)
415         {
416             Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_DivideAssign__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), false);
417             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
418             return ret;
419         }
420
421         internal Vector2 DivideAssign(float rhs)
422         {
423             Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_DivideAssign__SWIG_1(swigCPtr, rhs), false);
424             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
425             return ret;
426         }
427
428         internal Vector2 Subtract()
429         {
430             Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Subtract__SWIG_1(swigCPtr), true);
431             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
432             return ret;
433         }
434
435         internal bool EqualTo(Vector2 rhs)
436         {
437             bool ret = NDalicPINVOKE.Vector2_EqualTo(swigCPtr, Vector2.getCPtr(rhs));
438             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
439             return ret;
440         }
441
442         internal bool NotEqualTo(Vector2 rhs)
443         {
444             bool ret = NDalicPINVOKE.Vector2_NotEqualTo(swigCPtr, Vector2.getCPtr(rhs));
445             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
446             return ret;
447         }
448
449         internal float ValueOfIndex(uint index)
450         {
451             float ret = NDalicPINVOKE.Vector2_ValueOfIndex__SWIG_0(swigCPtr, index);
452             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
453             return ret;
454         }
455
456         /// <summary>
457         /// Returns the length of the vector.
458         /// </summary>
459         /// <returns>The length of the vector</returns>
460         public float Length()
461         {
462             float ret = NDalicPINVOKE.Vector2_Length(swigCPtr);
463             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
464             return ret;
465         }
466
467         /// <summary>
468         /// Returns the length of the vector squared.<br>
469         /// This is more efficient than Length() for threshold
470         /// testing as it avoids the use of a square root.<br>
471         /// </summary>
472         /// <returns>The length of the vector squared</returns>
473         public float LengthSquared()
474         {
475             float ret = NDalicPINVOKE.Vector2_LengthSquared(swigCPtr);
476             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
477             return ret;
478         }
479
480         /// <summary>
481         /// Sets the vector to be unit length, whilst maintaining its direction.
482         /// </summary>
483         public void Normalize()
484         {
485             NDalicPINVOKE.Vector2_Normalize(swigCPtr);
486             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
487         }
488
489         /// <summary>
490         /// Clamps the vector between minimum and maximum vectors.
491         /// </summary>
492         /// <param name="min">The minimum vector</param>
493         /// <param name="max">The maximum vector</param>
494         public void Clamp(Vector2 min, Vector2 max)
495         {
496             NDalicPINVOKE.Vector2_Clamp(swigCPtr, Vector2.getCPtr(min), Vector2.getCPtr(max));
497             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
498         }
499
500         internal SWIGTYPE_p_float AsFloat()
501         {
502             global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_AsFloat__SWIG_0(swigCPtr);
503             SWIGTYPE_p_float ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_float(cPtr, false);
504             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
505             return ret;
506         }
507
508         /// <summary>
509         /// x component
510         /// </summary>
511         public float X
512         {
513             set
514             {
515                 NDalicPINVOKE.Vector2_X_set(swigCPtr, value);
516                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
517             }
518             get
519             {
520                 float ret = NDalicPINVOKE.Vector2_X_get(swigCPtr);
521                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
522                 return ret;
523             }
524         }
525
526         /// <summary>
527         /// width
528         /// </summary>
529         public float Width
530         {
531             set
532             {
533                 NDalicPINVOKE.Vector2_Width_set(swigCPtr, value);
534                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
535             }
536             get
537             {
538                 float ret = NDalicPINVOKE.Vector2_Width_get(swigCPtr);
539                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
540                 return ret;
541             }
542         }
543
544         /// <summary>
545         /// y component
546         /// </summary>
547         public float Y
548         {
549             set
550             {
551                 NDalicPINVOKE.Vector2_Y_set(swigCPtr, value);
552                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
553             }
554             get
555             {
556                 float ret = NDalicPINVOKE.Vector2_Y_get(swigCPtr);
557                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
558                 return ret;
559             }
560         }
561
562         /// <summary>
563         /// height
564         /// </summary>
565         public float Height
566         {
567             set
568             {
569                 NDalicPINVOKE.Vector2_Height_set(swigCPtr, value);
570                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
571             }
572             get
573             {
574                 float ret = NDalicPINVOKE.Vector2_Height_get(swigCPtr);
575                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
576                 return ret;
577             }
578         }
579
580     }
581
582 }