2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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.
18 using System.Collections.Generic;
19 using System.ComponentModel;
26 /// This group provides the functions for image objects.
28 /// <since_tizen> preview </since_tizen>
29 [Obsolete("This has been deprecated in API12")]
30 public class EvasImage : EvasObject
32 EvasObject _source = null;
33 IntPtr _handle = IntPtr.Zero;
36 /// Creates and initializes a new instance of the EvasImage class.
38 /// <param name="parent">The parent is a given container, which will be attached by EvasImage as a child. It's <see cref="EvasObject"/> type.</param>
39 /// <since_tizen> preview </since_tizen>
40 [Obsolete("This has been deprecated in API12")]
41 public EvasImage(EvasObject parent) : base(parent)
45 internal EvasImage(EvasObject parent, IntPtr handle) : base()
52 /// Sets or gets the source file from where an image object must fetch the real image data.
54 /// <since_tizen> preview </since_tizen>
55 [Obsolete("This has been deprecated in API12")]
61 Interop.Evas.evas_object_image_file_get(RealHandle, out file, out key);
66 Interop.Evas.evas_object_image_file_set(RealHandle, value, null);
71 /// Sets or gets the source object to be visible.
73 /// <since_tizen> preview </since_tizen>
74 [Obsolete("This has been deprecated in API12")]
75 public bool IsSourceVisible
79 return Interop.Evas.evas_object_image_source_visible_get(RealHandle);
83 Interop.Evas.evas_object_image_source_visible_set(RealHandle, value);
88 /// Sets or gets whether an object is clipped by the source object's clipper.
90 /// <since_tizen> preview </since_tizen>
91 [Obsolete("This has been deprecated in API12")]
92 public bool IsSourceClipped
96 return Interop.Evas.evas_object_image_source_clip_get(RealHandle);
100 Interop.Evas.evas_object_image_source_clip_set(RealHandle, value);
105 /// Sets or gets if the center part of the given image object (not the border) should be drawn.
108 /// When rendering, the image may be scaled to fit the size of the image object.
109 /// This function sets if the center part of the scaled image is to be drawn or left completely blank, or forced to be solid.
110 /// Very useful for frames and decorations.
112 /// <since_tizen> preview </since_tizen>
113 [Obsolete("This has been deprecated in API12")]
114 public ImageBorderFillMode BorderCenterFillMode
118 return (ImageBorderFillMode)Interop.Evas.evas_object_image_border_center_fill_get(RealHandle);
122 Interop.Evas.evas_object_image_border_center_fill_set(RealHandle, (int)value);
127 /// Sets or gets whether the image object's fill property should track the object's size.
129 /// <since_tizen> preview </since_tizen>
130 [Obsolete("This has been deprecated in API12")]
135 return Interop.Evas.evas_object_image_filled_get(RealHandle);
139 Interop.Evas.evas_object_image_filled_set(RealHandle, value);
144 /// Sets or gets the scaling factor (multiplier) for the borders of the image object.
146 /// <since_tizen> preview </since_tizen>
147 [Obsolete("This has been deprecated in API12")]
148 public double BorderScale
152 return Interop.Evas.evas_object_image_border_scale_get(RealHandle);
156 Interop.Evas.evas_object_image_border_scale_set(RealHandle, value);
161 /// Sets or gets the size of the given image object.
163 /// <since_tizen> preview </since_tizen>
164 [Obsolete("This has been deprecated in API12")]
170 Interop.Evas.evas_object_image_size_get(RealHandle, out w, out h);
171 return new Size(w, h);
175 Interop.Evas.evas_object_image_size_set(RealHandle, value.Width, value.Height);
180 /// Gets the row stride of the given image object.
182 /// <since_tizen> preview </since_tizen>
183 [Obsolete("This has been deprecated in API12")]
188 return Interop.Evas.evas_object_image_stride_get(RealHandle);
193 /// Sets or gets whether the alpha channel data is being used on the given image object.
195 /// <since_tizen> preview </since_tizen>
196 [Obsolete("This has been deprecated in API12")]
201 return !Interop.Evas.evas_object_image_alpha_get(RealHandle);
205 Interop.Evas.evas_object_image_alpha_set(RealHandle, !value);
210 /// Sets or gets whether to use a high-quality image scaling algorithm on the given image object.
212 /// <since_tizen> preview </since_tizen>
213 [Obsolete("This has been deprecated in API12")]
214 public bool IsSmoothScaled
218 return Interop.Evas.evas_object_image_smooth_scale_get(RealHandle);
222 Interop.Evas.evas_object_image_smooth_scale_set(RealHandle, value);
227 /// Sets how to fill an image object's drawing rectangle given the (real) image bound to it.
229 /// <param name="geometry">The rectangle of the given image object that the image will be drawn to.</param>
230 /// <since_tizen> preview </since_tizen>
231 [Obsolete("This has been deprecated in API12")]
232 public void SetFill(Rect geometry)
234 Interop.Evas.evas_object_image_fill_set(RealHandle, geometry.X, geometry.Y, geometry.Width, geometry.Height);
238 /// Sets the source file from where an image object must fetch the real image data (it may be an Eet file, besides pure image ones).
240 /// <param name="file">The image file path.</param>
241 /// <param name="key">The image key in file (if its an Eet one), otherwise set null.</param>
242 /// <since_tizen> preview </since_tizen>
243 [Obsolete("This has been deprecated in API12")]
244 public void SetFile(string file, string key)
246 Interop.Evas.evas_object_image_file_set(RealHandle, file, key);
250 /// Sets the data for an image from the memory to be loaded.
252 /// <param name="stream">memory stream</param>
253 /// <since_tizen> preview </since_tizen>
254 [Obsolete("This has been deprecated in API12")]
255 public void SetStream(Stream stream)
258 throw new ArgumentNullException("stream");
260 MemoryStream memstream = new MemoryStream();
261 stream.CopyTo(memstream);
264 byte[] dataArr = memstream.ToArray();
265 fixed (byte* data = &dataArr[0])
267 Interop.Evas.evas_object_image_memfile_set(RealHandle, data, dataArr.Length, IntPtr.Zero, IntPtr.Zero);
274 /// Sets the source object on an image object to be used as a proxy.
276 /// <param name="source">The proxy (image) object.</param>
277 /// <returns>true if the source object is set successfully, otherwise false on error.</returns>
278 /// <since_tizen> preview </since_tizen>
279 [Obsolete("This has been deprecated in API12")]
280 public bool SetSource(EvasObject source)
284 result = Interop.Evas.evas_object_image_source_set(RealHandle, IntPtr.Zero);
286 result = result && Interop.Evas.evas_object_image_source_set(RealHandle, source.Handle);
291 /// Set the native surface of a given image of the canvas.
293 /// <param name="surface">The surface.</param>
294 /// <since_tizen> preview </since_tizen>
295 [Obsolete("This has been deprecated in API12")]
296 [EditorBrowsable(EditorBrowsableState.Never)]
297 public void SetNativeSurface(IntPtr surface)
299 Interop.Evas.evas_object_image_native_surface_set(RealHandle, surface);
303 /// Sets the dimensions for an image object's border, a region which is not scaled together with its center ever.
305 /// <param name="left">The border's left width.</param>
306 /// <param name="right">The border's right width.</param>
307 /// <param name="top">The border's top width.</param>
308 /// <param name="bottom">The border's bottom width.</param>
309 /// <since_tizen> preview </since_tizen>
310 [Obsolete("This has been deprecated in API12")]
311 public void SetBorder(int left, int right, int top, int bottom)
313 Interop.Evas.evas_object_image_border_set(RealHandle, left, right, top, bottom);
317 /// Save the given image object's contents to an (image) file.
319 /// The extension suffix on file will determine which saver module Evas is to use when saving, thus the final file's format. If the file supports multiple data stored in it (Eet ones), you can specify the key to be used as the index of the image in it.
321 /// You can specify some flags when saving the image.Currently acceptable flags are quality and compress.Eg.: "quality=100 compress=9"
323 /// <param name="file">The filename to be used to save the image (extension obligatory).</param>
324 /// <param name="key">The image key in the file (if an Eet one), or null, otherwise.</param>
325 /// <param name="flags">String containing the flags to be used (null for none).</param>
326 [Obsolete("This has been deprecated in API12")]
327 public void Save(string file, string key, string flags)
329 Interop.Evas.evas_object_image_save(RealHandle, file, key, flags);
333 /// Sets the content at a part of a given container widget.
335 /// <param name="parent">The parent is a given container, which will be attached by the image as a child. It's <see cref="EvasObject"/> type.</param>
336 /// <returns>The new object, otherwise null if it cannot be created.</returns>
337 /// <since_tizen> preview </since_tizen>
338 [Obsolete("This has been deprecated in API12")]
339 protected override IntPtr CreateHandle(EvasObject parent)
341 return _handle != IntPtr.Zero ? _handle : Interop.Evas.evas_object_image_add(Interop.Evas.evas_object_evas_get(parent.Handle));