[NUI] Fixing the emtpy finalizers(CA1821)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / ImageLoading.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 using System;
18 using System.ComponentModel;
19
20 namespace Tizen.NUI
21 {
22
23     /// <summary>
24     /// Loading an image.
25     /// </summary>
26     /// <since_tizen> 5 </since_tizen>
27     /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API.
28     [EditorBrowsable(EditorBrowsableState.Never)]
29     public static class ImageLoading
30     {
31         /// <summary>
32         /// Load an image synchronously from local file.
33         /// </summary>
34         /// <param name="url">The URL of the image file to load.</param>
35         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
36         /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
37         /// <param name="samplingMode">The filtering method used when sampling pixels from the input image while fitting it to desired size.</param>
38         /// <param name="orientationCorrection">Reorient the image to respect any orientation metadata in its header.</param>
39         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case loading failed.</returns>
40         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
41         /// <since_tizen> 5 </since_tizen>
42         /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API.
43         [EditorBrowsable(EditorBrowsableState.Never)]
44         public static PixelBuffer LoadImageFromFile(string url, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection)
45         {
46             if (null == size)
47             {
48                 throw new ArgumentNullException(nameof(size));
49             }
50             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
51             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.LoadImageFromFile(url, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode, orientationCorrection), true);
52             uSize.Dispose();
53             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
54             return ret;
55         }
56
57         /// <summary>
58         /// Hidden API (Inhouse API).
59         /// Using Uri class to provide safe sevice and secure API.
60         /// Load an image synchronously from local file.
61         /// </summary>
62         /// <param name="uri">The URI of the image file to load.</param>
63         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
64         /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
65         /// <param name="samplingMode">The filtering method used when sampling pixels from the input image while fitting it to desired size.</param>
66         /// <param name="orientationCorrection">Reorient the image to respect any orientation metadata in its header.</param>
67         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case loading failed.</returns>
68         /// <exception cref="ArgumentNullException">Thrown when size is null.</exception>
69         /// <exception cref="ArgumentNullException">Thrown when uri is null.</exception>
70         [EditorBrowsable(EditorBrowsableState.Never)]
71         public static PixelBuffer LoadImageFromFile(Uri uri, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection)
72         {
73             if (null == size)
74             {
75                 throw new ArgumentNullException(nameof(size));
76             }
77             if (uri == null)
78             {
79                 throw new ArgumentNullException(nameof(uri));
80             }
81
82             PixelBuffer ret;
83             using (var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height))
84             {
85                 ret = new PixelBuffer(Interop.ImageLoading.LoadImageFromFile(uri.AbsoluteUri, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode, orientationCorrection), true);
86             }
87             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
88             return ret;
89         }
90
91         /// <summary>
92         /// Load an image synchronously from local file.
93         /// </summary>
94         /// <param name="url">The URL of the image file to load.</param>
95         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
96         /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
97         /// <param name="samplingMode">The filtering method used when sampling pixels from the input image while fitting it to desired size.</param>
98         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case loading failed.</returns>
99         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
100         /// <since_tizen> 5 </since_tizen>
101         /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
102         [EditorBrowsable(EditorBrowsableState.Never)]
103         public static PixelBuffer LoadImageFromFile(string url, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode)
104         {
105             if (null == size)
106             {
107                 throw new ArgumentNullException(nameof(size));
108             }
109             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
110             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.LoadImageFromFile(url, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode), true);
111             uSize.Dispose();
112             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
113             return ret;
114         }
115
116         /// <summary>
117         /// Hidden API (Inhouse API).
118         /// Using Uri class to provide safe sevice and secure API.
119         /// Load an image synchronously from local file.
120         /// </summary>
121         /// <param name="uri">The URI of the image file to load.</param>
122         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
123         /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
124         /// <param name="samplingMode">The filtering method used when sampling pixels from the input image while fitting it to desired size.</param>
125         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case loading failed.</returns>
126         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
127         /// <exception cref="ArgumentNullException">Thrown when uri is null.</exception>
128         [EditorBrowsable(EditorBrowsableState.Never)]
129         public static PixelBuffer LoadImageFromFile(Uri uri, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode)
130         {
131             if (null == size)
132             {
133                 throw new ArgumentNullException(nameof(size));
134             }
135             if (uri == null)
136             {
137                 throw new ArgumentNullException(nameof(uri));
138             }
139
140             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
141             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.LoadImageFromFile(uri.AbsoluteUri, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode), true);
142             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
143
144             uSize.Dispose();
145             return ret;
146         }
147
148         /// <summary>
149         /// Load an image synchronously from local file.
150         /// </summary>
151         /// <param name="url">The URL of the image file to load.</param>
152         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
153         /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
154         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case loading failed.</returns>
155         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
156         /// <since_tizen> 5 </since_tizen>
157         /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API.
158         [EditorBrowsable(EditorBrowsableState.Never)]
159         public static PixelBuffer LoadImageFromFile(string url, Size2D size, FittingModeType fittingMode)
160         {
161             if (null == size)
162             {
163                 throw new ArgumentNullException(nameof(size));
164             }
165             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
166             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.LoadImageFromFile(url, Uint16Pair.getCPtr(uSize), (int)fittingMode), true);
167             uSize.Dispose();
168             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
169             return ret;
170         }
171
172         /// <summary>
173         /// Hidden API (Inhouse API).
174         /// Using Uri class to provide safe sevice and secure API.
175         /// Load an image synchronously from local file.
176         /// </summary>
177         /// <param name="uri">The URI of the image file to load.</param>
178         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
179         /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
180         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case loading failed.</returns>
181         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
182         /// <exception cref="ArgumentNullException">Thrown when uri is null.</exception>
183         [EditorBrowsable(EditorBrowsableState.Never)]
184         public static PixelBuffer LoadImageFromFile(Uri uri, Size2D size, FittingModeType fittingMode)
185         {
186             if (null == size)
187             {
188                 throw new ArgumentNullException(nameof(size));
189             }
190             if (uri == null)
191             {
192                 throw new ArgumentNullException(nameof(uri));
193             }
194
195             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
196             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.LoadImageFromFile(uri.AbsoluteUri, Uint16Pair.getCPtr(uSize), (int)fittingMode), true);
197             uSize.Dispose();
198             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
199             return ret;
200         }
201
202         /// <summary>
203         /// Load an image synchronously from local file.
204         /// </summary>
205         /// <param name="url">The URL of the image file to load.</param>
206         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
207         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case loading failed.</returns>
208         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
209         /// <since_tizen> 5 </since_tizen>
210         /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API.
211         [EditorBrowsable(EditorBrowsableState.Never)]
212         public static PixelBuffer LoadImageFromFile(string url, Size2D size)
213         {
214             if (null == size)
215             {
216                 throw new ArgumentNullException(nameof(size));
217             }
218             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
219             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.LoadImageFromFile(url, Uint16Pair.getCPtr(uSize)), true);
220             uSize.Dispose();
221             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
222             return ret;
223         }
224
225         /// <summary>
226         /// Hidden API (Inhouse API).
227         /// Using Uri class to provide safe sevice and secure API.
228         /// Load an image synchronously from local file.
229         /// </summary>
230         /// <param name="uri">The URI of the image file to load.</param>
231         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
232         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case loading failed.</returns>
233         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
234         /// <exception cref="ArgumentNullException">Thrown when uri is null.</exception>
235         [EditorBrowsable(EditorBrowsableState.Never)]
236         public static PixelBuffer LoadImageFromFile(Uri uri, Size2D size)
237         {
238             if (null == size)
239             {
240                 throw new ArgumentNullException(nameof(size));
241             }
242             if (uri == null)
243             {
244                 throw new ArgumentNullException(nameof(uri));
245             }
246
247             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
248             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.LoadImageFromFile(uri.AbsoluteUri, Uint16Pair.getCPtr(uSize)), true);
249             uSize.Dispose();
250             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
251             return ret;
252         }
253
254         /// <summary>
255         /// Load an image synchronously from local file.
256         /// </summary>
257         /// <param name="url">The URL of the image file to load.</param>
258         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case loading failed.</returns>
259         /// <since_tizen> 5 </since_tizen>
260         /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API.
261         [EditorBrowsable(EditorBrowsableState.Never)]
262         public static PixelBuffer LoadImageFromFile(string url)
263         {
264             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.LoadImageFromFile(url), true);
265             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
266             return ret;
267         }
268
269         /// <summary>
270         /// Hidden API (Inhouse API).
271         /// Using Uri class to provide safe sevice and secure API.
272         /// Load an image synchronously from local file.
273         /// </summary>
274         /// <param name="uri">The URI of the image file to load.</param>
275         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case loading failed.</returns>
276         /// <exception cref="ArgumentNullException">Thrown when uri is null.</exception>
277         [EditorBrowsable(EditorBrowsableState.Never)]
278         public static PixelBuffer LoadImageFromFile(Uri uri)
279         {
280             if (uri == null)
281             {
282                 throw new ArgumentNullException(nameof(uri));
283             }
284
285             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.LoadImageFromFile(uri.AbsoluteUri), true);
286             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
287             return ret;
288         }
289
290         /// <summary>
291         /// Determine the size of an image that LoadImageFromFile will provide when given the same image loading parameters.
292         /// </summary>
293         /// <param name="filename">The name of the image.</param>
294         /// <param name="size">The requested size for the image.</param>
295         /// <param name="fittingMode">The method to use to map the source image to the desired dimensions.</param>
296         /// <param name="samplingMode">The image filter to use if the image needs to be downsampled to the requested size.</param>
297         /// <param name="orientationCorrection">Whether to use image metadata to rotate or flip the image, for example, from portrait to landscape.</param>
298         /// <returns>Dimensions that image will have if it is loaded with given parameters.</returns>
299         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
300         /// <since_tizen> 5 </since_tizen>
301         /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API.
302         [EditorBrowsable(EditorBrowsableState.Never)]
303         public static Size2D GetClosestImageSize(string filename, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection)
304         {
305             if (null == size)
306             {
307                 throw new ArgumentNullException(nameof(size));
308             }
309             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
310             var val = new Uint16Pair(Interop.ImageLoading.GetClosestImageSize(filename, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode, orientationCorrection), true);
311             Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
312             val.Dispose();
313             uSize.Dispose();
314             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
315             return ret;
316         }
317
318         /// <summary>
319         /// Determine the size of an image that LoadImageFromFile will provide when given the same image loading parameters.
320         /// </summary>
321         /// <param name="filename">The name of the image.</param>
322         /// <param name="size">The requested size for the image</param>
323         /// <param name="fittingMode">The method to use to map the source image to the desired dimensions.</param>
324         /// <param name="samplingMode">The image filter to use if the image needs to be downsampled to the requested size.</param>
325         /// <returns>Dimensions that image will have if it is loaded with given parameters.</returns>
326         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
327         /// <since_tizen> 5 </since_tizen>
328         /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API.
329         [EditorBrowsable(EditorBrowsableState.Never)]
330         public static Size2D GetClosestImageSize(string filename, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode)
331         {
332             if (null == size)
333             {
334                 throw new ArgumentNullException(nameof(size));
335             }
336             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
337             var val = new Uint16Pair(Interop.ImageLoading.GetClosestImageSize(filename, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode), true);
338             Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
339             val.Dispose();
340             uSize.Dispose();
341             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
342             return ret;
343         }
344
345         /// <summary>
346         /// Determine the size of an image that LoadImageFromFile will provide when given the same image loading parameters.
347         /// </summary>
348         /// <param name="filename">The name of the image.</param>
349         /// <param name="size">The requested size for the image</param>
350         /// <param name="fittingMode">The method to use to map the source image to the desired dimensions.</param>
351         /// <returns>Dimensions that image will have if it is loaded with given parameters.</returns>
352         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
353         /// <since_tizen> 5 </since_tizen>
354         /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API.
355         [EditorBrowsable(EditorBrowsableState.Never)]
356         public static Size2D GetClosestImageSize(string filename, Size2D size, FittingModeType fittingMode)
357         {
358             if (null == size)
359             {
360                 throw new ArgumentNullException(nameof(size));
361             }
362             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
363             var val = new Uint16Pair(Interop.ImageLoading.GetClosestImageSize(filename, Uint16Pair.getCPtr(uSize), (int)fittingMode), true);
364             Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
365             val.Dispose();
366             uSize.Dispose();
367             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
368             return ret;
369         }
370
371         /// <summary>
372         /// Determine the size of an image that LoadImageFromFile will provide when given the same image loading parameters.
373         /// </summary>
374         /// <param name="filename">The name of the image.</param>
375         /// <param name="size">The requested size for the image</param>
376         /// <returns>Dimensions that image will have if it is loaded with given parameters.</returns>
377         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
378         /// <since_tizen> 5 </since_tizen>
379         /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API.
380         [EditorBrowsable(EditorBrowsableState.Never)]
381         public static Size2D GetClosestImageSize(string filename, Size2D size)
382         {
383             if (null == size)
384             {
385                 throw new ArgumentNullException(nameof(size));
386             }
387             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
388             var val = new Uint16Pair(Interop.ImageLoading.GetClosestImageSize(filename, Uint16Pair.getCPtr(uSize)), true);
389             Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
390             val.Dispose();
391             uSize.Dispose();
392             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
393             return ret;
394         }
395
396         /// <summary>
397         /// Determine the size of an image that LoadImageFromFile will provide when given the same image loading parameters.
398         /// </summary>
399         /// <param name="filename">The name of the image.</param>
400         /// <returns>Dimensions that image will have if it is loaded with given parameters.</returns>
401         /// <since_tizen> 5 </since_tizen>
402         /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API.
403         [EditorBrowsable(EditorBrowsableState.Never)]
404         public static Size2D GetClosestImageSize(string filename)
405         {
406             var val = new Uint16Pair(Interop.ImageLoading.GetClosestImageSize(filename), true);
407             Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
408             val.Dispose();
409             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
410             return ret;
411         }
412
413         /// <summary>
414         /// Get the size of an original image
415         /// </summary>
416         /// <param name="filename">The name of the image.</param>
417         /// <returns>Dimension of the original image.</returns>
418         /// <since_tizen> 5 </since_tizen>
419         /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API.
420         [EditorBrowsable(EditorBrowsableState.Never)]
421         public static Size2D GetOriginalImageSize(string filename)
422         {
423             var val = new Uint16Pair(Interop.ImageLoading.GetOriginalImageSize(filename), true);
424             Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
425             val.Dispose();
426             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
427             return ret;
428         }
429
430         /// <summary>
431         /// Load an image synchronously from a remote resource.
432         /// </summary>
433         /// <param name="url">The URL of the image file to load.</param>
434         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
435         /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
436         /// <param name="samplingMode">The filtering method used when sampling pixels from the input image while fitting it to desired size.</param>
437         /// <param name="orientationCorrection">Reorient the image to respect any orientation metadata in its header.</param>
438         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
439         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
440         /// <since_tizen> 5 </since_tizen>
441         /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API.
442         [EditorBrowsable(EditorBrowsableState.Never)]
443         public static PixelBuffer DownloadImageSynchronously(string url, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection)
444         {
445             if (null == size)
446             {
447                 throw new ArgumentNullException(nameof(size));
448             }
449             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
450             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously(url, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode, orientationCorrection), true);
451             uSize.Dispose();
452             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
453             return ret;
454         }
455
456         /// <summary>
457         /// Hidden API (Inhouse API).
458         /// Using Uri class to provide safe sevice and secure API.
459         /// Load an image synchronously from a remote resource.
460         /// </summary>
461         /// <param name="uri">The URI of the image file to load.</param>
462         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
463         /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
464         /// <param name="samplingMode">The filtering method used when sampling pixels from the input image while fitting it to desired size.</param>
465         /// <param name="orientationCorrection">Reorient the image to respect any orientation metadata in its header.</param>
466         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
467         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
468         /// <exception cref="ArgumentNullException">Thrown when uri is null.</exception>
469         [EditorBrowsable(EditorBrowsableState.Never)]
470         public static PixelBuffer DownloadImageSynchronously(Uri uri, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection)
471         {
472             if (null == size)
473             {
474                 throw new ArgumentNullException(nameof(size));
475             }
476             if (uri == null)
477             {
478                 throw new ArgumentNullException(nameof(uri));
479             }
480
481             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
482             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously(uri.AbsoluteUri, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode, orientationCorrection), true);
483             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
484
485             uSize.Dispose();
486             return ret;
487         }
488
489         /// <summary>
490         /// Load an image synchronously from a remote resource.
491         /// </summary>
492         /// <param name="url">The URL of the image file to load.</param>
493         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
494         /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
495         /// <param name="samplingMode">The filtering method used when sampling pixels from the input image while fitting it to desired size.</param>
496         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
497         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
498         /// <since_tizen> 5 </since_tizen>
499         /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API.
500         [EditorBrowsable(EditorBrowsableState.Never)]
501         public static PixelBuffer DownloadImageSynchronously(string url, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode)
502         {
503             if (null == size)
504             {
505                 throw new ArgumentNullException(nameof(size));
506             }
507             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
508             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously(url, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode), true);
509             uSize.Dispose();
510             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
511             return ret;
512         }
513
514         /// <summary>
515         /// Hidden API (Inhouse API).
516         /// Using Uri class to provide safe sevice and secure API.
517         /// Load an image synchronously from a remote resource.
518         /// </summary>
519         /// <param name="uri">The URI of the image file to load.</param>
520         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
521         /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
522         /// <param name="samplingMode">The filtering method used when sampling pixels from the input image while fitting it to desired size.</param>
523         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
524         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
525         /// <exception cref="ArgumentNullException">Thrown when uri is null.</exception>
526         [EditorBrowsable(EditorBrowsableState.Never)]
527         public static PixelBuffer DownloadImageSynchronously(Uri uri, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode)
528         {
529             if (null == size)
530             {
531                 throw new ArgumentNullException(nameof(size));
532             }
533             if (uri == null)
534             {
535                 throw new ArgumentNullException(nameof(uri));
536             }
537
538             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
539             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously(uri.AbsoluteUri, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode), true);
540             uSize.Dispose();
541             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
542             return ret;
543         }
544
545         /// <summary>
546         /// Load an image synchronously from a remote resource.
547         /// </summary>
548         /// <param name="url">The URL of the image file to load.</param>
549         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
550         /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
551         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
552         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
553         /// <since_tizen> 5 </since_tizen>
554         /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API.
555         [EditorBrowsable(EditorBrowsableState.Never)]
556         public static PixelBuffer DownloadImageSynchronously(string url, Size2D size, FittingModeType fittingMode)
557         {
558             if (null == size)
559             {
560                 throw new ArgumentNullException(nameof(size));
561             }
562             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
563             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously(url, Uint16Pair.getCPtr(uSize), (int)fittingMode), true);
564             uSize.Dispose();
565             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
566             return ret;
567         }
568
569         /// <summary>
570         /// Hidden API (Inhouse API).
571         /// Using Uri class to provide safe sevice and secure API.
572         /// Load an image synchronously from a remote resource.
573         /// </summary>
574         /// <param name="uri">The URI of the image file to load.</param>
575         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
576         /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
577         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
578         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
579         /// <exception cref="ArgumentNullException">Thrown when uri is null.</exception>
580         [EditorBrowsable(EditorBrowsableState.Never)]
581         public static PixelBuffer DownloadImageSynchronously(Uri uri, Size2D size, FittingModeType fittingMode)
582         {
583             if (null == size)
584             {
585                 throw new ArgumentNullException(nameof(size));
586             }
587             if (uri == null)
588             {
589                 throw new ArgumentNullException(nameof(uri));
590             }
591
592             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
593             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously(uri.AbsoluteUri, Uint16Pair.getCPtr(uSize), (int)fittingMode), true);
594             uSize.Dispose();
595             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
596             return ret;
597         }
598
599         /// <summary>
600         /// Load an image synchronously from a remote resource.
601         /// </summary>
602         /// <param name="url">The URL of the image file to load.</param>
603         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
604         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
605         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
606         /// <since_tizen> 5 </since_tizen>
607         /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API.
608         [EditorBrowsable(EditorBrowsableState.Never)]
609         public static PixelBuffer DownloadImageSynchronously(string url, Size2D size)
610         {
611             if (null == size)
612             {
613                 throw new ArgumentNullException(nameof(size));
614             }
615             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
616             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously(url, Uint16Pair.getCPtr(uSize)), true);
617             uSize.Dispose();
618             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
619             return ret;
620         }
621
622         /// <summary>
623         /// Hidden API (Inhouse API).
624         /// Using Uri class to provide safe sevice and secure API.
625         /// Load an image synchronously from a remote resource.
626         /// </summary>
627         /// <param name="uri">The URI of the image file to load.</param>
628         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
629         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
630         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
631         /// <exception cref="ArgumentNullException">Thrown when uri is null.</exception>
632         [EditorBrowsable(EditorBrowsableState.Never)]
633         public static PixelBuffer DownloadImageSynchronously(Uri uri, Size2D size)
634         {
635             if (null == size)
636             {
637                 throw new ArgumentNullException(nameof(size));
638             }
639             if (uri == null)
640             {
641                 throw new ArgumentNullException(nameof(uri));
642             }
643
644             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
645             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously(uri.AbsoluteUri, Uint16Pair.getCPtr(uSize)), true);
646             uSize.Dispose();
647             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
648             return ret;
649         }
650
651         /// <summary>
652         /// Load an image synchronously from a remote resource.
653         /// </summary>
654         /// <param name="url">The URL of the image file to load.</param>
655         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
656         /// <since_tizen> 5 </since_tizen>
657         /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API.
658         [EditorBrowsable(EditorBrowsableState.Never)]
659         public static PixelBuffer DownloadImageSynchronously(string url)
660         {
661             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously(url), true);
662             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
663             return ret;
664         }
665
666         /// <summary>
667         /// Hidden API (Inhouse API).
668         /// Using Uri class to provide safe sevice and secure API.
669         /// Load an image synchronously from a remote resource.
670         /// </summary>
671         /// <param name="uri">The URI of the image file to load.</param>
672         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
673         /// <exception cref="ArgumentNullException">Thrown when uri is null.</exception>
674         [EditorBrowsable(EditorBrowsableState.Never)]
675         public static PixelBuffer DownloadImageSynchronously(Uri uri)
676         {
677             if (uri == null)
678             {
679                 throw new ArgumentNullException(nameof(uri));
680             }
681
682             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously(uri.AbsoluteUri), true);
683             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
684             return ret;
685         }
686
687     }
688 }