1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
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
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 internal class Matrix3 : global::System.IDisposable
22 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
23 protected bool swigCMemOwn;
25 internal Matrix3(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(Matrix3 obj)
33 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
36 //A Flag to check who called Dispose(). (By User or DisposeQueue)
37 private bool isDisposeQueued = false;
38 //A Flat to check if it is already disposed.
39 protected bool disposed = false;
46 isDisposeQueued = true;
47 DisposeQueue.Instance.Add(this);
53 //Throw excpetion if Dispose() is called in separate thread.
54 if (!Window.IsInstalled())
56 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
61 Dispose(DisposeTypes.Implicit);
65 Dispose(DisposeTypes.Explicit);
66 System.GC.SuppressFinalize(this);
70 protected virtual void Dispose(DisposeTypes type)
77 if (type == DisposeTypes.Explicit)
80 //Release your own managed resources here.
81 //You should release all of your own disposable objects here.
85 //Release your own unmanaged resources here.
86 //You should not access any managed member here except static instance.
87 //because the execution order of Finalizes is non-deterministic.
89 if (swigCPtr.Handle != global::System.IntPtr.Zero)
94 NDalicPINVOKE.delete_Matrix3(swigCPtr);
96 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
102 public static Matrix3 IDENTITY
106 global::System.IntPtr cPtr = NDalicPINVOKE.Matrix3_IDENTITY_get();
107 Matrix3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Matrix3(cPtr, false);
108 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
113 public Matrix3() : this(NDalicPINVOKE.new_Matrix3__SWIG_0(), true)
115 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
118 public Matrix3(Matrix3 m) : this(NDalicPINVOKE.new_Matrix3__SWIG_1(Matrix3.getCPtr(m)), true)
120 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123 public Matrix3(Matrix m) : this(NDalicPINVOKE.new_Matrix3__SWIG_2(Matrix.getCPtr(m)), true)
125 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
128 public Matrix3(float s00, float s01, float s02, float s10, float s11, float s12, float s20, float s21, float s22) : this(NDalicPINVOKE.new_Matrix3__SWIG_3(s00, s01, s02, s10, s11, s12, s20, s21, s22), true)
130 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
133 public Matrix3 Assign(Matrix3 matrix)
135 Matrix3 ret = new Matrix3(NDalicPINVOKE.Matrix3_Assign__SWIG_0(swigCPtr, Matrix3.getCPtr(matrix)), false);
136 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
140 public Matrix3 Assign(Matrix matrix)
142 Matrix3 ret = new Matrix3(NDalicPINVOKE.Matrix3_Assign__SWIG_1(swigCPtr, Matrix.getCPtr(matrix)), false);
143 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
147 public bool EqualTo(Matrix3 rhs)
149 bool ret = NDalicPINVOKE.Matrix3_EqualTo(swigCPtr, Matrix3.getCPtr(rhs));
150 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154 public bool NotEqualTo(Matrix3 rhs)
156 bool ret = NDalicPINVOKE.Matrix3_NotEqualTo(swigCPtr, Matrix3.getCPtr(rhs));
157 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
161 public void SetIdentity()
163 NDalicPINVOKE.Matrix3_SetIdentity(swigCPtr);
164 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
167 public SWIGTYPE_p_float AsFloat()
169 global::System.IntPtr cPtr = NDalicPINVOKE.Matrix3_AsFloat__SWIG_0(swigCPtr);
170 SWIGTYPE_p_float ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_float(cPtr, false);
171 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
177 bool ret = NDalicPINVOKE.Matrix3_Invert(swigCPtr);
178 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
182 public bool Transpose()
184 bool ret = NDalicPINVOKE.Matrix3_Transpose(swigCPtr);
185 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
189 public void Scale(float scale)
191 NDalicPINVOKE.Matrix3_Scale(swigCPtr, scale);
192 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
195 public float Magnitude()
197 float ret = NDalicPINVOKE.Matrix3_Magnitude(swigCPtr);
198 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
202 public bool ScaledInverseTranspose()
204 bool ret = NDalicPINVOKE.Matrix3_ScaledInverseTranspose(swigCPtr);
205 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
209 public static void Multiply(Matrix3 result, Matrix3 lhs, Matrix3 rhs)
211 NDalicPINVOKE.Matrix3_Multiply(Matrix3.getCPtr(result), Matrix3.getCPtr(lhs), Matrix3.getCPtr(rhs));
212 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();