[NUI] Change property name frome Url to Uri
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / NativeImageSource.cs
1 /*
2  * Copyright(c) 2020 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;
19 using System.ComponentModel;
20 using System.Runtime.InteropServices;
21
22 namespace Tizen.NUI
23 {
24     using global::System;
25
26     [EditorBrowsable(EditorBrowsableState.Never)]
27     public class NativeImageSource : NativeImageInterface
28     {
29
30         [EditorBrowsable(EditorBrowsableState.Never)]
31         public NativeImageSource(uint width, uint height, ColorDepth depth) : this(Interop.NativeImageSource.NewHandle(width, height, (int)depth), true)
32         {
33             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
34         }
35
36         private IntPtr Handle;
37         internal NativeImageSource(IntPtr cPtr, bool cMemoryOwn) : base(Interop.NativeImageSource.Upcast(Interop.NativeImageSource.New(cPtr)), cMemoryOwn)
38         {
39             Handle = cPtr;
40         }
41
42
43         /// <summary>
44         /// Get URI from native image source.
45         /// </summary>
46         [EditorBrowsable(EditorBrowsableState.Never)]
47         public Uri Uri
48         {
49             get
50             {
51                 string uri = "";
52                 uri = Interop.NativeImageSource.GenerateUrl(this.swigCPtr.Handle);
53                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
54                 return new Uri(uri);
55             }
56         }
57
58         [EditorBrowsable(EditorBrowsableState.Never)]
59         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
60         {
61             Interop.NativeImageSource.Delete(Handle);
62             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
63         }
64
65         [EditorBrowsable(EditorBrowsableState.Never)]
66         public enum ColorDepth
67         {
68             Default,
69             Bits8,
70             Bits16,
71             Bits24,
72             Bits32,
73         }
74
75         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(NativeImageSource obj)
76         {
77             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
78         }
79
80         [EditorBrowsable(EditorBrowsableState.Never)]
81         public IntPtr AcquireBuffer(ref int width, ref int height, ref int stride)
82         {
83             IntPtr ret = Interop.NativeImageSource.AcquireBuffer(this.swigCPtr.Handle, ref width, ref height, ref stride);
84             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
85             return ret;
86         }
87
88         [EditorBrowsable(EditorBrowsableState.Never)]
89         public bool ReleaseBuffer()
90         {
91             bool ret = Interop.NativeImageSource.ReleaseBuffer(this.swigCPtr.Handle);
92             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
93             return ret;
94         }
95     }
96 }