Documentation
¶
Overview ¶
Package qr encodes bytes as a QR code symbol: the modules, not an image, so that whatever draws it -- an SVG path, a terminal, a PNG -- decides how.
It writes byte mode only, versions 1 to MaxVersion, at any of the four error correction levels, and chooses the mask the standard's penalty rules prefer. That covers what it was written for, a BankID payload of about a hundred bytes, and anything else of that size; it refuses rather than truncates what does not fit.
The module layout follows ISO/IEC 18004. The tests hold it to libqrencode's output for the same data, level and mask, module for module.
Index ¶
Constants ¶
const MaxVersion = 10
MaxVersion is the largest symbol this package draws: 57 modules a side, enough for 213 bytes at LevelM and well past a BankID payload's 108. The larger versions differ only in their tables, which are left out until something needs them.
Variables ¶
var ErrDataTooLong = errors.New("data too long")
ErrDataTooLong is returned for data that no version up to MaxVersion holds at the level asked for.
Functions ¶
This section is empty.
Types ¶
type Code ¶
type Code struct {
Version int
Level Level
// Mask is the mask pattern applied, 0 to 7.
Mask int
// Size is the number of modules a side.
Size int
// contains filtered or unexported fields
}
Code is an encoded symbol.