1632ed25e48d92fc7d415011247280512ed417f8
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / AsyncImageLoader.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     internal class AsyncImageLoader : BaseHandle
21     {
22         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
23
24         internal AsyncImageLoader(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.AsyncImageLoader.AsyncImageLoader_SWIGUpcast(cPtr), cMemoryOwn)
25         {
26             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
27         }
28
29         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(AsyncImageLoader obj)
30         {
31             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
32         }
33
34         protected override void Dispose(DisposeTypes type)
35         {
36             if (disposed)
37             {
38                 return;
39             }
40
41             //Release your own unmanaged resources here.
42             //You should not access any managed member here except static instance.
43             //because the execution order of Finalizes is non-deterministic.
44
45             if (swigCPtr.Handle != global::System.IntPtr.Zero)
46             {
47                 if (swigCMemOwn)
48                 {
49                     swigCMemOwn = false;
50                     Interop.AsyncImageLoader.delete_AsyncImageLoader(swigCPtr);
51                 }
52                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
53             }
54
55             base.Dispose(type);
56         }
57
58         public AsyncImageLoader() : this(Interop.AsyncImageLoader.AsyncImageLoader_New(), true)
59         {
60             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
61
62         }
63         public AsyncImageLoader(AsyncImageLoader handle) : this(Interop.AsyncImageLoader.new_AsyncImageLoader__SWIG_1(AsyncImageLoader.getCPtr(handle)), true)
64         {
65             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
66         }
67
68         public AsyncImageLoader Assign(AsyncImageLoader handle)
69         {
70             AsyncImageLoader ret = new AsyncImageLoader(Interop.AsyncImageLoader.AsyncImageLoader_Assign(swigCPtr, AsyncImageLoader.getCPtr(handle)), false);
71             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
72             return ret;
73         }
74
75         public static AsyncImageLoader DownCast(BaseHandle handle)
76         {
77             AsyncImageLoader ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as AsyncImageLoader;
78             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
79             return ret;
80         }
81
82         public uint Load(string url)
83         {
84             uint ret = Interop.AsyncImageLoader.AsyncImageLoader_Load__SWIG_0(swigCPtr, url);
85             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
86             return ret;
87         }
88
89         public uint Load(string url, Uint16Pair dimensions)
90         {
91             uint ret = Interop.AsyncImageLoader.AsyncImageLoader_Load__SWIG_1(swigCPtr, url, Uint16Pair.getCPtr(dimensions));
92             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
93             return ret;
94         }
95
96         public uint Load(string url, Uint16Pair dimensions, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection)
97         {
98             uint ret = Interop.AsyncImageLoader.AsyncImageLoader_Load__SWIG_2(swigCPtr, url, Uint16Pair.getCPtr(dimensions), (int)fittingMode, (int)samplingMode, orientationCorrection);
99             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
100             return ret;
101         }
102
103         public bool Cancel(uint loadingTaskId)
104         {
105             bool ret = Interop.AsyncImageLoader.AsyncImageLoader_Cancel(swigCPtr, loadingTaskId);
106             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
107             return ret;
108         }
109
110         public void CancelAll()
111         {
112             Interop.AsyncImageLoader.AsyncImageLoader_CancelAll(swigCPtr);
113             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
114         }
115
116         public SWIGTYPE_p_Dali__SignalT_void_fuint32_t_Dali__PixelDataF_t ImageLoadedSignal()
117         {
118             SWIGTYPE_p_Dali__SignalT_void_fuint32_t_Dali__PixelDataF_t ret = new SWIGTYPE_p_Dali__SignalT_void_fuint32_t_Dali__PixelDataF_t(Interop.AsyncImageLoader.AsyncImageLoader_ImageLoadedSignal(swigCPtr), false);
119             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
120             return ret;
121         }
122     }
123 }