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 /// Three dimensional size
24 public class Size : global::System.IDisposable
26 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
27 protected bool swigCMemOwn;
29 internal Size(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(Size obj)
37 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
42 DisposeQueue.Instance.Add(this);
48 public virtual void Dispose()
50 if (!Stage.IsInstalled())
52 DisposeQueue.Instance.Add(this);
58 if (swigCPtr.Handle != global::System.IntPtr.Zero)
63 NDalicPINVOKE.delete_Vector3(swigCPtr);
65 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
67 global::System.GC.SuppressFinalize(this);
72 /// Addition operator for A+B
74 /// <param name="arg1">Size, A</param>
75 /// <param name="arg2">Size to assign, B</param>
76 /// <returns>A Size containing the result of the addition</returns>
77 public static Size operator +(Size arg1, Size arg2)
79 return arg1.Add(arg2);
83 /// Subtraction operator for A-B
85 /// <param name="arg1">Size, A</param>
86 /// <param name="arg2">Size to subtract, B</param>
87 /// <returns>A Size containing the result of the subtraction</returns>
88 public static Size operator -(Size arg1, Size arg2)
90 return arg1.Subtract(arg2);
94 /// Unary negation operator.
96 /// <param name="arg1">Size for unary negation</param>
97 /// <returns>A Size containg the negation</returns>
98 public static Size operator -(Size arg1)
100 return arg1.Subtract();
104 /// Multiplication operator.
106 /// <param name="arg1">Size for multiplication</param>
107 /// <param name="arg2">The Size to multipl</param>
108 /// <returns>A Size containing the result of the multiplication</returns>
109 public static Size operator *(Size arg1, Size arg2)
111 return arg1.Multiply(arg2);
115 /// Multiplication operator.
117 /// <param name="arg1">Size for multiplication</param>
118 /// <param name="arg2">The float value to scale the Size</param>
119 /// <returns>A Size containing the result of the scaling</returns>
120 public static Size operator *(Size arg1, float arg2)
122 return arg1.Multiply(arg2);
126 /// Division operator.
128 /// <param name="arg1">Size for division</param>
129 /// <param name="arg2">The Size to divide</param>
130 /// <returns>A Size containing the result of the division></returns>
131 public static Size operator /(Size arg1, Size arg2)
133 return arg1.Divide(arg2);
137 /// Division operator.
139 /// <param name="arg1">Size for division</param>
140 /// <param name="arg2">The float value to scale the Size by</param>
141 /// <returns>A Size containing the result of the scaling</returns>
142 public static Size operator /(Size arg1, float arg2)
144 return arg1.Divide(arg2);
148 /// Array subscript operator.
150 /// <param name="index">Subscript index</param>
151 /// <returns>The float at the given index</returns>
152 public float this[uint index]
156 return ValueOfIndex(index);
160 internal static Size GetSizeFromPtr(global::System.IntPtr cPtr)
162 Size ret = new Size(cPtr, false);
163 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
170 public Size() : this(NDalicPINVOKE.new_Vector3__SWIG_0(), true)
172 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
178 /// <param name="x">x (or width) component</param>
179 /// <param name="y">y (or height) component</param>
180 /// <param name="z">z (or depth) component</param>
181 public Size(float x, float y, float z) : this(NDalicPINVOKE.new_Vector3__SWIG_1(x, y, z), true)
183 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
189 /// <param name="size2d">Size2D with x (width) and y (height)</param>
190 public Size(Size2D size2d) : this(NDalicPINVOKE.new_Vector3__SWIG_3(Size2D.getCPtr(size2d)), true)
192 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
196 /// Zero constant, (0.0f, 0.0f, 0.0f).
198 public static Size Zero
202 global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_ZERO_get();
203 Size ret = (cPtr == global::System.IntPtr.Zero) ? null : new Size(cPtr, false);
204 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
209 private Size Add(Size rhs)
211 Size ret = new Size(NDalicPINVOKE.Vector3_Add(swigCPtr, Size.getCPtr(rhs)), true);
212 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
216 private Size Subtract(Size rhs)
218 Size ret = new Size(NDalicPINVOKE.Vector3_Subtract__SWIG_0(swigCPtr, Size.getCPtr(rhs)), true);
219 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
223 private Size Multiply(Size rhs)
225 Size ret = new Size(NDalicPINVOKE.Vector3_Multiply__SWIG_0(swigCPtr, Size.getCPtr(rhs)), true);
226 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
230 private Size Multiply(float rhs)
232 Size ret = new Size(NDalicPINVOKE.Vector3_Multiply__SWIG_1(swigCPtr, rhs), true);
233 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
237 private Size Divide(Size rhs)
239 Size ret = new Size(NDalicPINVOKE.Vector3_Divide__SWIG_0(swigCPtr, Size.getCPtr(rhs)), true);
240 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
244 private Size Divide(float rhs)
246 Size ret = new Size(NDalicPINVOKE.Vector3_Divide__SWIG_1(swigCPtr, rhs), true);
247 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
251 private Size Subtract()
253 Size ret = new Size(NDalicPINVOKE.Vector3_Subtract__SWIG_1(swigCPtr), true);
254 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
258 private float ValueOfIndex(uint index)
260 float ret = NDalicPINVOKE.Vector3_ValueOfIndex__SWIG_0(swigCPtr, index);
261 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
267 /// Utilizes appropriate machine epsilon values.
269 /// <param name="rhs">The Size to test against</param>
270 /// <returns>True if the Sizes are equal</returns>
271 public bool EqualTo(Size rhs)
273 bool ret = NDalicPINVOKE.Vector3_EqualTo(swigCPtr, Size.getCPtr(rhs));
274 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
279 /// Check inequality.
280 /// Utilizes appropriate machine epsilon values.
282 /// <param name="rhs">The Size to test against</param>
283 /// <returns>True if the Sizes are not equal</returns>
284 public bool NotEqualTo(Size rhs)
286 bool ret = NDalicPINVOKE.Vector3_NotEqualTo(swigCPtr, Size.getCPtr(rhs));
287 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
292 /// Width property for width component of Siz
298 NDalicPINVOKE.Vector3_Width_set(swigCPtr, value);
299 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
303 float ret = NDalicPINVOKE.Vector3_Width_get(swigCPtr);
304 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
310 /// Height property for height component of Size
316 NDalicPINVOKE.Vector3_Height_set(swigCPtr, value);
317 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
321 float ret = NDalicPINVOKE.Vector3_Height_get(swigCPtr);
322 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
328 /// Depth property for depth component of Size
334 NDalicPINVOKE.Vector3_Depth_set(swigCPtr, value);
335 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
339 float ret = NDalicPINVOKE.Vector3_Depth_get(swigCPtr);
340 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
346 /// Type cast operator, Size to Vector3.
348 /// <param name="size">Object of Size type</param>
349 public static implicit operator Vector3(Size size)
351 return new Vector3(size.Width, size.Height, size.Depth);
355 /// Type cast operator, Vector3 to Size type.
357 /// <param name="vec">Object of Vector3 type</param>
358 public static implicit operator Size(Vector3 vec)
360 return new Size(vec.Width, vec.Height, vec.Depth);