diff --git a/src/Graphics/src/Graphics/PlatformImage.cs b/src/Graphics/src/Graphics/PlatformImage.cs index 3449223fb6fc..85524cdb1093 100644 --- a/src/Graphics/src/Graphics/PlatformImage.cs +++ b/src/Graphics/src/Graphics/PlatformImage.cs @@ -44,6 +44,15 @@ public IImage Resize(float width, float height, ResizeMode resizeMode = ResizeMo throw new PlatformNotSupportedException(); } + /// + /// Saves the contents of this image to the provided object. + /// + /// The destination stream the bytes of this image will be saved to. + /// The destination format of the image. + /// The destination quality of the image. + /// Thrown when is less than 0 or more than 1. + /// Thrown when the provided value in does not match with the original format for this image. + /// The value is currently unused. public void Save(Stream stream, ImageFormat format = ImageFormat.Png, float quality = 1) { if (quality < 0 || quality > 1) @@ -59,6 +68,7 @@ public void Save(Stream stream, ImageFormat format = ImageFormat.Png, float qual } } + /// public Task SaveAsync(Stream stream, ImageFormat format = ImageFormat.Png, float quality = 1) { if (quality < 0 || quality > 1) diff --git a/src/Graphics/src/Graphics/Platforms/Android/PlatformImage.cs b/src/Graphics/src/Graphics/Platforms/Android/PlatformImage.cs index 2a36cdb28955..56c5706d2c14 100644 --- a/src/Graphics/src/Graphics/Platforms/Android/PlatformImage.cs +++ b/src/Graphics/src/Graphics/Platforms/Android/PlatformImage.cs @@ -89,6 +89,17 @@ public IImage Resize(float width, float height, ResizeMode resizeMode = ResizeMo public Bitmap PlatformRepresentation => _bitmap; + /// + /// Saves the contents of this image to the provided object. + /// + /// The destination stream the bytes of this image will be saved to. + /// The destination format of the image. + /// The destination quality of the image. + /// Thrown when is less than 0 or more than 1. + /// + /// Only and are supported on this platform. + /// Setting is only supported for images with . + /// public void Save(Stream stream, ImageFormat format = ImageFormat.Png, float quality = 1) { if (quality < 0 || quality > 1) @@ -105,6 +116,7 @@ public void Save(Stream stream, ImageFormat format = ImageFormat.Png, float qual } } + /// public async Task SaveAsync(Stream stream, ImageFormat format = ImageFormat.Png, float quality = 1) { if (quality < 0 || quality > 1) diff --git a/src/Graphics/src/Graphics/Platforms/Mac/PlatformImage.cs b/src/Graphics/src/Graphics/Platforms/Mac/PlatformImage.cs index d48f98cf4157..b1e0698d3a70 100644 --- a/src/Graphics/src/Graphics/Platforms/Mac/PlatformImage.cs +++ b/src/Graphics/src/Graphics/Platforms/Mac/PlatformImage.cs @@ -23,12 +23,21 @@ public PlatformImage(NSImage image) public NSImage NativeRepresentation => _image; + /// + /// Saves the contents of this image to the provided object. + /// + /// The destination stream the bytes of this image will be saved to. + /// The destination format of the image. + /// The destination quality of the image. + /// Thrown when is less than 0 or more than 1. + /// Setting is only supported for images with . public void Save(Stream stream, ImageFormat format = ImageFormat.Png, float quality = 1) { var data = CreateRepresentation(format, quality); data.AsStream().CopyTo(stream); } + /// public async Task SaveAsync(Stream stream, ImageFormat format = ImageFormat.Png, float quality = 1) { var data = CreateRepresentation(format, quality); diff --git a/src/Graphics/src/Graphics/Platforms/Windows/PlatformImage.cs b/src/Graphics/src/Graphics/Platforms/Windows/PlatformImage.cs index d889ee62b33c..c39d29592bb0 100644 --- a/src/Graphics/src/Graphics/Platforms/Windows/PlatformImage.cs +++ b/src/Graphics/src/Graphics/Platforms/Windows/PlatformImage.cs @@ -87,6 +87,17 @@ public IImage Resize(float width, float height, ResizeMode resizeMode = ResizeMo public float Height => (float)_bitmap.Size.Height; + /// + /// Saves the contents of this image to the provided object. + /// + /// The destination stream the bytes of this image will be saved to. + /// The destination format of the image. + /// The destination quality of the image. + /// Thrown when is less than 0 or more than 1. + /// + /// Only and are supported on this platform. + /// Setting is only supported for images with . + /// public void Save(Stream stream, ImageFormat format = ImageFormat.Png, float quality = 1) { if (quality < 0 || quality > 1) @@ -103,6 +114,7 @@ public void Save(Stream stream, ImageFormat format = ImageFormat.Png, float qual } } + /// public async Task SaveAsync(Stream stream, ImageFormat format = ImageFormat.Png, float quality = 1) { if (quality < 0 || quality > 1) diff --git a/src/Graphics/src/Graphics/Platforms/iOS/PlatformImage.cs b/src/Graphics/src/Graphics/Platforms/iOS/PlatformImage.cs index c1ad1b4c64fa..0e1cce5a369f 100644 --- a/src/Graphics/src/Graphics/Platforms/iOS/PlatformImage.cs +++ b/src/Graphics/src/Graphics/Platforms/iOS/PlatformImage.cs @@ -90,12 +90,25 @@ public IImage Resize(float width, float height, ResizeMode resizeMode = ResizeMo public UIImage PlatformRepresentation => _image; + /// + /// Saves the contents of this image to the provided object. + /// + /// The destination stream the bytes of this image will be saved to. + /// The destination format of the image. + /// The destination quality of the image. + /// Thrown when is less than 0 or more than 1. + /// Thrown when this image has no data. + /// + /// Only and are supported on this platform. + /// Setting is only supported for images with . + /// public void Save(Stream stream, ImageFormat format = ImageFormat.Png, float quality = 1) { var data = CreateData(format, quality); data.AsStream().CopyTo(stream); } + /// public async Task SaveAsync(Stream stream, ImageFormat format = ImageFormat.Png, float quality = 1) { var data = CreateData(format, quality);