qr

package
v0.0.0-...-4182e66 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// bitBuffer errors.
	ErrBitBufValOutOfRange = errors.New("package qr: bitBuffer.appendBits: value out of range")

	// modeType errors.
	ErrModeTypeVerNumOutOfRange = errors.New("package qr: modeType.numCharCountBits: version number out of range")
)

Functions

This section is empty.

Types

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Represents an square grid of black and white cells for a QR Code symbol, and provides static functions to create a QR Code from user-supplied textual or binary data. This class covers the QR Code model 2 specification, supporting all versions (sizes) from 1 to 40, all 4 error correction levels, and only 3 character encoding modes.

func (*Generator) Draw

func (gen *Generator) Draw(margin int)

Draws generated QR Code to the terminal window.

func (*Generator) DrawImage

func (gen *Generator) DrawImage(path string, margin, pictureSize uint)

Draws generated QR Code and save it to a file.

func (*Generator) EncodeBinary

func (gen *Generator) EncodeBinary(data *[]uint8) Generator

Returns a QR Code symbol representing the given binary data string at the given error correction level.

This function always encodes using the binary segment mode, not any text mode. The maximum number of bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.

func (*Generator) EncodeText

func (gen *Generator) EncodeText(text string) Generator

Returns a QR Code symbol representing the specified Unicode text string at the specified error correction level.

As a conservative upper bound, this function is guaranteed to succeed for strings that have 2953 or fewer UTF-8 code units (not Unicode code points) if the low error correction level is used. The smallest possible QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.

func (*Generator) GetModules

func (gen *Generator) GetModules() [][]bool

Returns boolean matrix of modules of generated QR Code.

func (*Generator) ToSvg

func (gen *Generator) ToSvg(border int) (ret string, err error)

Returns svg string of generated QR Code.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL