From ae7a5ce204367a6227b70285338e3f922d633197 Mon Sep 17 00:00:00 2001 From: huysentruitw Date: Mon, 28 Nov 2022 20:03:46 +0100 Subject: [PATCH 1/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8619f7c..03ae2b2 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Example for rendering to PNG: ```csharp var barcode = QrEncoder.Encode("Hello World!"); -var renderer = new ImageRenderer(imageFormat: ImageFormat.Png); +var renderer = new ImageRenderer(new ImageRendererOptions { ImageFormat = ImageFormat.Png }); using (var stream = new FileStream("output.png", FileMode.Create)) { From 16a7fc3a3e7f3dce4b3e23c95f68301527186139 Mon Sep 17 00:00:00 2001 From: Wouter Huysentruit Date: Thu, 13 Jun 2024 07:59:16 +0200 Subject: [PATCH 2/5] Update test-dependencies --- .../Barcoder.Renderer.Image.Tests.csproj | 12 ++++++------ .../Barcoder.Renderer.Svg.Tests.csproj | 12 ++++++------ tests/Barcoder.Tests/Barcoder.Tests.csproj | 10 +++++----- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/Barcoder.Renderer.Image.Tests/Barcoder.Renderer.Image.Tests.csproj b/tests/Barcoder.Renderer.Image.Tests/Barcoder.Renderer.Image.Tests.csproj index 46633a1..b2dc89d 100644 --- a/tests/Barcoder.Renderer.Image.Tests/Barcoder.Renderer.Image.Tests.csproj +++ b/tests/Barcoder.Renderer.Image.Tests/Barcoder.Renderer.Image.Tests.csproj @@ -1,18 +1,18 @@  - net5.0 + net8.0 latest false - - - + + + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/Barcoder.Renderer.Svg.Tests/Barcoder.Renderer.Svg.Tests.csproj b/tests/Barcoder.Renderer.Svg.Tests/Barcoder.Renderer.Svg.Tests.csproj index e9647e7..e245bdb 100644 --- a/tests/Barcoder.Renderer.Svg.Tests/Barcoder.Renderer.Svg.Tests.csproj +++ b/tests/Barcoder.Renderer.Svg.Tests/Barcoder.Renderer.Svg.Tests.csproj @@ -1,7 +1,7 @@ - net5.0 + net8.0 latest false @@ -17,11 +17,11 @@ - - - - - + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/Barcoder.Tests/Barcoder.Tests.csproj b/tests/Barcoder.Tests/Barcoder.Tests.csproj index 1b3079d..783d950 100644 --- a/tests/Barcoder.Tests/Barcoder.Tests.csproj +++ b/tests/Barcoder.Tests/Barcoder.Tests.csproj @@ -1,16 +1,16 @@  - net5.0 + net8.0 latest false - - - - + + + + all runtime; build; native; contentfiles; analyzers From 674e95f21594c088dfb71b24514f13d27cbac570 Mon Sep 17 00:00:00 2001 From: Wouter Huysentruit Date: Thu, 13 Jun 2024 08:01:12 +0200 Subject: [PATCH 3/5] Update build-test-publish.yml --- .github/workflows/build-test-publish.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish.yml index 70ddfb2..ca7dffb 100644 --- a/.github/workflows/build-test-publish.yml +++ b/.github/workflows/build-test-publish.yml @@ -14,20 +14,20 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Fetch all history for all tags and branches run: git fetch --prune --unshallow - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v0.9.11 + uses: gittools/actions/gitversion/setup@v1.1.1 with: versionSpec: '5.x' - name: Use GitVersion id: gitversion # step id used as reference for output values - uses: gittools/actions/gitversion/execute@v0.9.11 - - name: Setup .NET 5 + uses: gittools/actions/gitversion/execute@v1.1.1 + - name: Setup .NET 8 uses: actions/setup-dotnet@v1 with: - dotnet-version: 5.0.302 + dotnet-version: '8.x' - name: Install dependencies run: dotnet restore - name: Build From 091e010945b36224159d32c6218927a2a602750a Mon Sep 17 00:00:00 2001 From: Wouter Huysentruit Date: Thu, 13 Jun 2024 08:23:05 +0200 Subject: [PATCH 4/5] Update SvgLib dependency --- src/Barcoder.Renderer.Svg/Barcoder.Renderer.Svg.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Barcoder.Renderer.Svg/Barcoder.Renderer.Svg.csproj b/src/Barcoder.Renderer.Svg/Barcoder.Renderer.Svg.csproj index 262a8b2..52b6486 100644 --- a/src/Barcoder.Renderer.Svg/Barcoder.Renderer.Svg.csproj +++ b/src/Barcoder.Renderer.Svg/Barcoder.Renderer.Svg.csproj @@ -15,7 +15,7 @@ - + From b736045b9b689dc32121de3548e7e3af9e96ad4e Mon Sep 17 00:00:00 2001 From: Wouter Huysentruit Date: Thu, 13 Jun 2024 08:37:27 +0200 Subject: [PATCH 5/5] Update ImageSharp to 2.1.x --- README.md | 3 +++ .../Barcoder.Renderer.Image.csproj | 6 +++--- .../Internal/EanContentRenderer.cs | 4 ++-- .../Barcoder.Renderer.Image.Tests.csproj | 2 +- tests/Barcoder.Renderer.Image.Tests/ImageRendererTests.cs | 8 ++++---- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 03ae2b2..f0b6e41 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,9 @@ Lightweight Barcode Encoding Library for .NET Framework, .NET Standard and .NET Core. Additional packages are available for rendering the generated barcode to SVG or an image. +Please note that the image renderer (`Barcoder.Renderer.Image`) requires .NET6 or .NET8 because of the dependency on `SixLabors.ImageSharp.Drawing` and no longer works for .NET Framework. +However, feel free to create your own renderer with another version or other image generation library. + Code ported from the GO project https://github.com/boombuler/barcode by [Florian Sundermann](https://github.com/boombuler). Supported Barcode Types: diff --git a/src/Barcoder.Renderer.Image/Barcoder.Renderer.Image.csproj b/src/Barcoder.Renderer.Image/Barcoder.Renderer.Image.csproj index 6790125..67b1368 100644 --- a/src/Barcoder.Renderer.Image/Barcoder.Renderer.Image.csproj +++ b/src/Barcoder.Renderer.Image/Barcoder.Renderer.Image.csproj @@ -1,9 +1,9 @@  - net472;netstandard2.0 + net6.0;net8.0 Barcoder.Renderer.Image - Image Renderer for Barcoder (.NET Framework, .NET Standard and .NET Core). + Image Renderer for Barcoder (.NET6, .NET8). true Wouter Huysentruit 1.0.0.0 @@ -16,7 +16,7 @@ - + diff --git a/src/Barcoder.Renderer.Image/Internal/EanContentRenderer.cs b/src/Barcoder.Renderer.Image/Internal/EanContentRenderer.cs index 1985ab0..ab35042 100644 --- a/src/Barcoder.Renderer.Image/Internal/EanContentRenderer.cs +++ b/src/Barcoder.Renderer.Image/Internal/EanContentRenderer.cs @@ -1,4 +1,4 @@ -using System.Numerics; +using System.Numerics; using SixLabors.Fonts; using SixLabors.ImageSharp; using SixLabors.ImageSharp.Drawing.Processing; @@ -68,7 +68,7 @@ private static void RenderWhiteRect(Image image, int x, int y, int width, in private static void RenderBlackText(Image image, string text, float x, float y, Font font) { - var options = new TextOptions(font) + var options = new RichTextOptions(font) { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, diff --git a/tests/Barcoder.Renderer.Image.Tests/Barcoder.Renderer.Image.Tests.csproj b/tests/Barcoder.Renderer.Image.Tests/Barcoder.Renderer.Image.Tests.csproj index b2dc89d..dc9376a 100644 --- a/tests/Barcoder.Renderer.Image.Tests/Barcoder.Renderer.Image.Tests.csproj +++ b/tests/Barcoder.Renderer.Image.Tests/Barcoder.Renderer.Image.Tests.csproj @@ -10,7 +10,7 @@ - + all diff --git a/tests/Barcoder.Renderer.Image.Tests/ImageRendererTests.cs b/tests/Barcoder.Renderer.Image.Tests/ImageRendererTests.cs index 154438b..d1665c8 100644 --- a/tests/Barcoder.Renderer.Image.Tests/ImageRendererTests.cs +++ b/tests/Barcoder.Renderer.Image.Tests/ImageRendererTests.cs @@ -85,7 +85,7 @@ public void Render_ImageFormatBmp_ShouldRenderBmp() // Assert stream.Position = 0; - using var image = ImageSharp.Image.Load(stream, out IImageFormat imageFormat); + IImageFormat imageFormat = ImageSharp.Image.DetectFormat(stream); imageFormat.Name.Should().Be("BMP"); } @@ -102,7 +102,7 @@ public void Render_ImageFormatGif_ShouldRenderGif() // Assert stream.Position = 0; - using var image = ImageSharp.Image.Load(stream, out IImageFormat imageFormat); + IImageFormat imageFormat = ImageSharp.Image.DetectFormat(stream); imageFormat.Name.Should().Be("GIF"); } @@ -119,7 +119,7 @@ public void Render_ImageFormatJpeg_ShouldRenderJpeg() // Assert stream.Position = 0; - using var image = ImageSharp.Image.Load(stream, out IImageFormat imageFormat); + IImageFormat imageFormat = ImageSharp.Image.DetectFormat(stream); imageFormat.Name.Should().Be("JPEG"); } @@ -136,7 +136,7 @@ public void Render_ImageFormatPng_ShouldRenderPng() // Assert stream.Position = 0; - using var image = ImageSharp.Image.Load(stream, out IImageFormat imageFormat); + IImageFormat imageFormat = ImageSharp.Image.DetectFormat(stream); imageFormat.Name.Should().Be("PNG"); }