From 5dd11da30ee685e7e2d4a834bb38ac653229c408 Mon Sep 17 00:00:00 2001 From: primo-ppcg Date: Tue, 23 Apr 2024 13:23:04 +0700 Subject: [PATCH] Bump Dependencies Bump ImageSharp and SkiaSharp dependencies. --- src/BinaryKits.Zpl.Label/BinaryKits.Zpl.Label.csproj | 2 +- .../BinaryKits.Zpl.Protocol.csproj | 2 +- .../ImageConverters/ImageSharpImageConverter.cs | 9 +++------ .../BinaryKits.Zpl.Viewer.WebApi.csproj | 2 +- src/BinaryKits.Zpl.Viewer/BinaryKits.Zpl.Viewer.csproj | 8 ++++---- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/BinaryKits.Zpl.Label/BinaryKits.Zpl.Label.csproj b/src/BinaryKits.Zpl.Label/BinaryKits.Zpl.Label.csproj index 4b0d6e6b..4fdef396 100644 --- a/src/BinaryKits.Zpl.Label/BinaryKits.Zpl.Label.csproj +++ b/src/BinaryKits.Zpl.Label/BinaryKits.Zpl.Label.csproj @@ -23,7 +23,7 @@ - 2.1.3 + 2.1.8 diff --git a/src/BinaryKits.Zpl.Protocol/BinaryKits.Zpl.Protocol.csproj b/src/BinaryKits.Zpl.Protocol/BinaryKits.Zpl.Protocol.csproj index 7ffbca2b..ba853ad0 100644 --- a/src/BinaryKits.Zpl.Protocol/BinaryKits.Zpl.Protocol.csproj +++ b/src/BinaryKits.Zpl.Protocol/BinaryKits.Zpl.Protocol.csproj @@ -23,7 +23,7 @@ - 1.0.4 + 2.1.8 diff --git a/src/BinaryKits.Zpl.Protocol/ImageConverters/ImageSharpImageConverter.cs b/src/BinaryKits.Zpl.Protocol/ImageConverters/ImageSharpImageConverter.cs index 960a92ab..57be227a 100644 --- a/src/BinaryKits.Zpl.Protocol/ImageConverters/ImageSharpImageConverter.cs +++ b/src/BinaryKits.Zpl.Protocol/ImageConverters/ImageSharpImageConverter.cs @@ -17,7 +17,7 @@ public ImageResult ConvertImage(byte[] imageData) { var zplBuilder = new StringBuilder(); - using (Image image = Image.Load(imageData)) + using (Image image = Image.Load(imageData).CloneAs()) { var bytesPerRow = image.Width % 8 > 0 ? image.Width / 8 + 1 @@ -30,11 +30,9 @@ public ImageResult ConvertImage(byte[] imageData) for (var y = 0; y < image.Height; y++) { - var row = image.GetPixelRowSpan(y); - for (var x = 0; x < image.Width; x++) { - var pixel = row[x]; + var pixel = image[x, y]; var isBlackPixel = ((pixel.R + pixel.G + pixel.B) / 3) < 128; if (isBlackPixel) @@ -88,14 +86,13 @@ public byte[] ConvertImage(byte[] imageData, int bytesPerRow) { for (var y = 0; y < image.Height; y++) { - var row = image.GetPixelRowSpan(y); var bits = new BitArray(imageData.Skip(bytesPerRow * y).Take(bytesPerRow).ToArray()); for (var x = 0 ; x < image.Width; x++) { if (bits[x]) { - row[x].A = 255; + image[x, y] = new Rgba32(0, 0, 0, 255); } } } diff --git a/src/BinaryKits.Zpl.Viewer.WebApi/BinaryKits.Zpl.Viewer.WebApi.csproj b/src/BinaryKits.Zpl.Viewer.WebApi/BinaryKits.Zpl.Viewer.WebApi.csproj index 7c9e11eb..a356bd39 100644 --- a/src/BinaryKits.Zpl.Viewer.WebApi/BinaryKits.Zpl.Viewer.WebApi.csproj +++ b/src/BinaryKits.Zpl.Viewer.WebApi/BinaryKits.Zpl.Viewer.WebApi.csproj @@ -5,7 +5,7 @@ - + diff --git a/src/BinaryKits.Zpl.Viewer/BinaryKits.Zpl.Viewer.csproj b/src/BinaryKits.Zpl.Viewer/BinaryKits.Zpl.Viewer.csproj index 4debec17..da5b76d4 100644 --- a/src/BinaryKits.Zpl.Viewer/BinaryKits.Zpl.Viewer.csproj +++ b/src/BinaryKits.Zpl.Viewer/BinaryKits.Zpl.Viewer.csproj @@ -23,14 +23,14 @@ - - + + - - + +