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.
21 internal class Camera : Animatable
23 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
25 internal Camera(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.CameraActor_SWIGUpcast(cPtr), cMemoryOwn)
27 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
30 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Camera obj)
32 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
35 protected override void Dispose(DisposeTypes type)
42 if (type == DisposeTypes.Explicit)
45 //Release your own managed resources here.
46 //You should release all of your own disposable objects here.
50 //Release your own unmanaged resources here.
51 //You should not access any managed member here except static instance.
52 //because the execution order of Finalizes is non-deterministic.
54 if (swigCPtr.Handle != global::System.IntPtr.Zero)
59 NDalicPINVOKE.delete_CameraActor(swigCPtr);
61 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
69 public class Property : global::System.IDisposable
71 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
72 protected bool swigCMemOwn;
74 internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
76 swigCMemOwn = cMemoryOwn;
77 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
80 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
82 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
85 //A Flag to check who called Dispose(). (By User or DisposeQueue)
86 private bool isDisposeQueued = false;
87 //A Flat to check if it is already disposed.
88 protected bool disposed = false;
94 isDisposeQueued = true;
95 DisposeQueue.Instance.Add(this);
101 //Throw excpetion if Dispose() is called in separate thread.
102 if (!Window.IsInstalled())
104 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
109 Dispose(DisposeTypes.Implicit);
113 Dispose(DisposeTypes.Explicit);
114 System.GC.SuppressFinalize(this);
118 protected virtual void Dispose(DisposeTypes type)
125 if (type == DisposeTypes.Explicit)
128 //Release your own managed resources here.
129 //You should release all of your own disposable objects here.
133 //Release your own unmanaged resources here.
134 //You should not access any managed member here except static instance.
135 //because the execution order of Finalizes is non-deterministic.
137 if (swigCPtr.Handle != global::System.IntPtr.Zero)
142 NDalicPINVOKE.delete_CameraActor_Property(swigCPtr);
144 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
151 public Property() : this(NDalicPINVOKE.new_CameraActor_Property(), true)
153 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
156 public static readonly int TYPE = NDalicPINVOKE.CameraActor_Property_TYPE_get();
157 public static readonly int PROJECTION_MODE = NDalicPINVOKE.CameraActor_Property_PROJECTION_MODE_get();
158 public static readonly int FIELD_OF_VIEW = NDalicPINVOKE.CameraActor_Property_FIELD_OF_VIEW_get();
159 public static readonly int ASPECT_RATIO = NDalicPINVOKE.CameraActor_Property_ASPECT_RATIO_get();
160 public static readonly int NEAR_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_NEAR_PLANE_DISTANCE_get();
161 public static readonly int FAR_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_FAR_PLANE_DISTANCE_get();
162 public static readonly int LEFT_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_LEFT_PLANE_DISTANCE_get();
163 public static readonly int RIGHT_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_RIGHT_PLANE_DISTANCE_get();
164 public static readonly int TOP_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_TOP_PLANE_DISTANCE_get();
165 public static readonly int BOTTOM_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_BOTTOM_PLANE_DISTANCE_get();
166 public static readonly int TARGET_POSITION = NDalicPINVOKE.CameraActor_Property_TARGET_POSITION_get();
167 public static readonly int PROJECTION_MATRIX = NDalicPINVOKE.CameraActor_Property_PROJECTION_MATRIX_get();
168 public static readonly int VIEW_MATRIX = NDalicPINVOKE.CameraActor_Property_VIEW_MATRIX_get();
169 public static readonly int INVERT_Y_AXIS = NDalicPINVOKE.CameraActor_Property_INVERT_Y_AXIS_get();
173 public Camera() : this(NDalicPINVOKE.CameraActor_New__SWIG_0(), true)
175 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
178 public Camera(Vector2 size) : this(NDalicPINVOKE.CameraActor_New__SWIG_1(Vector2.getCPtr(size)), true)
180 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
183 public static Camera DownCast(BaseHandle handle)
185 Camera ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Camera;
186 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
190 public Camera(Camera copy) : this(NDalicPINVOKE.new_CameraActor__SWIG_1(Camera.getCPtr(copy)), true)
192 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
195 public Camera Assign(Camera rhs)
197 Camera ret = new Camera(NDalicPINVOKE.CameraActor_Assign(swigCPtr, Camera.getCPtr(rhs)), false);
198 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
202 public void SetType(CameraType type)
204 NDalicPINVOKE.CameraActor_SetType(swigCPtr, (int)type);
205 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
208 public new CameraType GetType()
210 CameraType ret = (CameraType)NDalicPINVOKE.CameraActor_GetType(swigCPtr);
211 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
215 public void SetProjectionMode(ProjectionMode mode)
217 NDalicPINVOKE.CameraActor_SetProjectionMode(swigCPtr, (int)mode);
218 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
221 public ProjectionMode GetProjectionMode()
223 ProjectionMode ret = (ProjectionMode)NDalicPINVOKE.CameraActor_GetProjectionMode(swigCPtr);
224 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
228 public void SetFieldOfView(float fieldOfView)
230 NDalicPINVOKE.CameraActor_SetFieldOfView(swigCPtr, fieldOfView);
231 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
234 public float GetFieldOfView()
236 float ret = NDalicPINVOKE.CameraActor_GetFieldOfView(swigCPtr);
237 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
241 public void SetAspectRatio(float aspectRatio)
243 NDalicPINVOKE.CameraActor_SetAspectRatio(swigCPtr, aspectRatio);
244 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
247 public float GetAspectRatio()
249 float ret = NDalicPINVOKE.CameraActor_GetAspectRatio(swigCPtr);
250 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
254 public void SetNearClippingPlane(float nearClippingPlane)
256 NDalicPINVOKE.CameraActor_SetNearClippingPlane(swigCPtr, nearClippingPlane);
257 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
260 public float GetNearClippingPlane()
262 float ret = NDalicPINVOKE.CameraActor_GetNearClippingPlane(swigCPtr);
263 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
267 public void SetFarClippingPlane(float farClippingPlane)
269 NDalicPINVOKE.CameraActor_SetFarClippingPlane(swigCPtr, farClippingPlane);
270 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
273 public float GetFarClippingPlane()
275 float ret = NDalicPINVOKE.CameraActor_GetFarClippingPlane(swigCPtr);
276 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
280 public void SetTargetPosition(Vector3 targetPosition)
282 NDalicPINVOKE.CameraActor_SetTargetPosition(swigCPtr, Vector3.getCPtr(targetPosition));
283 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
286 public Vector3 GetTargetPosition()
288 Vector3 ret = new Vector3(NDalicPINVOKE.CameraActor_GetTargetPosition(swigCPtr), true);
289 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
293 public void SetInvertYAxis(bool invertYAxis)
295 NDalicPINVOKE.CameraActor_SetInvertYAxis(swigCPtr, invertYAxis);
296 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
299 public bool GetInvertYAxis()
301 bool ret = NDalicPINVOKE.CameraActor_GetInvertYAxis(swigCPtr);
302 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
306 public void SetPerspectiveProjection(Vector2 size)
308 NDalicPINVOKE.CameraActor_SetPerspectiveProjection(swigCPtr, Vector2.getCPtr(size));
309 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
312 public void SetOrthographicProjection(Vector2 size)
314 NDalicPINVOKE.CameraActor_SetOrthographicProjection__SWIG_0(swigCPtr, Vector2.getCPtr(size));
315 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
318 public void SetOrthographicProjection(float left, float right, float top, float bottom, float near, float far)
320 NDalicPINVOKE.CameraActor_SetOrthographicProjection__SWIG_1(swigCPtr, left, right, top, bottom, near, far);
321 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
329 GetProperty(Camera.Property.TYPE).Get(out temp);
334 SetProperty(Camera.Property.TYPE, new Tizen.NUI.PropertyValue(value));
337 public string ProjectionMode
342 GetProperty(Camera.Property.PROJECTION_MODE).Get(out temp);
347 SetProperty(Camera.Property.PROJECTION_MODE, new Tizen.NUI.PropertyValue(value));
350 public float FieldOfView
355 GetProperty(Camera.Property.FIELD_OF_VIEW).Get(out temp);
360 SetProperty(Camera.Property.FIELD_OF_VIEW, new Tizen.NUI.PropertyValue(value));
363 public float AspectRatio
368 GetProperty(Camera.Property.ASPECT_RATIO).Get(out temp);
373 SetProperty(Camera.Property.ASPECT_RATIO, new Tizen.NUI.PropertyValue(value));
376 public float NearPlaneDistance
381 GetProperty(Camera.Property.NEAR_PLANE_DISTANCE).Get(out temp);
386 SetProperty(Camera.Property.NEAR_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
389 public float FarPlaneDistance
394 GetProperty(Camera.Property.FAR_PLANE_DISTANCE).Get(out temp);
399 SetProperty(Camera.Property.FAR_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
402 public float LeftPlaneDistance
407 GetProperty(Camera.Property.LEFT_PLANE_DISTANCE).Get(out temp);
412 SetProperty(Camera.Property.LEFT_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
415 public float RightPlaneDistance
420 GetProperty(Camera.Property.RIGHT_PLANE_DISTANCE).Get(out temp);
425 SetProperty(Camera.Property.RIGHT_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
428 public float TopPlaneDistance
433 GetProperty(Camera.Property.TOP_PLANE_DISTANCE).Get(out temp);
438 SetProperty(Camera.Property.TOP_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
441 public float BottomPlaneDistance
446 GetProperty(Camera.Property.BOTTOM_PLANE_DISTANCE).Get(out temp);
451 SetProperty(Camera.Property.BOTTOM_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
454 public Vector3 TargetPosition
458 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
459 GetProperty(Camera.Property.TARGET_POSITION).Get(temp);
464 SetProperty(Camera.Property.TARGET_POSITION, new Tizen.NUI.PropertyValue(value));
467 internal Matrix ProjectionMatrix
471 Matrix temp = new Matrix();
472 GetProperty(Camera.Property.PROJECTION_MATRIX).Get(temp);
476 internal Matrix ViewMatrix
480 Matrix temp = new Matrix();
481 GetProperty(Camera.Property.VIEW_MATRIX).Get(temp);
485 public bool InvertYAxis
490 GetProperty(Camera.Property.INVERT_Y_AXIS).Get(out temp);
495 SetProperty(Camera.Property.INVERT_Y_AXIS, new Tizen.NUI.PropertyValue(value));