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)
58 NDalicPINVOKE.delete_CameraActor(swigCPtr);
60 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
68 public class Property : global::System.IDisposable
70 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
71 protected bool swigCMemOwn;
73 internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
75 swigCMemOwn = cMemoryOwn;
76 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
79 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
81 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
84 //A Flag to check who called Dispose(). (By User or DisposeQueue)
85 private bool isDisposeQueued = false;
86 //A Flat to check if it is already disposed.
87 protected bool disposed = false;
93 isDisposeQueued = true;
94 DisposeQueue.Instance.Add(this);
100 //Throw excpetion if Dispose() is called in separate thread.
101 if (!Window.IsInstalled())
103 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
108 Dispose(DisposeTypes.Implicit);
112 Dispose(DisposeTypes.Explicit);
113 System.GC.SuppressFinalize(this);
117 protected virtual void Dispose(DisposeTypes type)
124 if (type == DisposeTypes.Explicit)
127 //Release your own managed resources here.
128 //You should release all of your own disposable objects here.
132 //Release your own unmanaged resources here.
133 //You should not access any managed member here except static instance.
134 //because the execution order of Finalizes is non-deterministic.
136 if (swigCPtr.Handle != global::System.IntPtr.Zero)
141 NDalicPINVOKE.delete_CameraActor_Property(swigCPtr);
143 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
150 public Property() : this(NDalicPINVOKE.new_CameraActor_Property(), true)
152 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
155 public static readonly int TYPE = NDalicPINVOKE.CameraActor_Property_TYPE_get();
156 public static readonly int PROJECTION_MODE = NDalicPINVOKE.CameraActor_Property_PROJECTION_MODE_get();
157 public static readonly int FIELD_OF_VIEW = NDalicPINVOKE.CameraActor_Property_FIELD_OF_VIEW_get();
158 public static readonly int ASPECT_RATIO = NDalicPINVOKE.CameraActor_Property_ASPECT_RATIO_get();
159 public static readonly int NEAR_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_NEAR_PLANE_DISTANCE_get();
160 public static readonly int FAR_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_FAR_PLANE_DISTANCE_get();
161 public static readonly int LEFT_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_LEFT_PLANE_DISTANCE_get();
162 public static readonly int RIGHT_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_RIGHT_PLANE_DISTANCE_get();
163 public static readonly int TOP_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_TOP_PLANE_DISTANCE_get();
164 public static readonly int BOTTOM_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_BOTTOM_PLANE_DISTANCE_get();
165 public static readonly int TARGET_POSITION = NDalicPINVOKE.CameraActor_Property_TARGET_POSITION_get();
166 public static readonly int PROJECTION_MATRIX = NDalicPINVOKE.CameraActor_Property_PROJECTION_MATRIX_get();
167 public static readonly int VIEW_MATRIX = NDalicPINVOKE.CameraActor_Property_VIEW_MATRIX_get();
168 public static readonly int INVERT_Y_AXIS = NDalicPINVOKE.CameraActor_Property_INVERT_Y_AXIS_get();
172 public Camera() : this(NDalicPINVOKE.CameraActor_New__SWIG_0(), true)
174 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
177 public Camera(Vector2 size) : this(NDalicPINVOKE.CameraActor_New__SWIG_1(Vector2.getCPtr(size)), true)
179 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
182 public new static Camera DownCast(BaseHandle handle)
184 Camera ret = new Camera(NDalicPINVOKE.CameraActor_DownCast(BaseHandle.getCPtr(handle)), true);
185 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
189 public Camera(Camera copy) : this(NDalicPINVOKE.new_CameraActor__SWIG_1(Camera.getCPtr(copy)), true)
191 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
194 public Camera Assign(Camera rhs)
196 Camera ret = new Camera(NDalicPINVOKE.CameraActor_Assign(swigCPtr, Camera.getCPtr(rhs)), false);
197 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
201 public void SetType(CameraType type)
203 NDalicPINVOKE.CameraActor_SetType(swigCPtr, (int)type);
204 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
207 public CameraType GetType()
209 CameraType ret = (CameraType)NDalicPINVOKE.CameraActor_GetType(swigCPtr);
210 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
214 public void SetProjectionMode(ProjectionMode mode)
216 NDalicPINVOKE.CameraActor_SetProjectionMode(swigCPtr, (int)mode);
217 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
220 public ProjectionMode GetProjectionMode()
222 ProjectionMode ret = (ProjectionMode)NDalicPINVOKE.CameraActor_GetProjectionMode(swigCPtr);
223 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
227 public void SetFieldOfView(float fieldOfView)
229 NDalicPINVOKE.CameraActor_SetFieldOfView(swigCPtr, fieldOfView);
230 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
233 public float GetFieldOfView()
235 float ret = NDalicPINVOKE.CameraActor_GetFieldOfView(swigCPtr);
236 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
240 public void SetAspectRatio(float aspectRatio)
242 NDalicPINVOKE.CameraActor_SetAspectRatio(swigCPtr, aspectRatio);
243 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
246 public float GetAspectRatio()
248 float ret = NDalicPINVOKE.CameraActor_GetAspectRatio(swigCPtr);
249 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
253 public void SetNearClippingPlane(float nearClippingPlane)
255 NDalicPINVOKE.CameraActor_SetNearClippingPlane(swigCPtr, nearClippingPlane);
256 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
259 public float GetNearClippingPlane()
261 float ret = NDalicPINVOKE.CameraActor_GetNearClippingPlane(swigCPtr);
262 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
266 public void SetFarClippingPlane(float farClippingPlane)
268 NDalicPINVOKE.CameraActor_SetFarClippingPlane(swigCPtr, farClippingPlane);
269 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
272 public float GetFarClippingPlane()
274 float ret = NDalicPINVOKE.CameraActor_GetFarClippingPlane(swigCPtr);
275 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
279 public void SetTargetPosition(Vector3 targetPosition)
281 NDalicPINVOKE.CameraActor_SetTargetPosition(swigCPtr, Vector3.getCPtr(targetPosition));
282 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
285 public Vector3 GetTargetPosition()
287 Vector3 ret = new Vector3(NDalicPINVOKE.CameraActor_GetTargetPosition(swigCPtr), true);
288 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
292 public void SetInvertYAxis(bool invertYAxis)
294 NDalicPINVOKE.CameraActor_SetInvertYAxis(swigCPtr, invertYAxis);
295 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
298 public bool GetInvertYAxis()
300 bool ret = NDalicPINVOKE.CameraActor_GetInvertYAxis(swigCPtr);
301 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
305 public void SetPerspectiveProjection(Vector2 size)
307 NDalicPINVOKE.CameraActor_SetPerspectiveProjection(swigCPtr, Vector2.getCPtr(size));
308 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
311 public void SetOrthographicProjection(Vector2 size)
313 NDalicPINVOKE.CameraActor_SetOrthographicProjection__SWIG_0(swigCPtr, Vector2.getCPtr(size));
314 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
317 public void SetOrthographicProjection(float left, float right, float top, float bottom, float near, float far)
319 NDalicPINVOKE.CameraActor_SetOrthographicProjection__SWIG_1(swigCPtr, left, right, top, bottom, near, far);
320 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
328 GetProperty(Camera.Property.TYPE).Get(out temp);
333 SetProperty(Camera.Property.TYPE, new Tizen.NUI.PropertyValue(value));
336 public string ProjectionMode
341 GetProperty(Camera.Property.PROJECTION_MODE).Get(out temp);
346 SetProperty(Camera.Property.PROJECTION_MODE, new Tizen.NUI.PropertyValue(value));
349 public float FieldOfView
354 GetProperty(Camera.Property.FIELD_OF_VIEW).Get(out temp);
359 SetProperty(Camera.Property.FIELD_OF_VIEW, new Tizen.NUI.PropertyValue(value));
362 public float AspectRatio
367 GetProperty(Camera.Property.ASPECT_RATIO).Get(out temp);
372 SetProperty(Camera.Property.ASPECT_RATIO, new Tizen.NUI.PropertyValue(value));
375 public float NearPlaneDistance
380 GetProperty(Camera.Property.NEAR_PLANE_DISTANCE).Get(out temp);
385 SetProperty(Camera.Property.NEAR_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
388 public float FarPlaneDistance
393 GetProperty(Camera.Property.FAR_PLANE_DISTANCE).Get(out temp);
398 SetProperty(Camera.Property.FAR_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
401 public float LeftPlaneDistance
406 GetProperty(Camera.Property.LEFT_PLANE_DISTANCE).Get(out temp);
411 SetProperty(Camera.Property.LEFT_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
414 public float RightPlaneDistance
419 GetProperty(Camera.Property.RIGHT_PLANE_DISTANCE).Get(out temp);
424 SetProperty(Camera.Property.RIGHT_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
427 public float TopPlaneDistance
432 GetProperty(Camera.Property.TOP_PLANE_DISTANCE).Get(out temp);
437 SetProperty(Camera.Property.TOP_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
440 public float BottomPlaneDistance
445 GetProperty(Camera.Property.BOTTOM_PLANE_DISTANCE).Get(out temp);
450 SetProperty(Camera.Property.BOTTOM_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
453 public Vector3 TargetPosition
457 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
458 GetProperty(Camera.Property.TARGET_POSITION).Get(temp);
463 SetProperty(Camera.Property.TARGET_POSITION, new Tizen.NUI.PropertyValue(value));
466 internal Matrix ProjectionMatrix
470 Matrix temp = new Matrix();
471 GetProperty(Camera.Property.PROJECTION_MATRIX).Get(temp);
475 internal Matrix ViewMatrix
479 Matrix temp = new Matrix();
480 GetProperty(Camera.Property.VIEW_MATRIX).Get(temp);
484 public bool InvertYAxis
489 GetProperty(Camera.Property.INVERT_Y_AXIS).Get(out temp);
494 SetProperty(Camera.Property.INVERT_Y_AXIS, new Tizen.NUI.PropertyValue(value));