Merge "[Multimedia] Added InternalsVisibleTo attribute for Radio."
[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 namespace Tizen.NUI
19 {
20
21     internal class Camera : Animatable
22     {
23         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
24
25         internal Camera(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.CameraActor_SWIGUpcast(cPtr), cMemoryOwn)
26         {
27             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
28         }
29
30         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Camera obj)
31         {
32             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
33         }
34
35         protected override void Dispose(DisposeTypes type)
36         {
37             if (disposed)
38             {
39                 return;
40             }
41
42             if (type == DisposeTypes.Explicit)
43             {
44                 //Called by User
45                 //Release your own managed resources here.
46                 //You should release all of your own disposable objects here.
47
48             }
49
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.
53
54             if (swigCPtr.Handle != global::System.IntPtr.Zero)
55             {
56                 if (swigCMemOwn)
57                 {
58                     swigCMemOwn = false;
59                     NDalicPINVOKE.delete_CameraActor(swigCPtr);
60                 }
61                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
62             }
63
64             base.Dispose(type);
65         }
66
67
68
69         public class Property : global::System.IDisposable
70         {
71             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
72             protected bool swigCMemOwn;
73
74             internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
75             {
76                 swigCMemOwn = cMemoryOwn;
77                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
78             }
79
80             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
81             {
82                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
83             }
84
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;
89
90             ~Property()
91             {
92                 if (!isDisposeQueued)
93                 {
94                     isDisposeQueued = true;
95                     DisposeQueue.Instance.Add(this);
96                 }
97             }
98
99             public void Dispose()
100             {
101                 //Throw excpetion if Dispose() is called in separate thread.
102                 if (!Window.IsInstalled())
103                 {
104                     throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
105                 }
106
107                 if (isDisposeQueued)
108                 {
109                     Dispose(DisposeTypes.Implicit);
110                 }
111                 else
112                 {
113                     Dispose(DisposeTypes.Explicit);
114                     System.GC.SuppressFinalize(this);
115                 }
116             }
117
118             protected virtual void Dispose(DisposeTypes type)
119             {
120                 if (disposed)
121                 {
122                     return;
123                 }
124
125                 if (type == DisposeTypes.Explicit)
126                 {
127                     //Called by User
128                     //Release your own managed resources here.
129                     //You should release all of your own disposable objects here.
130
131                 }
132
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.
136
137                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
138                 {
139                     if (swigCMemOwn)
140                     {
141                         swigCMemOwn = false;
142                         NDalicPINVOKE.delete_CameraActor_Property(swigCPtr);
143                     }
144                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
145                 }
146
147                 disposed = true;
148             }
149
150
151             public Property() : this(NDalicPINVOKE.new_CameraActor_Property(), true)
152             {
153                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154             }
155
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();
170
171         }
172
173         public Camera() : this(NDalicPINVOKE.CameraActor_New__SWIG_0(), true)
174         {
175             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
176
177         }
178         public Camera(Vector2 size) : this(NDalicPINVOKE.CameraActor_New__SWIG_1(Vector2.getCPtr(size)), true)
179         {
180             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
181
182         }
183         public static Camera DownCast(BaseHandle handle)
184         {
185             Camera ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Camera;
186             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
187             return ret;
188         }
189
190         public Camera(Camera copy) : this(NDalicPINVOKE.new_CameraActor__SWIG_1(Camera.getCPtr(copy)), true)
191         {
192             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
193         }
194
195         public Camera Assign(Camera rhs)
196         {
197             Camera ret = new Camera(NDalicPINVOKE.CameraActor_Assign(swigCPtr, Camera.getCPtr(rhs)), false);
198             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
199             return ret;
200         }
201
202         public void SetType(CameraType type)
203         {
204             NDalicPINVOKE.CameraActor_SetType(swigCPtr, (int)type);
205             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
206         }
207
208         public new CameraType GetType()
209         {
210             CameraType ret = (CameraType)NDalicPINVOKE.CameraActor_GetType(swigCPtr);
211             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
212             return ret;
213         }
214
215         public void SetProjectionMode(ProjectionMode mode)
216         {
217             NDalicPINVOKE.CameraActor_SetProjectionMode(swigCPtr, (int)mode);
218             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
219         }
220
221         public ProjectionMode GetProjectionMode()
222         {
223             ProjectionMode ret = (ProjectionMode)NDalicPINVOKE.CameraActor_GetProjectionMode(swigCPtr);
224             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
225             return ret;
226         }
227
228         public void SetFieldOfView(float fieldOfView)
229         {
230             NDalicPINVOKE.CameraActor_SetFieldOfView(swigCPtr, fieldOfView);
231             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
232         }
233
234         public float GetFieldOfView()
235         {
236             float ret = NDalicPINVOKE.CameraActor_GetFieldOfView(swigCPtr);
237             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
238             return ret;
239         }
240
241         public void SetAspectRatio(float aspectRatio)
242         {
243             NDalicPINVOKE.CameraActor_SetAspectRatio(swigCPtr, aspectRatio);
244             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
245         }
246
247         public float GetAspectRatio()
248         {
249             float ret = NDalicPINVOKE.CameraActor_GetAspectRatio(swigCPtr);
250             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
251             return ret;
252         }
253
254         public void SetNearClippingPlane(float nearClippingPlane)
255         {
256             NDalicPINVOKE.CameraActor_SetNearClippingPlane(swigCPtr, nearClippingPlane);
257             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
258         }
259
260         public float GetNearClippingPlane()
261         {
262             float ret = NDalicPINVOKE.CameraActor_GetNearClippingPlane(swigCPtr);
263             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
264             return ret;
265         }
266
267         public void SetFarClippingPlane(float farClippingPlane)
268         {
269             NDalicPINVOKE.CameraActor_SetFarClippingPlane(swigCPtr, farClippingPlane);
270             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
271         }
272
273         public float GetFarClippingPlane()
274         {
275             float ret = NDalicPINVOKE.CameraActor_GetFarClippingPlane(swigCPtr);
276             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
277             return ret;
278         }
279
280         public void SetTargetPosition(Vector3 targetPosition)
281         {
282             NDalicPINVOKE.CameraActor_SetTargetPosition(swigCPtr, Vector3.getCPtr(targetPosition));
283             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
284         }
285
286         public Vector3 GetTargetPosition()
287         {
288             Vector3 ret = new Vector3(NDalicPINVOKE.CameraActor_GetTargetPosition(swigCPtr), true);
289             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
290             return ret;
291         }
292
293         public void SetInvertYAxis(bool invertYAxis)
294         {
295             NDalicPINVOKE.CameraActor_SetInvertYAxis(swigCPtr, invertYAxis);
296             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
297         }
298
299         public bool GetInvertYAxis()
300         {
301             bool ret = NDalicPINVOKE.CameraActor_GetInvertYAxis(swigCPtr);
302             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
303             return ret;
304         }
305
306         public void SetPerspectiveProjection(Vector2 size)
307         {
308             NDalicPINVOKE.CameraActor_SetPerspectiveProjection(swigCPtr, Vector2.getCPtr(size));
309             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
310         }
311
312         public void SetOrthographicProjection(Vector2 size)
313         {
314             NDalicPINVOKE.CameraActor_SetOrthographicProjection__SWIG_0(swigCPtr, Vector2.getCPtr(size));
315             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
316         }
317
318         public void SetOrthographicProjection(float left, float right, float top, float bottom, float near, float far)
319         {
320             NDalicPINVOKE.CameraActor_SetOrthographicProjection__SWIG_1(swigCPtr, left, right, top, bottom, near, far);
321             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
322         }
323
324         public string Type
325         {
326             get
327             {
328                 string temp;
329                 GetProperty(Camera.Property.TYPE).Get(out temp);
330                 return temp;
331             }
332             set
333             {
334                 SetProperty(Camera.Property.TYPE, new Tizen.NUI.PropertyValue(value));
335             }
336         }
337         public string ProjectionMode
338         {
339             get
340             {
341                 string temp;
342                 GetProperty(Camera.Property.PROJECTION_MODE).Get(out temp);
343                 return temp;
344             }
345             set
346             {
347                 SetProperty(Camera.Property.PROJECTION_MODE, new Tizen.NUI.PropertyValue(value));
348             }
349         }
350         public float FieldOfView
351         {
352             get
353             {
354                 float temp = 0.0f;
355                 GetProperty(Camera.Property.FIELD_OF_VIEW).Get(out temp);
356                 return temp;
357             }
358             set
359             {
360                 SetProperty(Camera.Property.FIELD_OF_VIEW, new Tizen.NUI.PropertyValue(value));
361             }
362         }
363         public float AspectRatio
364         {
365             get
366             {
367                 float temp = 0.0f;
368                 GetProperty(Camera.Property.ASPECT_RATIO).Get(out temp);
369                 return temp;
370             }
371             set
372             {
373                 SetProperty(Camera.Property.ASPECT_RATIO, new Tizen.NUI.PropertyValue(value));
374             }
375         }
376         public float NearPlaneDistance
377         {
378             get
379             {
380                 float temp = 0.0f;
381                 GetProperty(Camera.Property.NEAR_PLANE_DISTANCE).Get(out temp);
382                 return temp;
383             }
384             set
385             {
386                 SetProperty(Camera.Property.NEAR_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
387             }
388         }
389         public float FarPlaneDistance
390         {
391             get
392             {
393                 float temp = 0.0f;
394                 GetProperty(Camera.Property.FAR_PLANE_DISTANCE).Get(out temp);
395                 return temp;
396             }
397             set
398             {
399                 SetProperty(Camera.Property.FAR_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
400             }
401         }
402         public float LeftPlaneDistance
403         {
404             get
405             {
406                 float temp = 0.0f;
407                 GetProperty(Camera.Property.LEFT_PLANE_DISTANCE).Get(out temp);
408                 return temp;
409             }
410             set
411             {
412                 SetProperty(Camera.Property.LEFT_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
413             }
414         }
415         public float RightPlaneDistance
416         {
417             get
418             {
419                 float temp = 0.0f;
420                 GetProperty(Camera.Property.RIGHT_PLANE_DISTANCE).Get(out temp);
421                 return temp;
422             }
423             set
424             {
425                 SetProperty(Camera.Property.RIGHT_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
426             }
427         }
428         public float TopPlaneDistance
429         {
430             get
431             {
432                 float temp = 0.0f;
433                 GetProperty(Camera.Property.TOP_PLANE_DISTANCE).Get(out temp);
434                 return temp;
435             }
436             set
437             {
438                 SetProperty(Camera.Property.TOP_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
439             }
440         }
441         public float BottomPlaneDistance
442         {
443             get
444             {
445                 float temp = 0.0f;
446                 GetProperty(Camera.Property.BOTTOM_PLANE_DISTANCE).Get(out temp);
447                 return temp;
448             }
449             set
450             {
451                 SetProperty(Camera.Property.BOTTOM_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
452             }
453         }
454         public Vector3 TargetPosition
455         {
456             get
457             {
458                 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
459                 GetProperty(Camera.Property.TARGET_POSITION).Get(temp);
460                 return temp;
461             }
462             set
463             {
464                 SetProperty(Camera.Property.TARGET_POSITION, new Tizen.NUI.PropertyValue(value));
465             }
466         }
467         internal Matrix ProjectionMatrix
468         {
469             get
470             {
471                 Matrix temp = new Matrix();
472                 GetProperty(Camera.Property.PROJECTION_MATRIX).Get(temp);
473                 return temp;
474             }
475         }
476         internal Matrix ViewMatrix
477         {
478             get
479             {
480                 Matrix temp = new Matrix();
481                 GetProperty(Camera.Property.VIEW_MATRIX).Get(temp);
482                 return temp;
483             }
484         }
485         public bool InvertYAxis
486         {
487             get
488             {
489                 bool temp = false;
490                 GetProperty(Camera.Property.INVERT_Y_AXIS).Get(out temp);
491                 return temp;
492             }
493             set
494             {
495                 SetProperty(Camera.Property.INVERT_Y_AXIS, new Tizen.NUI.PropertyValue(value));
496             }
497         }
498
499     }
500
501 }