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);
161 /// Get Size from pointer.
163 /// <param name="cPtr">Pointer of the Size</param>
164 /// <returns>Size</returns>
165 public static Size GetSizeFromPtr(global::System.IntPtr cPtr)
167 Size ret = new Size(cPtr, false);
168 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
175 public Size() : this(NDalicPINVOKE.new_Vector3__SWIG_0(), true)
177 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
183 /// <param name="x">x (or width) component</param>
184 /// <param name="y">y (or height) component</param>
185 /// <param name="z">z (or depth) component</param>
186 public Size(float x, float y, float z) : this(NDalicPINVOKE.new_Vector3__SWIG_1(x, y, z), true)
188 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
194 /// <param name="size2d">Size2D with x (width) and y (height)</param>
195 public Size(Size2D size2d) : this(NDalicPINVOKE.new_Vector3__SWIG_3(Size2D.getCPtr(size2d)), true)
197 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
201 /// Zero constant, (0.0f, 0.0f, 0.0f).
203 public static Size Zero
207 global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_ZERO_get();
208 Size ret = (cPtr == global::System.IntPtr.Zero) ? null : new Size(cPtr, false);
209 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
214 private Size Add(Size rhs)
216 Size ret = new Size(NDalicPINVOKE.Vector3_Add(swigCPtr, Size.getCPtr(rhs)), true);
217 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
221 private Size Subtract(Size rhs)
223 Size ret = new Size(NDalicPINVOKE.Vector3_Subtract__SWIG_0(swigCPtr, Size.getCPtr(rhs)), true);
224 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
228 private Size Multiply(Size rhs)
230 Size ret = new Size(NDalicPINVOKE.Vector3_Multiply__SWIG_0(swigCPtr, Size.getCPtr(rhs)), true);
231 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
235 private Size Multiply(float rhs)
237 Size ret = new Size(NDalicPINVOKE.Vector3_Multiply__SWIG_1(swigCPtr, rhs), true);
238 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
242 private Size Divide(Size rhs)
244 Size ret = new Size(NDalicPINVOKE.Vector3_Divide__SWIG_0(swigCPtr, Size.getCPtr(rhs)), true);
245 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
249 private Size Divide(float rhs)
251 Size ret = new Size(NDalicPINVOKE.Vector3_Divide__SWIG_1(swigCPtr, rhs), true);
252 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
256 private Size Subtract()
258 Size ret = new Size(NDalicPINVOKE.Vector3_Subtract__SWIG_1(swigCPtr), true);
259 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
263 private float ValueOfIndex(uint index)
265 float ret = NDalicPINVOKE.Vector3_ValueOfIndex__SWIG_0(swigCPtr, index);
266 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
272 /// Utilizes appropriate machine epsilon values.
274 /// <param name="rhs">The Size to test against</param>
275 /// <returns>True if the Sizes are equal</returns>
276 public bool EqualTo(Size rhs)
278 bool ret = NDalicPINVOKE.Vector3_EqualTo(swigCPtr, Size.getCPtr(rhs));
279 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
284 /// Check inequality.
285 /// Utilizes appropriate machine epsilon values.
287 /// <param name="rhs">The Size to test against</param>
288 /// <returns>True if the Sizes are not equal</returns>
289 public bool NotEqualTo(Size rhs)
291 bool ret = NDalicPINVOKE.Vector3_NotEqualTo(swigCPtr, Size.getCPtr(rhs));
292 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
297 /// Width property for width component of Siz
303 NDalicPINVOKE.Vector3_Width_set(swigCPtr, value);
304 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
308 float ret = NDalicPINVOKE.Vector3_Width_get(swigCPtr);
309 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
315 /// Height property for height component of Size
321 NDalicPINVOKE.Vector3_Height_set(swigCPtr, value);
322 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
326 float ret = NDalicPINVOKE.Vector3_Height_get(swigCPtr);
327 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
333 /// Depth property for depth component of Size
339 NDalicPINVOKE.Vector3_Depth_set(swigCPtr, value);
340 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
344 float ret = NDalicPINVOKE.Vector3_Depth_get(swigCPtr);
345 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
351 /// Type cast operator, Size to Vector3.
353 /// <param name="size">Object of Size type</param>
354 public static implicit operator Vector3(Size size)
356 return new Vector3(size.Width, size.Height, size.Depth);
360 /// Type cast operator, Vector3 to Size type.
362 /// <param name="vec">Object of Vector3 type</param>
363 public static implicit operator Size(Vector3 vec)
365 return new Size(vec.Width, vec.Height, vec.Depth);