Documentation ¶
Overview ¶
Package coding implements low-level QR coding details.
Index ¶
Constants ¶
const MaxVersion = 40
const MinVersion = 1
Variables ¶
var Field = gf256.NewField(0x11d, 2)
Field is the field for QR error correction.
Functions ¶
This section is empty.
Types ¶
type Alpha ¶
type Alpha string
Alpha is the encoding for alphanumeric data. The valid characters are 0-9A-Z$%*+-./: and space.
type Bits ¶
type Bits struct {
// contains filtered or unexported fields
}
func (*Bits) AddCheckBytes ¶
type Code ¶
type Code struct { Bitmap []byte // 1 is black, 0 is white Size int // number of pixels on a side Stride int // number of bytes per row }
A Code is a square pixel grid.
type Encoding ¶
Charset implements a QR data encoding scheme. The implementations--Numeric, Alphanumeric, and String--specify the character set and the mapping from UTF-8 to code bits. The more restrictive the mode, the fewer code bits are needed.
type Level ¶
type Level int
A Level represents a QR error correction level. From least to most tolerant of errors, they are L, M, Q, H.
type Mask ¶
type Mask int
A Mask describes a mask that is applied to the QR code to avoid QR artifacts being interpreted as alignment and timing patterns (such as the squares in the corners). Valid masks are integers from 0 to 7.
type Num ¶
type Num string
Num is the encoding for numeric data. The only valid characters are the decimal digits 0 through 9.
type PixelRole ¶
type PixelRole uint32
A PixelRole describes the role of a QR pixel.
const ( Position PixelRole // position squares (large) Alignment // alignment squares (small) Timing // timing strip between position squares Format // format metadata PVersion // version pattern Unused // unused pixel Data // data bit Check // error correction check bit Extra )
type Plan ¶
type Plan struct { Version Version Level Level Mask Mask DataBytes int // number of data bytes CheckBytes int // number of error correcting (checksum) bytes Blocks int // number of data blocks Pixel [][]Pixel // pixel map }
A Plan describes how to construct a QR code with a specific version, level, and mask.
type Version ¶
type Version int
A Version represents a QR version. The version specifies the size of the QR code: a QR code with version v has 4v+17 pixels on a side. Versions number from 1 to 40: the larger the version, the more information the code can store.