[NUI] Check spelling
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Images / 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 service 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 service 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 service 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 service 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 service 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 consider rotation
415         /// </summary>
416         /// <param name="filename">The name of the image.</param>
417         /// <param name="orientationCorrection">Reorient the image to respect any orientation metadata in its header.</param>
418         /// <returns>Dimension of the original image.</returns>
419         /// <since_tizen> 6 </since_tizen>
420         /// This will be released at Tizen.NET API Level 9. Therefore, currently this would be used as an in-house API.
421         [EditorBrowsable(EditorBrowsableState.Never)]
422         public static Size2D GetOriginalImageSize(string filename, bool orientationCorrection = true)
423         {
424             var val = new Uint16Pair(Interop.ImageLoading.GetOriginalImageSize(filename, orientationCorrection), true);
425             Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
426             val.Dispose();
427             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
428             return ret;
429         }
430
431         /// <summary>
432         /// Load an image synchronously from a remote resource.
433         /// </summary>
434         /// <param name="url">The URL of the image file to load.</param>
435         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
436         /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
437         /// <param name="samplingMode">The filtering method used when sampling pixels from the input image while fitting it to desired size.</param>
438         /// <param name="orientationCorrection">Reorient the image to respect any orientation metadata in its header.</param>
439         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
440         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
441         /// <since_tizen> 5 </since_tizen>
442         /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API.
443         [EditorBrowsable(EditorBrowsableState.Never)]
444         public static PixelBuffer DownloadImageSynchronously(string url, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection)
445         {
446             if (null == size)
447             {
448                 throw new ArgumentNullException(nameof(size));
449             }
450             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
451             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously(url, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode, orientationCorrection), true);
452             uSize.Dispose();
453             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
454             return ret;
455         }
456
457         /// <summary>
458         /// Hidden API (Inhouse API).
459         /// Using Uri class to provide safe service and secure API.
460         /// Load an image synchronously from a remote resource.
461         /// </summary>
462         /// <param name="uri">The URI of the image file to load.</param>
463         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
464         /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
465         /// <param name="samplingMode">The filtering method used when sampling pixels from the input image while fitting it to desired size.</param>
466         /// <param name="orientationCorrection">Reorient the image to respect any orientation metadata in its header.</param>
467         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
468         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
469         /// <exception cref="ArgumentNullException">Thrown when uri is null.</exception>
470         [EditorBrowsable(EditorBrowsableState.Never)]
471         public static PixelBuffer DownloadImageSynchronously(Uri uri, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection)
472         {
473             if (null == size)
474             {
475                 throw new ArgumentNullException(nameof(size));
476             }
477             if (uri == null)
478             {
479                 throw new ArgumentNullException(nameof(uri));
480             }
481
482             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
483             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously(uri.AbsoluteUri, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode, orientationCorrection), true);
484             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
485
486             uSize.Dispose();
487             return ret;
488         }
489
490         /// <summary>
491         /// Load an image synchronously from a remote resource.
492         /// </summary>
493         /// <param name="url">The URL of the image file to load.</param>
494         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
495         /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
496         /// <param name="samplingMode">The filtering method used when sampling pixels from the input image while fitting it to desired size.</param>
497         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
498         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
499         /// <since_tizen> 5 </since_tizen>
500         /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API.
501         [EditorBrowsable(EditorBrowsableState.Never)]
502         public static PixelBuffer DownloadImageSynchronously(string url, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode)
503         {
504             if (null == size)
505             {
506                 throw new ArgumentNullException(nameof(size));
507             }
508             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
509             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously(url, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode), true);
510             uSize.Dispose();
511             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
512             return ret;
513         }
514
515         /// <summary>
516         /// Hidden API (Inhouse API).
517         /// Using Uri class to provide safe service and secure API.
518         /// Load an image synchronously from a remote resource.
519         /// </summary>
520         /// <param name="uri">The URI of the image file to load.</param>
521         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
522         /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
523         /// <param name="samplingMode">The filtering method used when sampling pixels from the input image while fitting it to desired size.</param>
524         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
525         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
526         /// <exception cref="ArgumentNullException">Thrown when uri is null.</exception>
527         [EditorBrowsable(EditorBrowsableState.Never)]
528         public static PixelBuffer DownloadImageSynchronously(Uri uri, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode)
529         {
530             if (null == size)
531             {
532                 throw new ArgumentNullException(nameof(size));
533             }
534             if (uri == null)
535             {
536                 throw new ArgumentNullException(nameof(uri));
537             }
538
539             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
540             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously(uri.AbsoluteUri, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode), true);
541             uSize.Dispose();
542             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
543             return ret;
544         }
545
546         /// <summary>
547         /// Load an image synchronously from a remote resource.
548         /// </summary>
549         /// <param name="url">The URL of the image file to load.</param>
550         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
551         /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
552         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
553         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
554         /// <since_tizen> 5 </since_tizen>
555         /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API.
556         [EditorBrowsable(EditorBrowsableState.Never)]
557         public static PixelBuffer DownloadImageSynchronously(string url, Size2D size, FittingModeType fittingMode)
558         {
559             if (null == size)
560             {
561                 throw new ArgumentNullException(nameof(size));
562             }
563             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
564             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously(url, Uint16Pair.getCPtr(uSize), (int)fittingMode), true);
565             uSize.Dispose();
566             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
567             return ret;
568         }
569
570         /// <summary>
571         /// Hidden API (Inhouse API).
572         /// Using Uri class to provide safe service and secure API.
573         /// Load an image synchronously from a remote resource.
574         /// </summary>
575         /// <param name="uri">The URI of the image file to load.</param>
576         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
577         /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
578         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
579         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
580         /// <exception cref="ArgumentNullException">Thrown when uri is null.</exception>
581         [EditorBrowsable(EditorBrowsableState.Never)]
582         public static PixelBuffer DownloadImageSynchronously(Uri uri, Size2D size, FittingModeType fittingMode)
583         {
584             if (null == size)
585             {
586                 throw new ArgumentNullException(nameof(size));
587             }
588             if (uri == null)
589             {
590                 throw new ArgumentNullException(nameof(uri));
591             }
592
593             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
594             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously(uri.AbsoluteUri, Uint16Pair.getCPtr(uSize), (int)fittingMode), true);
595             uSize.Dispose();
596             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
597             return ret;
598         }
599
600         /// <summary>
601         /// Load an image synchronously from a remote resource.
602         /// </summary>
603         /// <param name="url">The URL of the image file to load.</param>
604         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
605         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
606         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
607         /// <since_tizen> 5 </since_tizen>
608         /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API.
609         [EditorBrowsable(EditorBrowsableState.Never)]
610         public static PixelBuffer DownloadImageSynchronously(string url, Size2D size)
611         {
612             if (null == size)
613             {
614                 throw new ArgumentNullException(nameof(size));
615             }
616             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
617             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously(url, Uint16Pair.getCPtr(uSize)), true);
618             uSize.Dispose();
619             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
620             return ret;
621         }
622
623         /// <summary>
624         /// Hidden API (Inhouse API).
625         /// Using Uri class to provide safe service and secure API.
626         /// Load an image synchronously from a remote resource.
627         /// </summary>
628         /// <param name="uri">The URI of the image file to load.</param>
629         /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
630         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
631         /// <exception cref="ArgumentNullException"> Thrown when size is null. </exception>
632         /// <exception cref="ArgumentNullException">Thrown when uri is null.</exception>
633         [EditorBrowsable(EditorBrowsableState.Never)]
634         public static PixelBuffer DownloadImageSynchronously(Uri uri, Size2D size)
635         {
636             if (null == size)
637             {
638                 throw new ArgumentNullException(nameof(size));
639             }
640             if (uri == null)
641             {
642                 throw new ArgumentNullException(nameof(uri));
643             }
644
645             var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
646             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously(uri.AbsoluteUri, Uint16Pair.getCPtr(uSize)), true);
647             uSize.Dispose();
648             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
649             return ret;
650         }
651
652         /// <summary>
653         /// Load an image synchronously from a remote resource.
654         /// </summary>
655         /// <param name="url">The URL of the image file to load.</param>
656         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
657         /// <since_tizen> 5 </since_tizen>
658         /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API.
659         [EditorBrowsable(EditorBrowsableState.Never)]
660         public static PixelBuffer DownloadImageSynchronously(string url)
661         {
662             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously(url), true);
663             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
664             return ret;
665         }
666
667         /// <summary>
668         /// Hidden API (Inhouse API).
669         /// Using Uri class to provide safe service and secure API.
670         /// Load an image synchronously from a remote resource.
671         /// </summary>
672         /// <param name="uri">The URI of the image file to load.</param>
673         /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
674         /// <exception cref="ArgumentNullException">Thrown when uri is null.</exception>
675         [EditorBrowsable(EditorBrowsableState.Never)]
676         public static PixelBuffer DownloadImageSynchronously(Uri uri)
677         {
678             if (uri == null)
679             {
680                 throw new ArgumentNullException(nameof(uri));
681             }
682
683             PixelBuffer ret = new PixelBuffer(Interop.ImageLoading.DownloadImageSynchronously(uri.AbsoluteUri), true);
684             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
685             return ret;
686         }
687
688     }
689 }