AnointedAutomation.Algorithms
1.0.2
See the version list below for details.
dotnet add package AnointedAutomation.Algorithms --version 1.0.2
NuGet\Install-Package AnointedAutomation.Algorithms -Version 1.0.2
<PackageReference Include="AnointedAutomation.Algorithms" Version="1.0.2" />
<PackageVersion Include="AnointedAutomation.Algorithms" Version="1.0.2" />
<PackageReference Include="AnointedAutomation.Algorithms" />
paket add AnointedAutomation.Algorithms --version 1.0.2
#r "nuget: AnointedAutomation.Algorithms, 1.0.2"
#:package AnointedAutomation.Algorithms@1.0.2
#addin nuget:?package=AnointedAutomation.Algorithms&version=1.0.2
#tool nuget:?package=AnointedAutomation.Algorithms&version=1.0.2
AnointedAutomation.Algorithms
Reusable algorithms with no dependencies for the AnointedAutomation suite. Today it ships a pure C# QR code encoder (ISO/IEC 18004) with Reed-Solomon error correction, for developers who need QR codes without pulling in a native or third party imaging library.
Installation
dotnet add package AnointedAutomation.Algorithms
- Target framework:
net10.0 - Dependencies: none
Quick start
using System;
using AnointedAutomation.Algorithms.QrCode;
QrMatrix matrix = QrEncoder.Encode("https://store.anointed.company", QrErrorCorrectionLevel.M);
for (int y = 0; y < matrix.Size; y++)
{
for (int x = 0; x < matrix.Size; x++)
{
Console.Write(matrix.IsDark(x, y) ? "##" : " ");
}
Console.WriteLine();
}
To turn the matrix into an SVG or PNG, add AnointedAutomation.Imaging.
API overview
Namespace: AnointedAutomation.Algorithms.QrCode
| Type | Kind | Purpose |
|---|---|---|
QrEncoder |
static class | QrMatrix Encode(string text, QrErrorCorrectionLevel ecc = QrErrorCorrectionLevel.M) encodes UTF-8 text into a QR symbol. |
QrMatrix |
sealed class | The encoded symbol. int Size is the module count per side; bool IsDark(int x, int y) reads one module. |
QrErrorCorrectionLevel |
enum | L (~7% recovery), M (~15%), Q (~25%), H (~30%). |
What Encode does for you:
- Byte mode (the input is encoded as UTF-8).
- Automatic version selection: the smallest version from 1 to 10 that fits the data.
- Reed-Solomon error correction with block interleaving.
- Finder, timing and alignment patterns, plus format and version information (BCH coded).
- Automatic mask selection using the four ISO/IEC 18004 penalty rules.
Galois field arithmetic, the Reed-Solomon encoder, mask scoring and the version tables are internal implementation details, not public API.
Capacity and errors
Versions 1 to 10 are supported (up to 57 x 57 modules). The maximum payload, in UTF-8 bytes, is:
| Level | Max bytes |
|---|---|
L |
271 |
M |
213 |
Q |
151 |
H |
119 |
Encode throws ArgumentNullException when text is null and ArgumentException when the text does not fit any supported version. That comfortably covers URLs and short text.
Related packages
- AnointedAutomation.Imaging: renders a
QrMatrixto SVG or PNG.
License
MIT. See LICENSE. Copyright © Anointed Automation, LLC. Stewarded by Alexander Fields.
Support This Project
This library is free and open source. The best way to support the work is to shop with us:
- Christian items: https://store.anointed.company
- Everything else: https://www.mart.club
Found a bug or have a request? Open an issue: https://github.com/AnointedAutomation/AnointedAutomation/issues
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on AnointedAutomation.Algorithms:
| Package | Downloads |
|---|---|
|
AnointedAutomation.Imaging
Renders QR codes from AnointedAutomation.Algorithms to SVG and PNG using only the .NET base class library, with no third party image dependency. |
GitHub repositories
This package is not used by any popular GitHub repositories.