/// <summary>
/// The Image is a widget that allows one to load and display an image file on it,
/// be it from a disk file or from a memory region.
- /// Inherits Widget
+ /// Inherits Widget.
/// </summary>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public class Image : Widget
{
bool _canScaleUp = true;
EvasImage _imageObject = null;
/// <summary>
- /// Creates and initializes a new instance of Image class.
+ /// Creates and initializes a new instance of the Image class.
/// </summary>
- /// <param name="parent">The parent is a given container which will be attached by Image as a child. It's <see cref="EvasObject"/> type.</param>
+ /// <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>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public Image(EvasObject parent) : base(parent)
{
_clicked = new SmartEvent(this, "clicked");
/// <summary>
/// Clicked will be triggered when the image is clicked.
/// </summary>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public event EventHandler Clicked;
/// <summary>
/// LoadingCompleted will be triggered when the image is loaded completely.
/// </summary>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public event EventHandler LoadingCompleted;
/// <summary>
- /// Clicked will be triggered when the image is fail to load.
+ /// Clicked will be triggered when the image fails to load.
/// </summary>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public event EventHandler LoadingFailed;
/// <summary>
/// Gets the file that is used as an image.
/// </summary>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public string File
{
get
/// <summary>
/// Sets or gets the smooth effect for an image.
/// </summary>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public bool IsSmooth
{
get
/// <summary>
/// Sets or gets whether scaling is disabled on the object.
/// </summary>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public bool IsScaling
{
get
}
/// <summary>
- /// Sets or gets whether the object is down resizeable.
+ /// Sets or gets whether the object is down resizable.
/// </summary>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public bool CanScaleDown
{
get
}
/// <summary>
- /// Sets or gets whether the object is up resizeable.
+ /// Sets or gets whether the object is up resizable.
/// </summary>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public bool CanScaleUp
{
get
/// <summary>
/// Sets or gets whether the image fills the entire object area, when keeping the aspect ratio.
/// </summary>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public bool CanFillOutside
{
get
/// <summary>
/// Sets or gets the prescale size for the image.
/// </summary>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public int PrescaleSize
{
get
/// <summary>
/// Sets or gets whether the original aspect ratio of the image should be kept on resize.
/// </summary>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public bool IsFixedAspect
{
get
/// <summary>
/// Sets or gets whether an image object (which supports animation) is to animate itself.
/// </summary>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public bool IsAnimated
{
get
/// <summary>
/// Gets whether an image object supports animation.
/// </summary>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public bool IsAnimatedAvailable
{
get
/// An image object, even if it supports animation, will be displayed by default without animation.
/// To actually start playing any image object's animation, <see cref="IsAnimated"/> should be TRUE before setting this property true.
/// </remarks>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public bool IsAnimationPlaying
{
get
/// <summary>
/// Sets or gets whether the image is 'editable'.
/// </summary>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public bool IsEditable
{
get
/// <summary>
/// Gets the current size of the image.
/// </summary>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public Size ObjectSize
{
get
}
/// <summary>
- /// Sets or gets whether alpha channel data is being used on the given image object.
+ /// Sets or gets whether the alpha channel data is being used on the given image object.
/// </summary>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public bool IsOpaque
{
get
/// <summary>
/// Sets or gets the image orientation.
/// </summary>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public ImageOrientation Orientation
{
get
}
/// <summary>
- /// Sets or gets the image color
+ /// Sets or gets the image color.
/// </summary>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public override Color Color
{
get
}
/// <summary>
- /// Sets the background color
+ /// Sets the background color.
/// </summary>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public override Color BackgroundColor
{
set
/// Gets the inlined image object of the image widget.
/// This property allows one to get the underlying EvasObject of type Image from this elementary widget. It can be useful to do things like save the image to a file, etc.
/// </summary>
- /// <remarks>Be careful to not manipulate it, as it is under the control of widget.</remarks>
+ /// <remarks>Be careful not to manipulate it, as it is under the control of the widget.</remarks>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public EvasImage ImageObject
{
get
{
IntPtr evasObj = Interop.Elementary.elm_image_object_get(RealHandle);
if (evasObj != IntPtr.Zero)
+ {
_imageObject = new EvasImage(this, evasObj);
+ _imageObject.Deleted += (s, e) => _imageObject = null;
+ }
}
return _imageObject;
}
/// <summary>
/// Sets the dimensions for an image object's border, a region which is not scaled together with its center ever.
/// </summary>
- /// <param name="left">The border's left width</param>
- /// <param name="right">The border's right width</param>
- /// <param name="top">The border's top width</param>
- /// <param name="bottom">The border's bottom width</param>
+ /// <param name="left">The border's left width.</param>
+ /// <param name="right">The border's right width.</param>
+ /// <param name="top">The border's top width.</param>
+ /// <param name="bottom">The border's bottom width.</param>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public void SetBorder(int left, int right, int top, int bottom)
{
ImageObject?.SetBorder(left, right, top, bottom);
/// This function sets if the center part of the scaled image is to be drawn or left completely blank, or forced to be solid.
/// Very useful for frames and decorations.
/// </remarks>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public ImageBorderFillMode BorderCenterFillMode
{
get
/// <summary>
/// Sets the file that is used as the image's source.
/// </summary>
- /// <param name="file">The path to the file that is used as an image source</param>
+ /// <param name="file">The path to the file that is used as an image source.</param>
/// <returns>(true = success, false = error)</returns>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public bool Load(string file)
{
if (file == null)
- throw new ArgumentNullException("file");
+ throw new ArgumentNullException(nameof(file));
Interop.Elementary.elm_image_async_open_set(RealHandle, false);
Interop.Elementary.elm_image_preload_disabled_set(RealHandle, true);
}
/// <summary>
- /// Sets the uri that is used as the image's source.
+ /// Sets the URI that is used as the image's source.
/// </summary>
- /// <param name="uri">The uri to the file that is used as an image source</param>
+ /// <param name="uri">The URI to the file that is used as an image source.</param>
/// <returns>(true = success, false = error)</returns>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public bool Load(Uri uri)
{
if (uri == null)
- throw new ArgumentNullException("uri");
+ throw new ArgumentNullException(nameof(uri));
return Load(uri.IsFile ? uri.LocalPath : uri.AbsoluteUri);
}
/// Sets a location in the memory to be used as an image object's source bitmap.
/// </summary>
/// <remarks>
- /// This function is handy when the contents of an image file are mapped into the memory, for example.
- /// The format string should be something like "png", "jpg", "tga", "tiff", "bmp" etc, when provided (null, on the contrary).
+ /// This function is handy when the contents of an image file are mapped into the memory, for example,
+ /// the format string should be something like "png", "jpg", "tga", "tiff", "bmp" etc, when provided (null, on the contrary).
/// This improves the loader performance as it tries the "correct" loader first, before trying a range of other possible loaders until one succeeds.
/// </remarks>
- /// <param name="img">The binary data that is used as an image source</param>
- /// <param name="size">The size of the binary data blob img</param>
+ /// <param name="img">The binary data that is used as an image source.</param>
+ /// <param name="size">The size of the binary data blob img.</param>
/// <returns>(true = success, false = error)</returns>
+ /// <since_tizen> preview </since_tizen>
[Obsolete("This method will be removed. Use Load(Stream stream) instead.")]
public unsafe bool Load(byte* img, long size)
{
if (img == null)
- throw new ArgumentNullException("img");
+ throw new ArgumentNullException(nameof(img));
Interop.Elementary.elm_image_async_open_set(RealHandle, false);
Interop.Elementary.elm_image_preload_disabled_set(RealHandle, true);
/// <summary>
/// Sets the stream that is used as the image's source.
/// </summary>
- /// <param name="stream">The stream that is used as an image source</param>
+ /// <param name="stream">The stream that is used as an image source.</param>
/// <returns>(true = success, false = error)</returns>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public bool Load(Stream stream)
{
if (stream == null)
- throw new ArgumentNullException("stream");
+ throw new ArgumentNullException(nameof(stream));
Interop.Elementary.elm_image_async_open_set(RealHandle, false);
Interop.Elementary.elm_image_preload_disabled_set(RealHandle, true);
/// <summary>
/// Sets the file that is used as the image's source with async.
/// </summary>
- /// <param name="file">The path to the file that is used as an image source</param>
- /// <param name="cancellationToken">cancellation token</param>
+ /// <param name="file">The path to the file that is used as an image source.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>(true = success, false = error)</returns>
- public Task<bool> LoadAsync(string file, CancellationToken cancellationToken = default(CancellationToken))
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
+ public async Task<bool> LoadAsync(string file, CancellationToken cancellationToken = default(CancellationToken))
{
if (file == null)
- throw new ArgumentNullException("file");
+ throw new ArgumentNullException(nameof(file));
Interop.Elementary.elm_image_async_open_set(RealHandle, true);
Interop.Elementary.elm_image_preload_disabled_set(RealHandle, false);
SmartEvent loadReady = new SmartEvent(this, RealHandle, "load,ready");
loadReady.On += (s, e) =>
{
- loadReady.Dispose();
LoadingCompleted?.Invoke(this, EventArgs.Empty);
if (tcs != null && !tcs.Task.IsCompleted)
{
SmartEvent loadError = new SmartEvent(this, RealHandle, "load,error");
loadError.On += (s, e) =>
{
- loadError.Dispose();
LoadingFailed?.Invoke(this, EventArgs.Empty);
if (tcs != null && !tcs.Task.IsCompleted)
{
}
};
- bool ret = Interop.Elementary.elm_image_file_set(RealHandle, file, null);
- if (!ret)
+ using (loadReady)
+ using (loadError)
{
- throw new InvalidOperationException("Failed to set file to Image");
+ bool ret = Interop.Elementary.elm_image_file_set(RealHandle, file, null);
+ if (!ret)
+ {
+ throw new InvalidOperationException("Failed to set file to Image");
+ }
+ // it should be return on main thread, because SmartEvent should be disposed on main thread
+ return await tcs.Task.ConfigureAwait(true);
}
-
- return tcs.Task;
}
/// <summary>
- /// Sets the uri that is used as the image's source with async.
+ /// Sets the URI that is used as the image's source with async.
/// </summary>
- /// <param name="uri">The uri to the file that is used as an image source</param>
- /// <param name="cancellationToken">cancellation token</param>
+ /// <param name="uri">The URI to the file that is used as an image source.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>(true = success, false = error)</returns>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public Task<bool> LoadAsync(Uri uri, CancellationToken cancellationToken = default(CancellationToken))
{
if (uri == null)
- throw new ArgumentNullException("uri");
+ throw new ArgumentNullException(nameof(uri));
return LoadAsync(uri.IsFile ? uri.LocalPath : uri.AbsoluteUri, cancellationToken);
}
/// <summary>
/// Sets the stream that is used as the image's source with async.
/// </summary>
- /// <param name="stream">The stream that is used as an image source</param>
- /// <param name="cancellationToken">cancellation token</param>
+ /// <param name="stream">The stream that is used as an image source.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>(true = success, false = error)</returns>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public async Task<bool> LoadAsync(Stream stream, CancellationToken cancellationToken = default(CancellationToken))
{
if (stream == null)
- throw new ArgumentNullException("stream");
+ throw new ArgumentNullException(nameof(stream));
Interop.Elementary.elm_image_async_open_set(RealHandle, true);
Interop.Elementary.elm_image_preload_disabled_set(RealHandle, false);
SmartEvent loadReady = new SmartEvent(this, RealHandle, "load,ready");
loadReady.On += (s, e) =>
{
- loadReady.Dispose();
LoadingCompleted?.Invoke(this, EventArgs.Empty);
if (tcs != null && !tcs.Task.IsCompleted)
{
SmartEvent loadError = new SmartEvent(this, RealHandle, "load,error");
loadError.On += (s, e) =>
{
- loadError.Dispose();
LoadingFailed?.Invoke(this, EventArgs.Empty);
if (tcs != null && !tcs.Task.IsCompleted)
{
}
};
- MemoryStream memstream = new MemoryStream();
- await stream.CopyToAsync(memstream);
-
- unsafe
+ using (MemoryStream memstream = new MemoryStream())
+ using (loadReady)
+ using (loadError)
{
- byte[] dataArr = memstream.ToArray();
- fixed (byte* data = &dataArr[0])
+ await stream.CopyToAsync(memstream).ConfigureAwait(true);
+
+ unsafe
{
- bool ret = Interop.Elementary.elm_image_memfile_set(RealHandle, data, dataArr.Length, IntPtr.Zero, IntPtr.Zero);
- if (!ret)
+ byte[] dataArr = memstream.ToArray();
+ fixed (byte* data = &dataArr[0])
{
- return false;
+ bool ret = Interop.Elementary.elm_image_memfile_set(RealHandle, data, dataArr.Length, IntPtr.Zero, IntPtr.Zero);
+ if (!ret)
+ {
+ return false;
+ }
}
}
+ // it should be return on main thread, because SmartEvent should be disposed on main thread
+ return await tcs.Task.ConfigureAwait(true);
}
-
- memstream.Dispose();
-
- return await tcs.Task;
}
/// <summary>
- /// Sets the color of color class for a given widget.
+ /// Sets the color of the Color class for a given widget.
/// </summary>
- /// <param name="part">The name of color class.</param>
- /// <param name="color">The struct of color</param>
+ /// <param name="part">The name of the Color class.</param>
+ /// <param name="color">The struct of the Color class.</param>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public override void SetPartColor(string part, Color color)
{
Interop.Elementary.elm_object_color_class_color_set(Handle, part, color.R * color.A / 255,
}
/// <summary>
- /// Gets the color of color class for a given widget.
+ /// Gets the color of the Color class for a given widget.
/// </summary>
- /// <param name="part">The name of color class.</param>
- /// <returns>color object</returns>
+ /// <param name="part">The name of the Color class.</param>
+ /// <returns>The color object.</returns>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public override Color GetPartColor(string part)
{
Interop.Elementary.elm_object_color_class_color_get(Handle, part, out int r, out int g, out int b, out int a);
/// <summary>
/// Sets the content at a part of a given container widget.
/// </summary>
- /// <param name="parent">The parent is a given container which will be attached by Image as a child. It's <see cref="EvasObject"/> type.</param>
- /// <returns>The new object, otherwise null if it cannot be created</returns>
+ /// <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>
+ /// <returns>The new object, otherwise null if it cannot be created.</returns>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
protected override IntPtr CreateHandle(EvasObject parent)
{
- IntPtr handle = Interop.Elementary.elm_layout_add(parent);
+ IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle);
Interop.Elementary.elm_layout_theme_set(handle, "layout", "background", "default");
RealHandle = Interop.Elementary.elm_image_add(handle);
}
/// <summary>
- /// Enumeration for the fill mode of image border
+ /// Enumeration for the fill mode of the image border.
/// </summary>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public enum ImageBorderFillMode
{
/// <summary>
- /// None mode of image border
+ /// None mode of the image border.
/// </summary>
None,
/// <summary>
- /// Default mode of image border
+ /// Default mode of the image border.
/// </summary>
Default,
/// <summary>
- /// Solid mode of image border
+ /// Solid mode of the image border.
/// </summary>
Solid,
}
/// <summary>
- /// Enumeration for the possible orientation options
+ /// Enumeration for the possible orientation options.
/// </summary>
+ /// <since_tizen> preview </since_tizen>
+ [Obsolete("This has been deprecated in API12")]
public enum ImageOrientation : int
{
/// <summary>
- /// No orientation change
+ /// No orientation change.
/// </summary>
None = 0,
/// <summary>
- /// Rotate 90 degrees clockwise
+ /// Rotate 90 degrees clockwise.
/// </summary>
Rotate90,
/// <summary>
- /// Rotate 180 degrees clockwise
+ /// Rotate 180 degrees clockwise.
/// </summary>
Rotate180,
/// <summary>
- /// Rotate 90 degrees counter-clockwise (i.e. 270 degrees clockwise)
+ /// Rotate 90 degrees counter-clockwise (i.e., 270 degrees clockwise).
/// </summary>
Rotate270,
/// <summary>
- /// Flip image horizontally
+ /// Flip the image horizontally.
/// </summary>
FlipHorizontal,
/// <summary>
- /// Flip image vertically
+ /// Flip the image vertically.
/// </summary>
FlipVertical,
/// <summary>
- /// Flip the image along the y = (width - x) line (bottom-left to top-right)
+ /// Flip the image along the Y = (width - X) line (bottom-left to top-right).
/// </summary>
FlipTranspose,
/// <summary>
- /// Flip the image along the y = x line (top-left to bottom-right)
+ /// Flip the image along the Y = X line (top-left to bottom-right).
/// </summary>
FlipTransverse
}
-}
\ No newline at end of file
+}