Skip to content

Commit

Permalink
Merge branch 'release/3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
huysentruitw committed Jun 13, 2024
2 parents 2e299e7 + b736045 commit ce4abc8
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 34 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build-test-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -63,7 +66,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))
{
Expand Down
6 changes: 3 additions & 3 deletions src/Barcoder.Renderer.Image/Barcoder.Renderer.Image.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<Title>Barcoder.Renderer.Image</Title>
<Description>Image Renderer for Barcoder (.NET Framework, .NET Standard and .NET Core).</Description>
<Description>Image Renderer for Barcoder (.NET6, .NET8).</Description>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Company>Wouter Huysentruit</Company>
<Version>1.0.0.0</Version>
Expand All @@ -16,7 +16,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta14" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.1.3" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Barcoder.Renderer.Image/Internal/EanContentRenderer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Numerics;
using System.Numerics;
using SixLabors.Fonts;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Drawing.Processing;
Expand Down Expand Up @@ -68,7 +68,7 @@ private static void RenderWhiteRect(Image<L8> image, int x, int y, int width, in

private static void RenderBlackText(Image<L8> 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,
Expand Down
2 changes: 1 addition & 1 deletion src/Barcoder.Renderer.Svg/Barcoder.Renderer.Svg.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SvgLib" Version="1.0.0.1" />
<PackageReference Include="SvgLib" Version="1.0.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta14" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.1.3" />
<PackageReference Include="xunit" Version="2.8.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
8 changes: 4 additions & 4 deletions tests/Barcoder.Renderer.Image.Tests/ImageRendererTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand All @@ -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");
}

Expand All @@ -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");
}

Expand All @@ -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");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand All @@ -17,11 +17,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.8.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
10 changes: 5 additions & 5 deletions tests/Barcoder.Tests/Barcoder.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="xunit" Version="2.8.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down

0 comments on commit ce4abc8

Please sign in to comment.