2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 /// A two dimensional size
24 public class Size2D : global::System.IDisposable
26 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
27 protected bool swigCMemOwn;
29 internal Size2D(global::System.IntPtr cPtr, bool cMemoryOwn)
31 swigCMemOwn = cMemoryOwn;
32 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
35 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Size2D obj)
37 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
42 DisposeQueue.Instance.Add(this);
47 public virtual void Dispose()
49 if (!Stage.IsInstalled())
51 DisposeQueue.Instance.Add(this);
57 if (swigCPtr.Handle != global::System.IntPtr.Zero)
62 NDalicPINVOKE.delete_Vector2(swigCPtr);
64 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
66 global::System.GC.SuppressFinalize(this);
71 /// Addition operator.
73 public static Size2D operator +(Size2D arg1, Size2D arg2)
75 return arg1.Add(arg2);
79 /// Subtraction operator.
81 public static Size2D operator -(Size2D arg1, Size2D arg2)
83 return arg1.Subtract(arg2);
88 public static Size2D operator -(Size2D arg1)
90 return arg1.Subtract();
94 /// Multiplication operator.
96 public static Size2D operator *(Size2D arg1, Size2D arg2)
98 return arg1.Multiply(arg2);
102 /// Multiplication operator.
104 public static Size2D operator *(Size2D arg1, int arg2)
106 return arg1.Multiply(arg2);
110 /// Division operator.
112 public static Size2D operator /(Size2D arg1, Size2D arg2)
114 return arg1.Divide(arg2);
118 /// Division operator.
120 public static Size2D operator /(Size2D arg1, int arg2)
122 return arg1.Divide(arg2);
126 /// Array subscript operator.
128 public float this[uint index]
132 return ValueOfIndex(index);
137 public static Size2D GetSize2DFromPtr(global::System.IntPtr cPtr)
139 Size2D ret = new Size2D(cPtr, false);
140 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
147 public Size2D() : this(NDalicPINVOKE.new_Vector2__SWIG_0(), true)
149 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
155 public Size2D(int x, int y) : this(NDalicPINVOKE.new_Vector2__SWIG_1((float)x, (float)y), true)
157 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
163 public Size2D(Size size) : this(NDalicPINVOKE.new_Vector2__SWIG_3(Size.getCPtr(size)), true)
165 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168 private Size2D Add(Size2D rhs)
170 Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Add(swigCPtr, Size2D.getCPtr(rhs)), true);
171 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
175 private Size2D Subtract(Size2D rhs)
177 Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Subtract__SWIG_0(swigCPtr, Size2D.getCPtr(rhs)), true);
178 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
183 private Size2D Multiply(Size2D rhs)
185 Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Multiply__SWIG_0(swigCPtr, Size2D.getCPtr(rhs)), true);
186 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
190 private Size2D Multiply(int rhs)
192 Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Multiply__SWIG_1(swigCPtr, (float)rhs), true);
193 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
198 private Size2D Divide(Size2D rhs)
200 Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Divide__SWIG_0(swigCPtr, Size2D.getCPtr(rhs)), true);
201 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
205 private Size2D Divide(int rhs)
207 Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Divide__SWIG_1(swigCPtr, (float)rhs), true);
208 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
212 private Size2D Subtract()
214 Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Subtract__SWIG_1(swigCPtr), true);
215 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
221 /// Utilizes appropriate machine epsilon values.
223 public bool EqualTo(Size2D rhs)
225 bool ret = NDalicPINVOKE.Vector2_EqualTo(swigCPtr, Size2D.getCPtr(rhs));
226 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
231 /// Check inequality.
232 /// Utilizes appropriate machine epsilon values.
234 public bool NotEqualTo(Size2D rhs)
236 bool ret = NDalicPINVOKE.Vector2_NotEqualTo(swigCPtr, Size2D.getCPtr(rhs));
237 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
241 private int ValueOfIndex(uint index)
243 int ret = (int)NDalicPINVOKE.Vector2_ValueOfIndex__SWIG_0(swigCPtr, index);
244 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
254 NDalicPINVOKE.Vector2_Width_set(swigCPtr, (float)value);
255 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
259 float ret = NDalicPINVOKE.Vector2_Width_get(swigCPtr);
260 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
271 NDalicPINVOKE.Vector2_Height_set(swigCPtr, (float)value);
272 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
276 float ret = NDalicPINVOKE.Vector2_Height_get(swigCPtr);
277 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
284 public static implicit operator Vector2(Size2D size)
286 return new Vector2((float)size.Width, (float)size.Height);
291 public static implicit operator Size2D(Vector2 vec)
293 return new Size2D((int)vec.X, (int)vec.Y);