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.
20 public class Position2D : global::System.IDisposable {
21 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
22 protected bool swigCMemOwn;
24 internal Position2D(global::System.IntPtr cPtr, bool cMemoryOwn) {
25 swigCMemOwn = cMemoryOwn;
26 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
29 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Position2D obj) {
30 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
34 DisposeQueue.Instance.Add(this);
37 public virtual void Dispose() {
38 if (!Window.IsInstalled()) {
39 DisposeQueue.Instance.Add(this);
44 if (swigCPtr.Handle != global::System.IntPtr.Zero) {
47 NDalicPINVOKE.delete_Vector2(swigCPtr);
49 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
51 global::System.GC.SuppressFinalize(this);
56 public static Position2D operator+(Position2D arg1, Position2D arg2) {
57 return arg1.Add(arg2);
60 public static Position2D operator-(Position2D arg1, Position2D arg2) {
61 return arg1.Subtract(arg2);
64 public static Position2D operator-(Position2D arg1) {
65 return arg1.Subtract();
68 public static Position2D operator*(Position2D arg1, Position2D arg2) {
69 return arg1.Multiply(arg2);
72 public static Position2D operator*(Position2D arg1, int arg2) {
73 return arg1.Multiply(arg2);
76 public static Position2D operator/(Position2D arg1, Position2D arg2) {
77 return arg1.Divide(arg2);
80 public static Position2D operator/(Position2D arg1, int arg2) {
81 return arg1.Divide(arg2);
84 public float this[uint index]
88 return ValueOfIndex(index);
92 public static Position2D GetPosition2DFromPtr(global::System.IntPtr cPtr) {
93 Position2D ret = new Position2D(cPtr, false);
94 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
99 public Position2D() : this(NDalicPINVOKE.new_Vector2__SWIG_0(), true) {
100 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
103 public Position2D(int x, int y) : this(NDalicPINVOKE.new_Vector2__SWIG_1((float)x, (float)y), true) {
104 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
107 public Position2D(Position position) : this(NDalicPINVOKE.new_Vector2__SWIG_3(Position.getCPtr(position)), true) {
108 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
111 private Position2D Add(Position2D rhs) {
112 Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Add(swigCPtr, Position2D.getCPtr(rhs)), true);
113 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
117 private Position2D Subtract(Position2D rhs) {
118 Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Subtract__SWIG_0(swigCPtr, Position2D.getCPtr(rhs)), true);
119 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
124 private Position2D Multiply(Position2D rhs) {
125 Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Multiply__SWIG_0(swigCPtr, Position2D.getCPtr(rhs)), true);
126 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
130 private Position2D Multiply(int rhs) {
131 Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Multiply__SWIG_1(swigCPtr, (float)rhs), true);
132 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
137 private Position2D Divide(Position2D rhs) {
138 Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Divide__SWIG_0(swigCPtr, Position2D.getCPtr(rhs)), true);
139 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
143 private Position2D Divide(int rhs) {
144 Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Divide__SWIG_1(swigCPtr, (float)rhs), true);
145 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
149 private Position2D Subtract() {
150 Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Subtract__SWIG_1(swigCPtr), true);
151 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
155 public bool EqualTo(Position2D rhs) {
156 bool ret = NDalicPINVOKE.Vector2_EqualTo(swigCPtr, Position2D.getCPtr(rhs));
157 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
161 public bool NotEqualTo(Position2D rhs) {
162 bool ret = NDalicPINVOKE.Vector2_NotEqualTo(swigCPtr, Position2D.getCPtr(rhs));
163 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
167 private int ValueOfIndex(uint index) {
168 int ret = (int)NDalicPINVOKE.Vector2_ValueOfIndex__SWIG_0(swigCPtr, index);
169 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
176 NDalicPINVOKE.Vector2_X_set(swigCPtr, (float)value);
177 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
180 float ret = NDalicPINVOKE.Vector2_X_get(swigCPtr);
181 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
188 NDalicPINVOKE.Vector2_Y_set(swigCPtr, (float)value);
189 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
192 float ret = NDalicPINVOKE.Vector2_Y_get(swigCPtr);
193 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
198 public static implicit operator Vector2(Position2D position2d)
200 return new Vector2((float)position2d.X, (float)position2d.Y);
203 public static implicit operator Position2D(Vector2 vec)
205 return new Position2D((int)vec.X, (int)vec.Y);