Skip to content

Commit 0deb7f3

Browse files
committed
Added ZXing Poc
1 parent 54c0a43 commit 0deb7f3

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

GithubActionsHelloWorld/GithubActionsHelloWorld.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
<ItemGroup>
2222
<PackageReference Include="GitInfo" Version="2.2.0" />
23+
<PackageReference Include="SixLabors.ImageSharp" Version="2.0.0" />
24+
<PackageReference Include="ZXing.Net" Version="0.16.8" />
2325
</ItemGroup>
2426

2527
</Project>

GithubActionsHelloWorld/Program.cs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,32 @@
1-
using System;
1+
using SixLabors.ImageSharp;
2+
using SixLabors.ImageSharp.PixelFormats;
23
using System.Threading.Tasks;
4+
using ZXing.Common;
5+
using ZXing.Rendering;
36

47
namespace GithubActionsHelloWorld
58
{
69
public class Program
710
{
8-
public async static Task Main(string[] args)
11+
public static async Task Main(string[] args)
912
{
10-
await Task.Delay(100);
11-
Console.WriteLine("Hello World!");
13+
var barcodeWriter = new ZXing.BarcodeWriterPixelData
14+
{
15+
Format = ZXing.BarcodeFormat.CODE_128,
16+
Options = new EncodingOptions
17+
{
18+
Height = 300,
19+
Width = 300,
20+
},
21+
Renderer = new PixelDataRenderer
22+
{
23+
}
24+
};
25+
26+
var pixelData = barcodeWriter.Write("Hallo Barcode");
27+
28+
using (var image = Image.LoadPixelData<Rgba32>(pixelData.Pixels, 300, 300))
29+
await image.SaveAsBmpAsync("barcode.bmp");
1230
}
1331
}
1432
}

0 commit comments

Comments
 (0)