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 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 string returnValue = "";
225 PropertyValue type = GetProperty(Camera.Property.TYPE);
226 type?.Get(out returnValue);
232 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
233 SetProperty(Camera.Property.TYPE, setValue);
238 // The type of GetProjectionMode() and SetProjectionMode() is different from Projection Property.
239 [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1721: Property names should not match get methods")]
240 public string ProjectionMode
244 string returnValue = "";
245 PropertyValue projectionMode = GetProperty(Camera.Property.ProjectionMode);
246 projectionMode?.Get(out returnValue);
247 projectionMode?.Dispose();
252 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
253 SetProperty(Camera.Property.ProjectionMode, setValue);
257 public float FieldOfView
261 float returnValue = 0.0f;
262 PropertyValue fieldView = GetProperty(Camera.Property.FieldOfView);
263 fieldView?.Get(out returnValue);
264 fieldView?.Dispose();
269 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
270 SetProperty(Camera.Property.FieldOfView, setValue);
274 public float AspectRatio
278 float returnValue = 0.0f;
279 PropertyValue aspectRatio = GetProperty(Camera.Property.AspectRatio);
280 aspectRatio?.Get(out returnValue);
281 aspectRatio?.Dispose();
286 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
287 SetProperty(Camera.Property.AspectRatio, setValue);
291 public float NearPlaneDistance
295 float returnValue = 0.0f;
296 PropertyValue nearPlaneDistance = GetProperty(Camera.Property.NearPlaneDistance);
297 nearPlaneDistance?.Get(out returnValue);
298 nearPlaneDistance?.Dispose();
303 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
304 SetProperty(Camera.Property.NearPlaneDistance, setValue);
308 public float FarPlaneDistance
312 float returnValue = 0.0f;
313 PropertyValue farPlaneDistance = GetProperty(Camera.Property.FarPlaneDistance);
314 farPlaneDistance?.Get(out returnValue);
315 farPlaneDistance?.Dispose();
320 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
321 SetProperty(Camera.Property.FarPlaneDistance, setValue);
325 public float LeftPlaneDistance
329 float returnValue = 0.0f;
330 PropertyValue leftPlaneDistance = GetProperty(Camera.Property.LeftPlaneDistance);
331 leftPlaneDistance?.Get(out returnValue);
332 leftPlaneDistance?.Dispose();
337 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
338 SetProperty(Camera.Property.LeftPlaneDistance, setValue);
342 public float RightPlaneDistance
346 float returnValue = 0.0f;
347 PropertyValue rightPlaneDistance = GetProperty(Camera.Property.RightPlaneDistance);
348 rightPlaneDistance?.Get(out returnValue);
349 rightPlaneDistance?.Dispose();
354 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
355 SetProperty(Camera.Property.RightPlaneDistance, setValue);
359 public float TopPlaneDistance
363 float returnValue = 0.0f;
364 PropertyValue topPlaneDistance = GetProperty(Camera.Property.TopPlaneDistance);
365 topPlaneDistance?.Get(out returnValue);
366 topPlaneDistance?.Dispose();
371 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
372 SetProperty(Camera.Property.TopPlaneDistance, setValue);
376 public float BottomPlaneDistance
380 float returnValue = 0.0f;
381 PropertyValue bottomPlaneDistance = GetProperty(Camera.Property.BottomPlaneDistance);
382 bottomPlaneDistance?.Get(out returnValue);
383 bottomPlaneDistance?.Dispose();
388 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
389 SetProperty(Camera.Property.BottomPlaneDistance, setValue);
393 public Vector3 TargetPosition
397 Vector3 returnValue = new Vector3(0.0f, 0.0f, 0.0f);
398 PropertyValue targetPosition = GetProperty(Camera.Property.TargetPosition);
399 targetPosition?.Get(returnValue);
400 targetPosition?.Dispose();
405 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
406 SetProperty(Camera.Property.TargetPosition, setValue);
410 internal Matrix ProjectionMatrix
414 Matrix returnValue = new Matrix();
415 PropertyValue projectionMatrix = GetProperty(Camera.Property.ProjectionMatrix);
416 projectionMatrix?.Get(returnValue);
417 projectionMatrix?.Dispose();
421 internal Matrix ViewMatrix
425 Matrix returnValue = new Matrix();
426 PropertyValue viewMatrix = GetProperty(Camera.Property.ViewMatrix);
427 viewMatrix.Get(returnValue);
428 viewMatrix.Dispose();
432 public bool InvertYAxis
436 bool returnValue = false;
437 PropertyValue invertYAxis = GetProperty(Camera.Property.InvertYAxis);
438 invertYAxis?.Get(out returnValue);
439 invertYAxis?.Dispose();
444 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
445 SetProperty(Camera.Property.InvertYAxis, setValue);