Skip to content

Commit

Permalink
Bump Dependencies
Browse files Browse the repository at this point in the history
Bump ImageSharp and SkiaSharp dependencies.
  • Loading branch information
primo-ppcg committed Apr 23, 2024
1 parent a6ea70a commit 5dd11da
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/BinaryKits.Zpl.Label/BinaryKits.Zpl.Label.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<ItemGroup>
<PackageReference Include="SixLabors.ImageSharp">
<Version>2.1.3</Version>
<Version>2.1.8</Version>
</PackageReference>
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/BinaryKits.Zpl.Protocol/BinaryKits.Zpl.Protocol.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<ItemGroup>
<PackageReference Include="SixLabors.ImageSharp">
<Version>1.0.4</Version>
<Version>2.1.8</Version>
</PackageReference>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public ImageResult ConvertImage(byte[] imageData)
{
var zplBuilder = new StringBuilder();

using (Image<Rgba32> image = Image.Load(imageData))
using (Image<Rgba32> image = Image.Load(imageData).CloneAs<Rgba32>())
{
var bytesPerRow = image.Width % 8 > 0
? image.Width / 8 + 1
Expand All @@ -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)
Expand Down Expand Up @@ -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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.3" />
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.8" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.1" />
</ItemGroup>

Expand Down
8 changes: 4 additions & 4 deletions src/BinaryKits.Zpl.Viewer/BinaryKits.Zpl.Viewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@

<ItemGroup>
<PackageReference Include="BarcodeLib" Version="2.4.0" />
<PackageReference Include="SkiaSharp" Version="2.88.6" />
<PackageReference Include="SkiaSharp.HarfBuzz" Version="2.88.3" />
<PackageReference Include="SkiaSharp" Version="2.88.8" />
<PackageReference Include="SkiaSharp.HarfBuzz" Version="2.88.8" />
<PackageReference Include="ZXing.Net" Version="0.16.9" />
</ItemGroup>

<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Linux'))">
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.3" />
<PackageReference Include="HarfBuzzSharp.NativeAssets.Linux" Version="2.8.2.3" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.8" />
<PackageReference Include="HarfBuzzSharp.NativeAssets.Linux" Version="7.3.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 5dd11da

Please sign in to comment.