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 Camera : Animatable
22 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
24 internal Camera(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.CameraActor_SWIGUpcast(cPtr), cMemoryOwn)
26 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
29 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Camera obj)
31 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
34 protected override void Dispose(DisposeTypes type)
41 if (type == DisposeTypes.Explicit)
44 //Release your own managed resources here.
45 //You should release all of your own disposable objects here.
49 //Release your own unmanaged resources here.
50 //You should not access any managed member here except static instance.
51 //because the execution order of Finalizes is non-deterministic.
53 if (swigCPtr.Handle != global::System.IntPtr.Zero)
59 //Unreference this instance from Registry.
60 Registry.Unregister(this);
62 NDalicPINVOKE.delete_CameraActor(swigCPtr);
64 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
72 public class Property : global::System.IDisposable
74 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
75 protected bool swigCMemOwn;
77 internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
79 swigCMemOwn = cMemoryOwn;
80 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
83 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
85 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
88 //A Flag to check who called Dispose(). (By User or DisposeQueue)
89 private bool isDisposeQueued = false;
90 //A Flat to check if it is already disposed.
91 protected bool disposed = false;
97 isDisposeQueued = true;
98 DisposeQueue.Instance.Add(this);
102 public void Dispose()
104 //Throw excpetion if Dispose() is called in separate thread.
105 if (!Window.IsInstalled())
107 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
112 Dispose(DisposeTypes.Implicit);
116 Dispose(DisposeTypes.Explicit);
117 System.GC.SuppressFinalize(this);
121 protected virtual void Dispose(DisposeTypes type)
128 if (type == DisposeTypes.Explicit)
131 //Release your own managed resources here.
132 //You should release all of your own disposable objects here.
136 //Release your own unmanaged resources here.
137 //You should not access any managed member here except static instance.
138 //because the execution order of Finalizes is non-deterministic.
140 if (swigCPtr.Handle != global::System.IntPtr.Zero)
145 NDalicPINVOKE.delete_CameraActor_Property(swigCPtr);
147 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
154 public Property() : this(NDalicPINVOKE.new_CameraActor_Property(), true)
156 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
159 public static readonly int TYPE = NDalicPINVOKE.CameraActor_Property_TYPE_get();
160 public static readonly int PROJECTION_MODE = NDalicPINVOKE.CameraActor_Property_PROJECTION_MODE_get();
161 public static readonly int FIELD_OF_VIEW = NDalicPINVOKE.CameraActor_Property_FIELD_OF_VIEW_get();
162 public static readonly int ASPECT_RATIO = NDalicPINVOKE.CameraActor_Property_ASPECT_RATIO_get();
163 public static readonly int NEAR_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_NEAR_PLANE_DISTANCE_get();
164 public static readonly int FAR_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_FAR_PLANE_DISTANCE_get();
165 public static readonly int LEFT_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_LEFT_PLANE_DISTANCE_get();
166 public static readonly int RIGHT_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_RIGHT_PLANE_DISTANCE_get();
167 public static readonly int TOP_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_TOP_PLANE_DISTANCE_get();
168 public static readonly int BOTTOM_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_BOTTOM_PLANE_DISTANCE_get();
169 public static readonly int TARGET_POSITION = NDalicPINVOKE.CameraActor_Property_TARGET_POSITION_get();
170 public static readonly int PROJECTION_MATRIX = NDalicPINVOKE.CameraActor_Property_PROJECTION_MATRIX_get();
171 public static readonly int VIEW_MATRIX = NDalicPINVOKE.CameraActor_Property_VIEW_MATRIX_get();
172 public static readonly int INVERT_Y_AXIS = NDalicPINVOKE.CameraActor_Property_INVERT_Y_AXIS_get();
176 public Camera() : this(NDalicPINVOKE.CameraActor_New__SWIG_0(), true)
178 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
181 public Camera(Vector2 size) : this(NDalicPINVOKE.CameraActor_New__SWIG_1(Vector2.getCPtr(size)), true)
183 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
186 public new static Camera DownCast(BaseHandle handle)
188 Camera ret = new Camera(NDalicPINVOKE.CameraActor_DownCast(BaseHandle.getCPtr(handle)), true);
189 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
193 public Camera(Camera copy) : this(NDalicPINVOKE.new_CameraActor__SWIG_1(Camera.getCPtr(copy)), true)
195 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
198 public Camera Assign(Camera rhs)
200 Camera ret = new Camera(NDalicPINVOKE.CameraActor_Assign(swigCPtr, Camera.getCPtr(rhs)), false);
201 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
205 public void SetType(CameraType type)
207 NDalicPINVOKE.CameraActor_SetType(swigCPtr, (int)type);
208 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
211 public CameraType GetType()
213 CameraType ret = (CameraType)NDalicPINVOKE.CameraActor_GetType(swigCPtr);
214 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
218 public void SetProjectionMode(ProjectionMode mode)
220 NDalicPINVOKE.CameraActor_SetProjectionMode(swigCPtr, (int)mode);
221 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
224 public ProjectionMode GetProjectionMode()
226 ProjectionMode ret = (ProjectionMode)NDalicPINVOKE.CameraActor_GetProjectionMode(swigCPtr);
227 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
231 public void SetFieldOfView(float fieldOfView)
233 NDalicPINVOKE.CameraActor_SetFieldOfView(swigCPtr, fieldOfView);
234 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
237 public float GetFieldOfView()
239 float ret = NDalicPINVOKE.CameraActor_GetFieldOfView(swigCPtr);
240 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
244 public void SetAspectRatio(float aspectRatio)
246 NDalicPINVOKE.CameraActor_SetAspectRatio(swigCPtr, aspectRatio);
247 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
250 public float GetAspectRatio()
252 float ret = NDalicPINVOKE.CameraActor_GetAspectRatio(swigCPtr);
253 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
257 public void SetNearClippingPlane(float nearClippingPlane)
259 NDalicPINVOKE.CameraActor_SetNearClippingPlane(swigCPtr, nearClippingPlane);
260 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
263 public float GetNearClippingPlane()
265 float ret = NDalicPINVOKE.CameraActor_GetNearClippingPlane(swigCPtr);
266 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
270 public void SetFarClippingPlane(float farClippingPlane)
272 NDalicPINVOKE.CameraActor_SetFarClippingPlane(swigCPtr, farClippingPlane);
273 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
276 public float GetFarClippingPlane()
278 float ret = NDalicPINVOKE.CameraActor_GetFarClippingPlane(swigCPtr);
279 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
283 public void SetTargetPosition(Vector3 targetPosition)
285 NDalicPINVOKE.CameraActor_SetTargetPosition(swigCPtr, Vector3.getCPtr(targetPosition));
286 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
289 public Vector3 GetTargetPosition()
291 Vector3 ret = new Vector3(NDalicPINVOKE.CameraActor_GetTargetPosition(swigCPtr), true);
292 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
296 public void SetInvertYAxis(bool invertYAxis)
298 NDalicPINVOKE.CameraActor_SetInvertYAxis(swigCPtr, invertYAxis);
299 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
302 public bool GetInvertYAxis()
304 bool ret = NDalicPINVOKE.CameraActor_GetInvertYAxis(swigCPtr);
305 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
309 public void SetPerspectiveProjection(Vector2 size)
311 NDalicPINVOKE.CameraActor_SetPerspectiveProjection(swigCPtr, Vector2.getCPtr(size));
312 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
315 public void SetOrthographicProjection(Vector2 size)
317 NDalicPINVOKE.CameraActor_SetOrthographicProjection__SWIG_0(swigCPtr, Vector2.getCPtr(size));
318 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
321 public void SetOrthographicProjection(float left, float right, float top, float bottom, float near, float far)
323 NDalicPINVOKE.CameraActor_SetOrthographicProjection__SWIG_1(swigCPtr, left, right, top, bottom, near, far);
324 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
332 GetProperty(Camera.Property.TYPE).Get(out temp);
337 SetProperty(Camera.Property.TYPE, new Tizen.NUI.PropertyValue(value));
340 public string ProjectionMode
345 GetProperty(Camera.Property.PROJECTION_MODE).Get(out temp);
350 SetProperty(Camera.Property.PROJECTION_MODE, new Tizen.NUI.PropertyValue(value));
353 public float FieldOfView
358 GetProperty(Camera.Property.FIELD_OF_VIEW).Get(out temp);
363 SetProperty(Camera.Property.FIELD_OF_VIEW, new Tizen.NUI.PropertyValue(value));
366 public float AspectRatio
371 GetProperty(Camera.Property.ASPECT_RATIO).Get(out temp);
376 SetProperty(Camera.Property.ASPECT_RATIO, new Tizen.NUI.PropertyValue(value));
379 public float NearPlaneDistance
384 GetProperty(Camera.Property.NEAR_PLANE_DISTANCE).Get(out temp);
389 SetProperty(Camera.Property.NEAR_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
392 public float FarPlaneDistance
397 GetProperty(Camera.Property.FAR_PLANE_DISTANCE).Get(out temp);
402 SetProperty(Camera.Property.FAR_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
405 public float LeftPlaneDistance
410 GetProperty(Camera.Property.LEFT_PLANE_DISTANCE).Get(out temp);
415 SetProperty(Camera.Property.LEFT_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
418 public float RightPlaneDistance
423 GetProperty(Camera.Property.RIGHT_PLANE_DISTANCE).Get(out temp);
428 SetProperty(Camera.Property.RIGHT_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
431 public float TopPlaneDistance
436 GetProperty(Camera.Property.TOP_PLANE_DISTANCE).Get(out temp);
441 SetProperty(Camera.Property.TOP_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
444 public float BottomPlaneDistance
449 GetProperty(Camera.Property.BOTTOM_PLANE_DISTANCE).Get(out temp);
454 SetProperty(Camera.Property.BOTTOM_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
457 public Vector3 TargetPosition
461 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
462 GetProperty(Camera.Property.TARGET_POSITION).Get(temp);
467 SetProperty(Camera.Property.TARGET_POSITION, new Tizen.NUI.PropertyValue(value));
470 internal Matrix ProjectionMatrix
474 Matrix temp = new Matrix();
475 GetProperty(Camera.Property.PROJECTION_MATRIX).Get(temp);
479 internal Matrix ViewMatrix
483 Matrix temp = new Matrix();
484 GetProperty(Camera.Property.VIEW_MATRIX).Get(temp);
488 public bool InvertYAxis
493 GetProperty(Camera.Property.INVERT_Y_AXIS).Get(out temp);
498 SetProperty(Camera.Property.INVERT_Y_AXIS, new Tizen.NUI.PropertyValue(value));