ef68537a1fd898ab651537d3d76dfd42f5fe968b
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Camera.cs
1 /*
2  * Copyright(c) 2017 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 using System.ComponentModel;
19 using Tizen.NUI.BaseComponents;
20
21 namespace Tizen.NUI
22 {
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
26     {
27
28         internal Camera(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.CameraActor.CameraActor_SWIGUpcast(cPtr), cMemoryOwn)
29         {
30         }
31
32         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Camera obj)
33         {
34             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
35         }
36
37         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
38         {
39             Interop.CameraActor.delete_CameraActor(swigCPtr);
40         }
41
42         internal class Property
43         {
44             internal static readonly int TYPE = Interop.CameraActor.CameraActor_Property_TYPE_get();
45             internal static readonly int PROJECTION_MODE = Interop.CameraActor.CameraActor_Property_PROJECTION_MODE_get();
46             internal static readonly int FIELD_OF_VIEW = Interop.CameraActor.CameraActor_Property_FIELD_OF_VIEW_get();
47             internal static readonly int ASPECT_RATIO = Interop.CameraActor.CameraActor_Property_ASPECT_RATIO_get();
48             internal static readonly int NEAR_PLANE_DISTANCE = Interop.CameraActor.CameraActor_Property_NEAR_PLANE_DISTANCE_get();
49             internal static readonly int FAR_PLANE_DISTANCE = Interop.CameraActor.CameraActor_Property_FAR_PLANE_DISTANCE_get();
50             internal static readonly int LEFT_PLANE_DISTANCE = Interop.CameraActor.CameraActor_Property_LEFT_PLANE_DISTANCE_get();
51             internal static readonly int RIGHT_PLANE_DISTANCE = Interop.CameraActor.CameraActor_Property_RIGHT_PLANE_DISTANCE_get();
52             internal static readonly int TOP_PLANE_DISTANCE = Interop.CameraActor.CameraActor_Property_TOP_PLANE_DISTANCE_get();
53             internal static readonly int BOTTOM_PLANE_DISTANCE = Interop.CameraActor.CameraActor_Property_BOTTOM_PLANE_DISTANCE_get();
54             internal static readonly int TARGET_POSITION = Interop.CameraActor.CameraActor_Property_TARGET_POSITION_get();
55             internal static readonly int PROJECTION_MATRIX = Interop.CameraActor.CameraActor_Property_PROJECTION_MATRIX_get();
56             internal static readonly int VIEW_MATRIX = Interop.CameraActor.CameraActor_Property_VIEW_MATRIX_get();
57             internal static readonly int INVERT_Y_AXIS = Interop.CameraActor.CameraActor_Property_INVERT_Y_AXIS_get();
58         }
59
60         public Camera() : this(Interop.CameraActor.CameraActor_New__SWIG_0(), true)
61         {
62             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
63         }
64
65         public Camera(Vector2 size) : this(Interop.CameraActor.CameraActor_New__SWIG_1(Vector2.getCPtr(size)), true)
66         {
67             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
68         }
69
70         public static Camera DownCast(BaseHandle handle)
71         {
72             Camera ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Camera;
73             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
74             return ret;
75         }
76
77         public Camera(Camera copy) : this(Interop.CameraActor.new_CameraActor__SWIG_1(Camera.getCPtr(copy)), true)
78         {
79             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
80         }
81
82         public Camera Assign(Camera rhs)
83         {
84             Camera ret = new Camera(Interop.CameraActor.CameraActor_Assign(swigCPtr, Camera.getCPtr(rhs)), false);
85             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
86             return ret;
87         }
88
89         public void SetType(CameraType type)
90         {
91             Interop.CameraActor.CameraActor_SetType(swigCPtr, (int)type);
92             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
93         }
94
95         public new CameraType GetType()
96         {
97             CameraType ret = (CameraType)Interop.CameraActor.CameraActor_GetType(swigCPtr);
98             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
99             return ret;
100         }
101
102         public void SetProjectionMode(ProjectionMode mode)
103         {
104             Interop.CameraActor.CameraActor_SetProjectionMode(swigCPtr, (int)mode);
105             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
106         }
107
108         public ProjectionMode GetProjectionMode()
109         {
110             ProjectionMode ret = (ProjectionMode)Interop.CameraActor.CameraActor_GetProjectionMode(swigCPtr);
111             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
112             return ret;
113         }
114
115         public void SetFieldOfView(float fieldOfView)
116         {
117             Interop.CameraActor.CameraActor_SetFieldOfView(swigCPtr, fieldOfView);
118             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
119         }
120
121         public float GetFieldOfView()
122         {
123             float ret = Interop.CameraActor.CameraActor_GetFieldOfView(swigCPtr);
124             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
125             return ret;
126         }
127
128         public void SetAspectRatio(float aspectRatio)
129         {
130             Interop.CameraActor.CameraActor_SetAspectRatio(swigCPtr, aspectRatio);
131             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
132         }
133
134         public float GetAspectRatio()
135         {
136             float ret = Interop.CameraActor.CameraActor_GetAspectRatio(swigCPtr);
137             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
138             return ret;
139         }
140
141         public void SetNearClippingPlane(float nearClippingPlane)
142         {
143             Interop.CameraActor.CameraActor_SetNearClippingPlane(swigCPtr, nearClippingPlane);
144             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
145         }
146
147         public float GetNearClippingPlane()
148         {
149             float ret = Interop.CameraActor.CameraActor_GetNearClippingPlane(swigCPtr);
150             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
151             return ret;
152         }
153
154         public void SetFarClippingPlane(float farClippingPlane)
155         {
156             Interop.CameraActor.CameraActor_SetFarClippingPlane(swigCPtr, farClippingPlane);
157             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
158         }
159
160         public float GetFarClippingPlane()
161         {
162             float ret = Interop.CameraActor.CameraActor_GetFarClippingPlane(swigCPtr);
163             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
164             return ret;
165         }
166
167         public void SetTargetPosition(Vector3 targetPosition)
168         {
169             Interop.CameraActor.CameraActor_SetTargetPosition(swigCPtr, Vector3.getCPtr(targetPosition));
170             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
171         }
172
173         public Vector3 GetTargetPosition()
174         {
175             Vector3 ret = new Vector3(Interop.CameraActor.CameraActor_GetTargetPosition(swigCPtr), true);
176             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
177             return ret;
178         }
179
180         public void SetInvertYAxis(bool invertYAxis)
181         {
182             Interop.CameraActor.CameraActor_SetInvertYAxis(swigCPtr, invertYAxis);
183             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
184         }
185
186         public bool GetInvertYAxis()
187         {
188             bool ret = Interop.CameraActor.CameraActor_GetInvertYAxis(swigCPtr);
189             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
190             return ret;
191         }
192
193         public void SetPerspectiveProjection(Vector2 size)
194         {
195             Interop.CameraActor.CameraActor_SetPerspectiveProjection(swigCPtr, Vector2.getCPtr(size));
196             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
197         }
198
199         public void SetOrthographicProjection(Vector2 size)
200         {
201             Interop.CameraActor.CameraActor_SetOrthographicProjection__SWIG_0(swigCPtr, Vector2.getCPtr(size));
202             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
203         }
204
205         public void SetOrthographicProjection(float left, float right, float top, float bottom, float near, float far)
206         {
207             Interop.CameraActor.CameraActor_SetOrthographicProjection__SWIG_1(swigCPtr, left, right, top, bottom, near, far);
208             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
209         }
210
211         public string Type
212         {
213             get
214             {
215                 string temp;
216                 GetProperty(Camera.Property.TYPE).Get(out temp);
217                 return temp;
218             }
219             set
220             {
221                 SetProperty(Camera.Property.TYPE, new Tizen.NUI.PropertyValue(value));
222             }
223         }
224         public string ProjectionMode
225         {
226             get
227             {
228                 string temp;
229                 GetProperty(Camera.Property.PROJECTION_MODE).Get(out temp);
230                 return temp;
231             }
232             set
233             {
234                 SetProperty(Camera.Property.PROJECTION_MODE, new Tizen.NUI.PropertyValue(value));
235             }
236         }
237         public float FieldOfView
238         {
239             get
240             {
241                 float temp = 0.0f;
242                 GetProperty(Camera.Property.FIELD_OF_VIEW).Get(out temp);
243                 return temp;
244             }
245             set
246             {
247                 SetProperty(Camera.Property.FIELD_OF_VIEW, new Tizen.NUI.PropertyValue(value));
248             }
249         }
250         public float AspectRatio
251         {
252             get
253             {
254                 float temp = 0.0f;
255                 GetProperty(Camera.Property.ASPECT_RATIO).Get(out temp);
256                 return temp;
257             }
258             set
259             {
260                 SetProperty(Camera.Property.ASPECT_RATIO, new Tizen.NUI.PropertyValue(value));
261             }
262         }
263         public float NearPlaneDistance
264         {
265             get
266             {
267                 float temp = 0.0f;
268                 GetProperty(Camera.Property.NEAR_PLANE_DISTANCE).Get(out temp);
269                 return temp;
270             }
271             set
272             {
273                 SetProperty(Camera.Property.NEAR_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
274             }
275         }
276         public float FarPlaneDistance
277         {
278             get
279             {
280                 float temp = 0.0f;
281                 GetProperty(Camera.Property.FAR_PLANE_DISTANCE).Get(out temp);
282                 return temp;
283             }
284             set
285             {
286                 SetProperty(Camera.Property.FAR_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
287             }
288         }
289         public float LeftPlaneDistance
290         {
291             get
292             {
293                 float temp = 0.0f;
294                 GetProperty(Camera.Property.LEFT_PLANE_DISTANCE).Get(out temp);
295                 return temp;
296             }
297             set
298             {
299                 SetProperty(Camera.Property.LEFT_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
300             }
301         }
302         public float RightPlaneDistance
303         {
304             get
305             {
306                 float temp = 0.0f;
307                 GetProperty(Camera.Property.RIGHT_PLANE_DISTANCE).Get(out temp);
308                 return temp;
309             }
310             set
311             {
312                 SetProperty(Camera.Property.RIGHT_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
313             }
314         }
315         public float TopPlaneDistance
316         {
317             get
318             {
319                 float temp = 0.0f;
320                 GetProperty(Camera.Property.TOP_PLANE_DISTANCE).Get(out temp);
321                 return temp;
322             }
323             set
324             {
325                 SetProperty(Camera.Property.TOP_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
326             }
327         }
328         public float BottomPlaneDistance
329         {
330             get
331             {
332                 float temp = 0.0f;
333                 GetProperty(Camera.Property.BOTTOM_PLANE_DISTANCE).Get(out temp);
334                 return temp;
335             }
336             set
337             {
338                 SetProperty(Camera.Property.BOTTOM_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
339             }
340         }
341         public Vector3 TargetPosition
342         {
343             get
344             {
345                 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
346                 GetProperty(Camera.Property.TARGET_POSITION).Get(temp);
347                 return temp;
348             }
349             set
350             {
351                 SetProperty(Camera.Property.TARGET_POSITION, new Tizen.NUI.PropertyValue(value));
352             }
353         }
354         internal Matrix ProjectionMatrix
355         {
356             get
357             {
358                 Matrix temp = new Matrix();
359                 GetProperty(Camera.Property.PROJECTION_MATRIX).Get(temp);
360                 return temp;
361             }
362         }
363         internal Matrix ViewMatrix
364         {
365             get
366             {
367                 Matrix temp = new Matrix();
368                 GetProperty(Camera.Property.VIEW_MATRIX).Get(temp);
369                 return temp;
370             }
371         }
372         public bool InvertYAxis
373         {
374             get
375             {
376                 bool temp = false;
377                 GetProperty(Camera.Property.INVERT_Y_AXIS).Get(out temp);
378                 return temp;
379             }
380             set
381             {
382                 SetProperty(Camera.Property.INVERT_Y_AXIS, new Tizen.NUI.PropertyValue(value));
383             }
384         }
385     }
386 }