From 31836f5b56e513ec10094424394725029b1e757b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Apr 2024 03:15:58 +0000 Subject: [PATCH 1/2] Bump SixLabors.ImageSharp from 2.1.7 to 3.1.4 Bumps [SixLabors.ImageSharp](https://github.com/SixLabors/ImageSharp) from 2.1.7 to 3.1.4. - [Release notes](https://github.com/SixLabors/ImageSharp/releases) - [Commits](https://github.com/SixLabors/ImageSharp/compare/v2.1.7...v3.1.4) --- updated-dependencies: - dependency-name: SixLabors.ImageSharp dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- src/Directory.Build.targets | 2 +- src/MilkiBotFramework/MilkiBotFramework.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 9a9b7a5..19ccff9 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -1,6 +1,6 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/MilkiBotFramework/MilkiBotFramework.csproj b/src/MilkiBotFramework/MilkiBotFramework.csproj index 0726ab3..e659872 100644 --- a/src/MilkiBotFramework/MilkiBotFramework.csproj +++ b/src/MilkiBotFramework/MilkiBotFramework.csproj @@ -14,7 +14,7 @@ - + From 5b2dbed3ff7bb4f8f8ea0072296484a42430c2f9 Mon Sep 17 00:00:00 2001 From: Milkitic Date: Mon, 22 Apr 2024 11:31:01 +0800 Subject: [PATCH 2/2] Fix compile --- .../WpfDrawingProcessor.cs | 2 +- src/MilkiBotFramework/Imaging/ImageHelper.cs | 31 +++++++------------ 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/src/MilkiBotFramework.Imaging.Wpf/WpfDrawingProcessor.cs b/src/MilkiBotFramework.Imaging.Wpf/WpfDrawingProcessor.cs index cecedea..0f1dcf6 100644 --- a/src/MilkiBotFramework.Imaging.Wpf/WpfDrawingProcessor.cs +++ b/src/MilkiBotFramework.Imaging.Wpf/WpfDrawingProcessor.cs @@ -68,7 +68,7 @@ await Application.Current.Dispatcher.InvokeAsync(async () => try { - return await Image.LoadAsync(retStream, new PngDecoder()); + return await PngDecoder.Instance.DecodeAsync(new PngDecoderOptions(), retStream); } finally { diff --git a/src/MilkiBotFramework/Imaging/ImageHelper.cs b/src/MilkiBotFramework/Imaging/ImageHelper.cs index 6cb5b18..c4f8d06 100644 --- a/src/MilkiBotFramework/Imaging/ImageHelper.cs +++ b/src/MilkiBotFramework/Imaging/ImageHelper.cs @@ -136,7 +136,7 @@ public static Image GetResizedImage(Image source, float uniformScaleRate) public static Image GetRotatedImage(Image source, float angle, bool crop = false, Size resize = default) { - if (resize == Size.Empty) resize = source.Size(); + if (resize == Size.Empty) resize = source.Size; var returnBitmap = source .Clone(k => k @@ -169,7 +169,7 @@ public static Image GetRotatedImage(Image source, float angle, bool crop = false public static Image GetTranslatedBitmap(Image source, int x, int y, Size resize = default) { - if (resize == Size.Empty) resize = source.Size(); + if (resize == Size.Empty) resize = source.Size; var returnBitmap = source .Clone(k => k .AutoOrient() @@ -191,25 +191,18 @@ public static async Task SaveGifToFileAsync(string path, Image gif, Color[]? pal gif.Mutate(k => k.Quantize()); var encoder = new GifEncoder { - ColorTableMode = GifColorTableMode.Global, - GlobalPixelSamplingStrategy = new ExtensivePixelSamplingStrategy(), - Quantizer = new OctreeQuantizer(new QuantizerOptions - { - DitherScale = QuantizerConstants.MinDitherScale, - }) - }; - - if (palettes != null) - { - encoder.ColorTableMode = GifColorTableMode.Local; - encoder.Quantizer = new PaletteQuantizer(new ReadOnlyMemory(palettes), - new QuantizerOptions + ColorTableMode = palettes == null ? GifColorTableMode.Global : GifColorTableMode.Local, + PixelSamplingStrategy = new ExtensivePixelSamplingStrategy(), + Quantizer = palettes == null + ? new OctreeQuantizer(new QuantizerOptions { DitherScale = QuantizerConstants.MinDitherScale - } - ); - } - + }) + : new PaletteQuantizer(new ReadOnlyMemory(palettes), new QuantizerOptions + { + DitherScale = QuantizerConstants.MinDitherScale + }) + }; await gif.SaveAsGifAsync(path, encoder); }