2 * Copyright(c) 2017 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
24 /// <since_tizen> 5 </since_tizen>
25 public class ImageLoading
28 /// Load an image synchronously from local file.
30 /// <param name="url">The URL of the image file to load.</param>
31 /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
32 /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
33 /// <param name="samplingMode">The filtering method used when sampling pixels from the input image while fitting it to desired size.</param>
34 /// <param name="orientationCorrection">Reorient the image to respect any orientation metadata in its header.</param>
35 /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case loading failed.</returns>
36 public static PixelBuffer LoadImageFromFile(string url, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection)
38 var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
39 PixelBuffer ret = new PixelBuffer(NDalicPINVOKE.LoadImageFromFile__SWIG_0(url, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode, orientationCorrection), true);
40 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
45 /// Load an image synchronously from local file.
47 /// <param name="url">The URL of the image file to load.</param>
48 /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
49 /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
50 /// <param name="samplingMode">The filtering method used when sampling pixels from the input image while fitting it to desired size.</param>
51 /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case loading failed.</returns>
52 public static PixelBuffer LoadImageFromFile(string url, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode)
54 var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
55 PixelBuffer ret = new PixelBuffer(NDalicPINVOKE.LoadImageFromFile__SWIG_1(url, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode), true);
56 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
61 /// Load an image synchronously from local file.
63 /// <param name="url">The URL of the image file to load.</param>
64 /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
65 /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
66 /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case loading failed.</returns>
67 public static PixelBuffer LoadImageFromFile(string url, Size2D size, FittingModeType fittingMode)
69 var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
70 PixelBuffer ret = new PixelBuffer(NDalicPINVOKE.LoadImageFromFile__SWIG_2(url, Uint16Pair.getCPtr(uSize), (int)fittingMode), true);
71 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
76 /// Load an image synchronously from local file.
78 /// <param name="url">The URL of the image file to load.</param>
79 /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
80 /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case loading failed.</returns>
81 public static PixelBuffer LoadImageFromFile(string url, Size2D size)
83 var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
84 PixelBuffer ret = new PixelBuffer(NDalicPINVOKE.LoadImageFromFile__SWIG_3(url, Uint16Pair.getCPtr(uSize)), true);
85 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
90 /// Load an image synchronously from local file.
92 /// <param name="url">The URL of the image file to load.</param>
93 /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case loading failed.</returns>
94 public static PixelBuffer LoadImageFromFile(string url)
96 PixelBuffer ret = new PixelBuffer(NDalicPINVOKE.LoadImageFromFile__SWIG_4(url), true);
97 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
102 /// Determine the size of an image that LoadImageFromFile will provide when given the same image loading parameters.
104 /// <param name="filename">The name of the image.</param>
105 /// <param name="size">The requested size for the image</param>
106 /// <param name="fittingMode">The method to use to map the source image to the desired dimensions.</param>
107 /// <param name="samplingMode">The image filter to use if the image needs to be downsampled to the requested size.</param>
108 /// <param name="orientationCorrection">Whether to use image metadata to rotate or flip the image, e.g., from portrait to landscape.</param>
109 /// <returns>Dimensions that image will have if it is loaded with given parameters.</returns>
110 public static Size2D GetClosestImageSize(string filename, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection)
112 var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
113 var val = new Uint16Pair(NDalicPINVOKE.GetClosestImageSize__SWIG_0(filename, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode, orientationCorrection), true);
114 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
115 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
120 /// Determine the size of an image that LoadImageFromFile will provide when given the same image loading parameters.
122 /// <param name="filename">The name of the image.</param>
123 /// <param name="size">The requested size for the image</param>
124 /// <param name="fittingMode">The method to use to map the source image to the desired dimensions.</param>
125 /// <param name="samplingMode">The image filter to use if the image needs to be downsampled to the requested size.</param>
126 /// <returns>Dimensions that image will have if it is loaded with given parameters.</returns>
127 public static Size2D GetClosestImageSize(string filename, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode)
129 var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
130 var val = new Uint16Pair(NDalicPINVOKE.GetClosestImageSize__SWIG_1(filename, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode), true);
131 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
132 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
137 /// Determine the size of an image that LoadImageFromFile will provide when given the same image loading parameters.
139 /// <param name="filename">The name of the image.</param>
140 /// <param name="size">The requested size for the image</param>
141 /// <param name="fittingMode">The method to use to map the source image to the desired dimensions.</param>
142 /// <returns>Dimensions that image will have if it is loaded with given parameters.</returns>
143 public static Size2D GetClosestImageSize(string filename, Size2D size, FittingModeType fittingMode)
145 var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
146 var val = new Uint16Pair(NDalicPINVOKE.GetClosestImageSize__SWIG_2(filename, Uint16Pair.getCPtr(uSize), (int)fittingMode), true);
147 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
148 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
153 /// Determine the size of an image that LoadImageFromFile will provide when given the same image loading parameters.
155 /// <param name="filename">The name of the image.</param>
156 /// <param name="size">The requested size for the image</param>
157 /// <returns>Dimensions that image will have if it is loaded with given parameters.</returns>
158 public static Size2D GetClosestImageSize(string filename, Size2D size)
160 var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
161 var val = new Uint16Pair(NDalicPINVOKE.GetClosestImageSize__SWIG_3(filename, Uint16Pair.getCPtr(uSize)), true);
162 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
163 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168 /// Determine the size of an image that LoadImageFromFile will provide when given the same image loading parameters.
170 /// <param name="filename">The name of the image.</param>
171 /// <returns>Dimensions that image will have if it is loaded with given parameters.</returns>
172 public static Size2D GetClosestImageSize(string filename)
174 var val = new Uint16Pair(NDalicPINVOKE.GetClosestImageSize__SWIG_4(filename), true);
175 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
176 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
181 /// Load an image synchronously from a remote resource.
183 /// <param name="url">The URL of the image file to load.</param>
184 /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
185 /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
186 /// <param name="samplingMode">The filtering method used when sampling pixels from the input image while fitting it to desired size.</param>
187 /// <param name="orientationCorrection">Reorient the image to respect any orientation metadata in its header.</param>
188 /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
189 public static PixelBuffer DownloadImageSynchronously(string url, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection)
191 var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
192 PixelBuffer ret = new PixelBuffer(NDalicPINVOKE.DownloadImageSynchronously__SWIG_0(url, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode, orientationCorrection), true);
193 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
198 /// Load an image synchronously from a remote resource.
200 /// <param name="url">The URL of the image file to load.</param>
201 /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
202 /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
203 /// <param name="samplingMode">The filtering method used when sampling pixels from the input image while fitting it to desired size.</param>
204 /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
205 public static PixelBuffer DownloadImageSynchronously(string url, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode)
207 var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
208 PixelBuffer ret = new PixelBuffer(NDalicPINVOKE.DownloadImageSynchronously__SWIG_1(url, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode), true);
209 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
214 /// Load an image synchronously from a remote resource.
216 /// <param name="url">The URL of the image file to load.</param>
217 /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
218 /// <param name="fittingMode">The method used to fit the shape of the image before loading to the shape defined by the size parameter.</param>
219 /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
220 public static PixelBuffer DownloadImageSynchronously(string url, Size2D size, FittingModeType fittingMode)
222 var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
223 PixelBuffer ret = new PixelBuffer(NDalicPINVOKE.DownloadImageSynchronously__SWIG_2(url, Uint16Pair.getCPtr(uSize), (int)fittingMode), true);
224 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
229 /// Load an image synchronously from a remote resource.
231 /// <param name="url">The URL of the image file to load.</param>
232 /// <param name="size">The width and height to fit the loaded image to, 0.0 means whole image.</param>
233 /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
234 public static PixelBuffer DownloadImageSynchronously(string url, Size2D size)
236 var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height);
237 PixelBuffer ret = new PixelBuffer(NDalicPINVOKE.DownloadImageSynchronously__SWIG_3(url, Uint16Pair.getCPtr(uSize)), true);
238 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
243 /// Load an image synchronously from a remote resource.
245 /// <param name="url">The URL of the image file to load.</param>
246 /// <returns>Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed.</returns>
247 public static PixelBuffer DownloadImageSynchronously(string url)
249 PixelBuffer ret = new PixelBuffer(NDalicPINVOKE.DownloadImageSynchronously__SWIG_4(url), true);
250 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
255 /// Set the maximum texture size. Then size can be kwown by GL_MAX_TEXTURE_SIZE.
257 /// <param name="size">The maximum texture size to set.</param>
258 public static void SetMaxTextureSize(uint size)
260 NDalicPINVOKE.SetMaxTextureSize(size);
261 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
265 /// Get the maximum texture size.
267 /// <returns>The maximum texture size.</returns>
268 public static uint GetMaxTextureSize()
270 uint ret = NDalicPINVOKE.GetMaxTextureSize();
271 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();