You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+9-10Lines changed: 9 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,13 @@
1
1
# CLAUDE.md
2
2
3
-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
-
5
3
## Purpose
6
4
7
-
QrCodeGenerator is library to generate QR code. It is designed to be easy to use and performant.
5
+
QrCodeGenerator is a library to generate QR code. It is designed to be easy to use and performant.
8
6
9
7
The library only supports limited graphics types and options in order to work without
10
-
graphics libraries, which might not run all platforms.
11
-
The library can provide the QR code as a two-dimensional array of pixels (called modules by the QR code standard).
12
-
It is then up to the application to display the QR code based on this information.
8
+
any graphics libraries, which might not run all platforms.
9
+
The library can provide the QR code as a list of rectangles or as a two-dimensional array of pixels
10
+
(called modules by the QR code standard). It is then up to the application to display the QR code.
13
11
Many demo projects show how to use this approach for different graphics libraries and UI frameworks.
14
12
15
13
The main target of the library is .NET Standard 2.0 so it runs in virtually any current .NET environment.
@@ -38,15 +36,16 @@ dotnet pack --no-build
38
36
## Build targets
39
37
40
38
-**`QrCodeGenerator/`** (the library) targets `netstandard2.0;net6.0`. The `net6.0` target exists only to enable trimming (`IsTrimmable`). Keep public API and language usage compatible with netstandard2.0 — don't reach for newer BCL/`Span` APIs that aren't available there.
41
-
-**`QrCodeGeneratorTest/`** targets `net8.0;net10.0`, plus `net481` on Windows. `dotnet test` runs every target framework.
39
+
-**`QrCodeGeneratorTest/`**(the unit tests) targets `net8.0;net10.0`, plus `net481` on Windows. `dotnet test` runs every target framework.
-**`QrCodeAnalyzer/`** is a separate WPF tool in its own solution (`QrCodeAnalyzer/QrCodeAnalyzer.sln`), not part of `QrCodeGenerator.sln`.
44
42
45
-
Version 3 is a complete rewrite (≈10x faster, more standard-compliant) of what began as a port of Project Nayuki's Java library.
46
43
47
44
## Architecture
48
45
49
-
`QrCode` is the only substantial public surface: immutable factory methods (`EncodeText`, `EncodeTextAdvanced`, `EncodeBinary`, `EncodeSegments`, `EncodeTextInMultipleCodes`) plus rendering (`ToSvgString`, `ToGraphicsPath`, `ToPngBitmap`, `ToBmpBitmap`, `ToRectangles`, `GetModule`). It holds a single `BitMatrix` of modules. Almost all real work lives in `internal` types. The one other public type is the `QrRectangle` value struct returned by `ToRectangles`.
46
+
`QrCode` is the only substantial public surface: factory methods create immutable `QrCode` instances. They can be rendered to
47
+
sVG, PNG, BMP or a list of rectangles. It holds a single `BitMatrix` of modules. Almost all real work lives in `internal` types.
48
+
50
49
51
50
### Encoding pipeline
52
51
@@ -59,7 +58,7 @@ Text/bytes → segments → codewords → matrix, in this order:
-**`Codewords.AddErrorCorrection`** — splits into blocks, computes Reed-Solomon ECC (`ReedSolomon`), interleaves data and ECC codewords per spec.
61
60
-**`MatrixEncoder.Encode`** — matrix layout then mask selection:
62
-
-`FixedPatterns.BuildFixedPatterns`is the single source of truth for the fixed-pattern geometry of a version: one walk emits both the *drawn* matrix (finder/timing/alignment/version) and the *reserved-module* mask, which cannot be derived from each other (a footprint reserves light modules too). Format info is reserve-only here. The reserved mask, inverted, is the *payload-area map* (`GetPayloadAreaMap`). Then `FillPayload` zig-zags the codewords into the free modules.
61
+
-`FixedPatterns.BuildFixedPatterns`deals with the fixed-pattern geometry of a version: one walk emits both the *drawn* matrix (finder/timing/alignment/version) and the *reserved-module* mask. The reserved mask, inverted, is the *payload-area map* (`GetPayloadAreaMap`). Then `FillPayload` zig-zags the codewords into the free modules.
63
62
-`ApplyBestPattern` — XORs each of the 8 mask patterns, scores it (`Penalty`), keeps the lowest, and draws the format information. `EncodingInfo.ForcedDataMask` can override the choice.
64
63
65
64
The ISO/IEC 18004 lookup tables these stages share live in **`QrCodeParameters`**.
0 commit comments