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.
18 using System.ComponentModel;
19 using Tizen.NUI.BaseComponents;
23 /// This will be released at Tizen.NET API Level 6, so currently this would be used as inhouse API.
24 [EditorBrowsable(EditorBrowsableState.Never)]
25 public partial class Camera : View
28 internal Camera(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
32 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
34 Interop.CameraActor.DeleteCameraActor(swigCPtr);
37 new internal class Property
39 internal static readonly int TYPE = Interop.CameraActor.TypeGet();
40 internal static readonly int ProjectionMode = Interop.CameraActor.ProjectionModeGet();
41 internal static readonly int FieldOfView = Interop.CameraActor.FieldOfViewGet();
42 internal static readonly int AspectRatio = Interop.CameraActor.AspectRatioGet();
43 internal static readonly int NearPlaneDistance = Interop.CameraActor.NearPlaneDistanceGet();
44 internal static readonly int FarPlaneDistance = Interop.CameraActor.FarPlaneDistanceGet();
45 internal static readonly int LeftPlaneDistance = Interop.CameraActor.LeftPlaneDistanceGet();
46 internal static readonly int RightPlaneDistance = Interop.CameraActor.RightPlaneDistanceGet();
47 internal static readonly int TopPlaneDistance = Interop.CameraActor.TopPlaneDistanceGet();
48 internal static readonly int BottomPlaneDistance = Interop.CameraActor.BottomPlaneDistanceGet();
49 internal static readonly int TargetPosition = Interop.CameraActor.TargetPositionGet();
50 internal static readonly int ProjectionMatrix = Interop.CameraActor.ProjectionMatrixGet();
51 internal static readonly int ViewMatrix = Interop.CameraActor.ViewMatrixGet();
52 internal static readonly int InvertYAxis = Interop.CameraActor.InvertYAxisGet();
55 public Camera() : this(Interop.CameraActor.New(), true)
57 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
60 public Camera(Vector2 size) : this(Interop.CameraActor.New(Vector2.getCPtr(size)), true)
62 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
65 public static Camera DownCast(BaseHandle handle)
69 throw new global::System.ArgumentNullException(nameof(handle));
71 Camera ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Camera;
72 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
76 public Camera(Camera copy) : this(Interop.CameraActor.NewCameraActor(Camera.getCPtr(copy)), true)
78 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
81 public Camera Assign(Camera rhs)
83 Camera ret = new Camera(Interop.CameraActor.Assign(SwigCPtr, Camera.getCPtr(rhs)), false);
84 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
88 public void SetType(CameraType type)
90 Interop.CameraActor.SetType(SwigCPtr, (int)type);
91 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
94 public new CameraType GetType()
96 CameraType ret = (CameraType)Interop.CameraActor.GetType(SwigCPtr);
97 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
101 public void SetProjectionMode(ProjectionMode mode)
103 Interop.CameraActor.SetProjectionMode(SwigCPtr, (int)mode);
104 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
107 public ProjectionMode GetProjectionMode()
109 ProjectionMode ret = (ProjectionMode)Interop.CameraActor.GetProjectionMode(SwigCPtr);
110 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
114 [Obsolete("Deprecated in API9, will be removed in API11. Please use FieldOfView property instead!")]
115 public void SetFieldOfView(float fieldOfView)
117 Interop.CameraActor.SetFieldOfView(SwigCPtr, fieldOfView);
118 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
121 [Obsolete("Deprecated in API9, will be removed in API11. Please use FieldOfView property instead!")]
122 public float GetFieldOfView()
124 float ret = Interop.CameraActor.GetFieldOfView(SwigCPtr);
125 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
129 [Obsolete("Deprecated in API9, will be removed in API11. Please use AspectRatio property instead!")]
130 public void SetAspectRatio(float aspectRatio)
132 Interop.CameraActor.SetAspectRatio(SwigCPtr, aspectRatio);
133 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
136 [Obsolete("Deprecated in API9, will be removed in API11. Please use AspectRatio property instead!")]
137 public float GetAspectRatio()
139 float ret = Interop.CameraActor.GetAspectRatio(SwigCPtr);
140 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
144 public void SetNearClippingPlane(float nearClippingPlane)
146 Interop.CameraActor.SetNearClippingPlane(SwigCPtr, nearClippingPlane);
147 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
150 public float GetNearClippingPlane()
152 float ret = Interop.CameraActor.GetNearClippingPlane(SwigCPtr);
153 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
157 public void SetFarClippingPlane(float farClippingPlane)
159 Interop.CameraActor.SetFarClippingPlane(SwigCPtr, farClippingPlane);
160 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
163 public float GetFarClippingPlane()
165 float ret = Interop.CameraActor.GetFarClippingPlane(SwigCPtr);
166 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
170 [Obsolete("Deprecated in API9, will be removed in API11. Please use TargetPosition property instead!")]
171 public void SetTargetPosition(Vector3 targetPosition)
173 Interop.CameraActor.SetTargetPosition(SwigCPtr, Vector3.getCPtr(targetPosition));
174 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
177 [Obsolete("Deprecated in API9, will be removed in API11. Please use TargetPosition property instead!")]
178 public Vector3 GetTargetPosition()
180 Vector3 ret = new Vector3(Interop.CameraActor.GetTargetPosition(SwigCPtr), true);
181 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
185 [Obsolete("Deprecated in API9, will be removed in API11. Please use InvertYAxis property instead!")]
186 public void SetInvertYAxis(bool invertYAxis)
188 Interop.CameraActor.SetInvertYAxis(SwigCPtr, invertYAxis);
189 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
192 [Obsolete("Deprecated in API9, will be removed in API11. Please use InvertYAxis property instead!")]
193 public bool GetInvertYAxis()
195 bool ret = Interop.CameraActor.GetInvertYAxis(SwigCPtr);
196 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
200 public void SetPerspectiveProjection(Vector2 size)
202 Interop.CameraActor.SetPerspectiveProjection(SwigCPtr, Vector2.getCPtr(size));
203 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
206 public void SetOrthographicProjection(Vector2 size)
208 Interop.CameraActor.SetOrthographicProjection(SwigCPtr, Vector2.getCPtr(size));
209 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
212 public void SetOrthographicProjection(float left, float right, float top, float bottom, float near, float far)
214 Interop.CameraActor.SetOrthographicProjection(SwigCPtr, left, right, top, bottom, near, far);
215 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
218 // The type of GetType() and SetType() is different from Type property.
219 [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1721: Property names should not match get methods")]
224 return GetValue(TypeProperty) as string;
228 SetValue(TypeProperty, value);
229 NotifyPropertyChanged();
233 private string InternalType
237 string returnValue = "";
238 PropertyValue type = GetProperty(Camera.Property.TYPE);
239 type?.Get(out returnValue);
245 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
246 SetProperty(Camera.Property.TYPE, setValue);
251 // The type of GetProjectionMode() and SetProjectionMode() is different from Projection Property.
252 [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1721: Property names should not match get methods")]
253 public string ProjectionMode
257 return GetValue(ProjectionModeProperty) as string;
261 SetValue(ProjectionModeProperty, value);
262 NotifyPropertyChanged();
266 private string InternalProjectionMode
270 string returnValue = "";
271 PropertyValue projectionMode = GetProperty(Camera.Property.ProjectionMode);
272 projectionMode?.Get(out returnValue);
273 projectionMode?.Dispose();
278 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
279 SetProperty(Camera.Property.ProjectionMode, setValue);
284 public float FieldOfView
288 return (float)GetValue(FieldOfViewProperty);
292 SetValue(FieldOfViewProperty, value);
293 NotifyPropertyChanged();
297 private float InternalFieldOfView
301 float returnValue = 0.0f;
302 PropertyValue fieldView = GetProperty(Camera.Property.FieldOfView);
303 fieldView?.Get(out returnValue);
304 fieldView?.Dispose();
309 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
310 SetProperty(Camera.Property.FieldOfView, setValue);
315 public float AspectRatio
319 return (float)GetValue(AspectRatioProperty);
323 SetValue(AspectRatioProperty, value);
324 NotifyPropertyChanged();
328 private float InternalAspectRatio
332 float returnValue = 0.0f;
333 PropertyValue aspectRatio = GetProperty(Camera.Property.AspectRatio);
334 aspectRatio?.Get(out returnValue);
335 aspectRatio?.Dispose();
340 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
341 SetProperty(Camera.Property.AspectRatio, setValue);
346 public float NearPlaneDistance
350 return (float)GetValue(NearPlaneDistanceProperty);
354 SetValue(NearPlaneDistanceProperty, value);
355 NotifyPropertyChanged();
359 private float InternalNearPlaneDistance
363 float returnValue = 0.0f;
364 PropertyValue nearPlaneDistance = GetProperty(Camera.Property.NearPlaneDistance);
365 nearPlaneDistance?.Get(out returnValue);
366 nearPlaneDistance?.Dispose();
371 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
372 SetProperty(Camera.Property.NearPlaneDistance, setValue);
377 public float FarPlaneDistance
381 return (float)GetValue(FarPlaneDistanceProperty);
385 SetValue(FarPlaneDistanceProperty, value);
386 NotifyPropertyChanged();
390 private float InternalFarPlaneDistance
394 float returnValue = 0.0f;
395 PropertyValue farPlaneDistance = GetProperty(Camera.Property.FarPlaneDistance);
396 farPlaneDistance?.Get(out returnValue);
397 farPlaneDistance?.Dispose();
402 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
403 SetProperty(Camera.Property.FarPlaneDistance, setValue);
408 public float LeftPlaneDistance
412 return (float)GetValue(LeftPlaneDistanceProperty);
416 SetValue(LeftPlaneDistanceProperty, value);
417 NotifyPropertyChanged();
421 private float InternalLeftPlaneDistance
425 float returnValue = 0.0f;
426 PropertyValue leftPlaneDistance = GetProperty(Camera.Property.LeftPlaneDistance);
427 leftPlaneDistance?.Get(out returnValue);
428 leftPlaneDistance?.Dispose();
433 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
434 SetProperty(Camera.Property.LeftPlaneDistance, setValue);
439 public float RightPlaneDistance
443 return (float)GetValue(RightPlaneDistanceProperty);
447 SetValue(RightPlaneDistanceProperty, value);
448 NotifyPropertyChanged();
452 private float InternalRightPlaneDistance
456 float returnValue = 0.0f;
457 PropertyValue rightPlaneDistance = GetProperty(Camera.Property.RightPlaneDistance);
458 rightPlaneDistance?.Get(out returnValue);
459 rightPlaneDistance?.Dispose();
464 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
465 SetProperty(Camera.Property.RightPlaneDistance, setValue);
470 public float TopPlaneDistance
474 return (float)GetValue(TopPlaneDistanceProperty);
478 SetValue(TopPlaneDistanceProperty, value);
479 NotifyPropertyChanged();
483 private float InternalTopPlaneDistance
487 float returnValue = 0.0f;
488 PropertyValue topPlaneDistance = GetProperty(Camera.Property.TopPlaneDistance);
489 topPlaneDistance?.Get(out returnValue);
490 topPlaneDistance?.Dispose();
495 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
496 SetProperty(Camera.Property.TopPlaneDistance, setValue);
501 public float BottomPlaneDistance
505 return (float)GetValue(BottomPlaneDistanceProperty);
509 SetValue(BottomPlaneDistanceProperty, value);
510 NotifyPropertyChanged();
514 private float InternalBottomPlaneDistance
518 float returnValue = 0.0f;
519 PropertyValue bottomPlaneDistance = GetProperty(Camera.Property.BottomPlaneDistance);
520 bottomPlaneDistance?.Get(out returnValue);
521 bottomPlaneDistance?.Dispose();
526 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
527 SetProperty(Camera.Property.BottomPlaneDistance, setValue);
532 public Vector3 TargetPosition
536 return GetValue(TargetPositionProperty) as Vector3;
540 SetValue(TargetPositionProperty, value);
541 NotifyPropertyChanged();
545 private Vector3 InternalTargetPosition
549 Vector3 returnValue = new Vector3(0.0f, 0.0f, 0.0f);
550 PropertyValue targetPosition = GetProperty(Camera.Property.TargetPosition);
551 targetPosition?.Get(returnValue);
552 targetPosition?.Dispose();
557 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
558 SetProperty(Camera.Property.TargetPosition, setValue);
562 internal Matrix ProjectionMatrix
566 Matrix returnValue = new Matrix();
567 PropertyValue projectionMatrix = GetProperty(Camera.Property.ProjectionMatrix);
568 projectionMatrix?.Get(returnValue);
569 projectionMatrix?.Dispose();
573 internal Matrix ViewMatrix
577 Matrix returnValue = new Matrix();
578 PropertyValue viewMatrix = GetProperty(Camera.Property.ViewMatrix);
579 viewMatrix.Get(returnValue);
580 viewMatrix.Dispose();
585 public bool InvertYAxis
589 return (bool)GetValue(InvertYAxisProperty);
593 SetValue(InvertYAxisProperty, value);
594 NotifyPropertyChanged();
598 private bool InternalInvertYAxis
602 bool returnValue = false;
603 PropertyValue invertYAxis = GetProperty(Camera.Property.InvertYAxis);
604 invertYAxis?.Get(out returnValue);
605 invertYAxis?.Dispose();
610 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
611 SetProperty(Camera.Property.InvertYAxis, setValue);