package coding

Import Path
	rsc.io/qr/coding (on go.dev)

Dependency Relation
	imports 4 packages, and imported by one package

Involved Source Files Package coding implements low-level QR coding details.
Package-Level Type Names (total 14, in which 12 are exported)
/* sort exporteds by: | */
Alpha is the encoding for alphanumeric data. The valid characters are 0-9A-Z$%*+-./: and space. ( Alpha) Bits(v Version) int ( Alpha) Check() error ( Alpha) Encode(b *Bits, v Version) ( Alpha) String() string Alpha : Encoding Alpha : fmt.Stringer
(*Bits) AddCheckBytes(v Version, l Level) (*Bits) Append(p []byte) (*Bits) Bits() int (*Bits) Bytes() []byte (*Bits) Pad(n int) (*Bits) Reset() (*Bits) Write(v uint, nbit int) func Alpha.Encode(b *Bits, v Version) func Encoding.Encode(b *Bits, v Version) func Num.Encode(b *Bits, v Version) func String.Encode(b *Bits, v Version)
A Code is a square pixel grid. // 1 is black, 0 is white // number of pixels on a side // number of bytes per row (*Code) Black(x, y int) bool func (*Plan).Encode(text ...Encoding) (*Code, error)
Encoding 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. ( Encoding) Bits(v Version) int ( Encoding) Check() error ( Encoding) Encode(b *Bits, v Version) Alpha Num String func (*Plan).Encode(text ...Encoding) (*Code, error)
A Level represents a QR error correction level. From least to most tolerant of errors, they are L, M, Q, H. ( Level) String() string Level : fmt.Stringer func NewPlan(version Version, level Level, mask Mask) (*Plan, error) func (*Bits).AddCheckBytes(v Version, l Level) func Version.DataBytes(l Level) int const H const L const M const Q
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. ( Mask) Invert(y, x int) bool func NewPlan(version Version, level Level, mask Mask) (*Plan, error)
Num is the encoding for numeric data. The only valid characters are the decimal digits 0 through 9. ( Num) Bits(v Version) int ( Num) Check() error ( Num) Encode(b *Bits, v Version) ( Num) String() string Num : Encoding Num : fmt.Stringer
A Pixel describes a single pixel in a QR code. ( Pixel) Offset() uint ( Pixel) Role() PixelRole ( Pixel) String() string Pixel : fmt.Stringer func OffsetPixel(o uint) Pixel func PixelRole.Pixel() Pixel const Black const Invert
A PixelRole describes the role of a QR pixel. ( PixelRole) Pixel() Pixel ( PixelRole) String() string PixelRole : fmt.Stringer func Pixel.Role() PixelRole const Alignment const Check const Data const Extra const Format const Position const PVersion const Timing const Unused
A Plan describes how to construct a QR code with a specific version, level, and mask. // number of data blocks // number of error correcting (checksum) bytes // number of data bytes Level Level Mask Mask // pixel map Version Version (*Plan) Encode(text ...Encoding) (*Code, error) func NewPlan(version Version, level Level, mask Mask) (*Plan, error)
String is the encoding for 8-bit data. All bytes are valid. ( String) Bits(v Version) int ( String) Check() error ( String) Encode(b *Bits, v Version) ( String) String() string String : Encoding String : fmt.Stringer
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. DataBytes returns the number of data bytes that can be stored in a QR code with the given version and level. ( Version) String() string Version : fmt.Stringer func NewPlan(version Version, level Level, mask Mask) (*Plan, error) func Alpha.Bits(v Version) int func Alpha.Encode(b *Bits, v Version) func (*Bits).AddCheckBytes(v Version, l Level) func Encoding.Bits(v Version) int func Encoding.Encode(b *Bits, v Version) func Num.Bits(v Version) int func Num.Encode(b *Bits, v Version) func String.Bits(v Version) int func String.Encode(b *Bits, v Version)
Package-Level Functions (total 9, in which 2 are exported)
NewPlan returns a Plan for a QR code with the given version, level, and mask.
Package-Level Variables (total 7, in which 1 is exported)
Field is the field for QR error correction.
Package-Level Constants (total 18, in which 17 are exported)
const Alignment PixelRole = 2 // alignment squares (small)
const Check PixelRole = 8 // error correction check bit
const Data PixelRole = 7 // data bit
const Format PixelRole = 4 // format metadata
const Position PixelRole = 1 // position squares (large)
const PVersion PixelRole = 5 // version pattern
const Timing PixelRole = 3 // timing strip between position squares
const Unused PixelRole = 6 // unused pixel