4c85a662dde806a50970289dc5a8f393f8c59afd
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Matrix3.cs
1 /*
2  * Copyright(c) 2019 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 Tizen.NUI
19 {
20     internal class Matrix3 : Disposable
21     {
22         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
23         protected bool swigCMemOwn;
24
25         internal Matrix3(global::System.IntPtr cPtr, bool cMemoryOwn)
26         {
27             swigCMemOwn = cMemoryOwn;
28             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
29         }
30
31         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Matrix3 obj)
32         {
33             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
34         }
35
36         protected override void Dispose(DisposeTypes type)
37         {
38             if (disposed)
39             {
40                 return;
41             }
42
43             //Release your own unmanaged resources here.
44             //You should not access any managed member here except static instance.
45             //because the execution order of Finalizes is non-deterministic.
46
47             if (swigCPtr.Handle != global::System.IntPtr.Zero)
48             {
49                 if (swigCMemOwn)
50                 {
51                     swigCMemOwn = false;
52                     Interop.Matrix.delete_Matrix3(swigCPtr);
53                 }
54                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
55             }
56
57             base.Dispose(type);
58         }
59
60         public static Matrix3 IDENTITY
61         {
62             get
63             {
64                 global::System.IntPtr cPtr = Interop.Matrix.Matrix3_IDENTITY_get();
65                 Matrix3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Matrix3(cPtr, false);
66                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
67                 return ret;
68             }
69         }
70
71         public Matrix3() : this(Interop.Matrix.new_Matrix3__SWIG_0(), true)
72         {
73             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
74         }
75
76         public Matrix3(Matrix3 m) : this(Interop.Matrix.new_Matrix3__SWIG_1(Matrix3.getCPtr(m)), true)
77         {
78             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
79         }
80
81         public Matrix3(Matrix m) : this(Interop.Matrix.new_Matrix3__SWIG_2(Matrix.getCPtr(m)), true)
82         {
83             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
84         }
85
86         public Matrix3(float s00, float s01, float s02, float s10, float s11, float s12, float s20, float s21, float s22) : this(Interop.Matrix.new_Matrix3__SWIG_3(s00, s01, s02, s10, s11, s12, s20, s21, s22), true)
87         {
88             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
89         }
90
91         public Matrix3 Assign(Matrix3 matrix)
92         {
93             Matrix3 ret = new Matrix3(Interop.Matrix.Matrix3_Assign__SWIG_0(swigCPtr, Matrix3.getCPtr(matrix)), false);
94             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
95             return ret;
96         }
97
98         public Matrix3 Assign(Matrix matrix)
99         {
100             Matrix3 ret = new Matrix3(Interop.Matrix.Matrix3_Assign__SWIG_1(swigCPtr, Matrix.getCPtr(matrix)), false);
101             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
102             return ret;
103         }
104
105         public bool EqualTo(Matrix3 rhs)
106         {
107             bool ret = Interop.Matrix.Matrix3_EqualTo(swigCPtr, Matrix3.getCPtr(rhs));
108             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
109             return ret;
110         }
111
112         public bool NotEqualTo(Matrix3 rhs)
113         {
114             bool ret = Interop.Matrix.Matrix3_NotEqualTo(swigCPtr, Matrix3.getCPtr(rhs));
115             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
116             return ret;
117         }
118
119         public void SetIdentity()
120         {
121             Interop.Matrix.Matrix3_SetIdentity(swigCPtr);
122             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123         }
124
125         public SWIGTYPE_p_float AsFloat()
126         {
127             global::System.IntPtr cPtr = Interop.Matrix.Matrix3_AsFloat__SWIG_0(swigCPtr);
128             SWIGTYPE_p_float ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_float(cPtr, false);
129             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
130             return ret;
131         }
132
133         public bool Invert()
134         {
135             bool ret = Interop.Matrix.Matrix3_Invert(swigCPtr);
136             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
137             return ret;
138         }
139
140         public bool Transpose()
141         {
142             bool ret = Interop.Matrix.Matrix3_Transpose(swigCPtr);
143             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
144             return ret;
145         }
146
147         public void Scale(float scale)
148         {
149             Interop.Matrix.Matrix3_Scale(swigCPtr, scale);
150             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
151         }
152
153         public float Magnitude()
154         {
155             float ret = Interop.Matrix.Matrix3_Magnitude(swigCPtr);
156             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
157             return ret;
158         }
159
160         public bool ScaledInverseTranspose()
161         {
162             bool ret = Interop.Matrix.Matrix3_ScaledInverseTranspose(swigCPtr);
163             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
164             return ret;
165         }
166
167         public static void Multiply(Matrix3 result, Matrix3 lhs, Matrix3 rhs)
168         {
169             Interop.Matrix.Matrix3_Multiply(Matrix3.getCPtr(result), Matrix3.getCPtr(lhs), Matrix3.getCPtr(rhs));
170             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
171         }
172     }
173 }