Follow formatting NUI
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / NativeImageSource.cs
1
2 using System.ComponentModel;
3 using System.Runtime.InteropServices;
4
5 namespace Tizen.NUI
6 {
7     using global::System;
8
9     [EditorBrowsable(EditorBrowsableState.Never)]
10     public class NativeImageSource : NativeImageInterface
11     {
12
13         [EditorBrowsable(EditorBrowsableState.Never)]
14         public NativeImageSource(uint width, uint height, ColorDepth depth) : this(Interop.NativeImageSource.NewHandle(width, height, (int)depth), true)
15         {
16             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
17         }
18
19         private IntPtr Handle;
20         internal NativeImageSource(IntPtr cPtr, bool cMemoryOwn) : base(Interop.NativeImageSource.Upcast(Interop.NativeImageSource.New(cPtr)), cMemoryOwn)
21         {
22             Handle = cPtr;
23         }
24
25         [EditorBrowsable(EditorBrowsableState.Never)]
26         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
27         {
28             Interop.NativeImageSource.Delete(Handle);
29             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
30         }
31
32         [EditorBrowsable(EditorBrowsableState.Never)]
33         public enum ColorDepth
34         {
35             Default,
36             Bits8,
37             Bits16,
38             Bits24,
39             Bits32,
40         }
41
42         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(NativeImageSource obj)
43         {
44             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
45         }
46
47         [EditorBrowsable(EditorBrowsableState.Never)]
48         public IntPtr AcquireBuffer(ref int width, ref int height, ref int stride)
49         {
50             IntPtr ret = Interop.NativeImageSource.AcquireBuffer(this.swigCPtr.Handle, ref width, ref height, ref stride);
51             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
52             return ret;
53         }
54
55         [EditorBrowsable(EditorBrowsableState.Never)]
56         public bool ReleaseBuffer()
57         {
58             bool ret = Interop.NativeImageSource.ReleaseBuffer(this.swigCPtr.Handle);
59             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
60             return ret;
61         }
62     }
63 }