[NUI] Fix text padding issue
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / CameraView.cs
1 /*
2  * Copyright(c) 2021 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 using System;
18 using System.ComponentModel;
19 using System.Runtime.InteropServices;
20
21 namespace Tizen.NUI.BaseComponents
22 {
23     /// <summary>
24     /// CameraView is a view for camera preview.
25     /// </summary>
26     /// <since_tizen> 9 </since_tizen>
27     public class CameraView : View
28     {
29         /// <since_tizen> 9 </since_tizen>
30         public enum DisplayType
31         {
32             Window = 0,   //  HW overlay
33             Image     //  texture stream
34         };
35
36         /// <summary>
37         /// Creates an initialized CameraView.
38         /// </summary>
39         /// <param name="handle">Multimedia Camera handle</param>
40         /// <param name="type">DisplayType</param>
41         /// <since_tizen> 9 </since_tizen>
42         public CameraView(global::System.IntPtr handle, DisplayType type = DisplayType.Window) : this(Interop.CameraView.New(handle, (int)type), true)
43         {
44             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
45         }
46
47         internal CameraView(CameraView cameraView) : this(Interop.CameraView.NewCameraView(CameraView.getCPtr(cameraView)), true)
48         {
49             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
50         }
51
52         internal CameraView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
53         {
54         }
55
56         /// <summary>
57         /// Called when the camera view needs to be updated if the camera setting is changed.
58         /// </summary>
59         /// <example>
60         /// <code>
61         ///  camera = new Tizen.Multimedia.Camera(Tizen.Multimedia.CameraDevice.Front);
62         ///  cameraView = new CameraView(overlayCamera.Handle);
63         ///  cameraView.Size = new Size(300, 400);
64         ///  camera.DisplaySettings.Rotation = Tizen.Multimedia.Rotation.Rotate90;
65         ///  cameraView.Update();
66         /// </code>
67         /// </example>
68         /// <since_tizen> 9 </since_tizen>
69         public void Update()
70         {
71             Interop.CameraView.Update(SwigCPtr);
72         }
73
74         /// <summary>
75         /// Dispose.
76         /// </summary>
77         /// <param name="type">DisposeTypes</param>
78         [EditorBrowsable(EditorBrowsableState.Never)]
79         protected override void Dispose(DisposeTypes type)
80         {
81             if (disposed)
82             {
83                 return;
84             }
85
86             base.Dispose(type);
87         }
88
89         /// This will not be public opened.
90         [EditorBrowsable(EditorBrowsableState.Never)]
91         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
92         {
93             Interop.CameraView.DeleteCameraView(swigCPtr);
94         }
95     }
96
97 }