qrencode

package
v0.0.0-...-ad8353b Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2017 License: LGPL-3.0 Imports: 5 Imported by: 23

Documentation

Overview

Package qrencode provides functions to generate QR codes.

Index

Examples

Constants

View Source
const (
	ECLevelM = ECLevel(0)
	ECLevelL = ECLevel(1)
	ECLevelH = ECLevel(2)
	ECLevelQ = ECLevel(3)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BitGrid

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

func Encode

func Encode(content string, ecLevel ECLevel) (*BitGrid, error)

QR encode the content at the specified error correction level (ecLevel).

Example
grid, err := Encode("Testing one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty.", ECLevelQ)
if err != nil {
	return
}
f, err := os.Create("/tmp/qr.png")
if err != nil {
	return
}
defer f.Close()
png.Encode(f, grid.Image(8))
Output:

func EncodeBytes

func EncodeBytes(content []byte, ecLevel ECLevel) (*BitGrid, error)

QR encode the content at the specified error correction level (ecLevel).

func NewBitGrid

func NewBitGrid(width, height int) *BitGrid

func (*BitGrid) Clear

func (g *BitGrid) Clear()

func (*BitGrid) Empty

func (g *BitGrid) Empty(x, y int) bool

func (*BitGrid) Get

func (g *BitGrid) Get(x, y int) bool

func (*BitGrid) Height

func (g *BitGrid) Height() int

func (*BitGrid) Image

func (g *BitGrid) Image(blockSize int) image.Image

Return an image of the grid, with black blocks for true items and white blocks for false items, with the given block size and a default margin.

func (*BitGrid) ImageWithMargin

func (g *BitGrid) ImageWithMargin(blockSize, margin int) image.Image

Return an image of the grid, with black blocks for true items and white blocks for false items, with the given block size and margin.

func (*BitGrid) Set

func (g *BitGrid) Set(x, y int, v bool)

func (*BitGrid) String

func (g *BitGrid) String() string

func (*BitGrid) TerminalOutput

func (g *BitGrid) TerminalOutput(w io.Writer)

Encode the Grid in ANSI escape sequences and set the background according to the values in the BitGrid surrounded by a white frame

func (*BitGrid) Width

func (g *BitGrid) Width() int

type BitVector

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

func (*BitVector) Append

func (v *BitVector) Append(b, count int)

func (*BitVector) AppendBit

func (v *BitVector) AppendBit(b bool)

func (*BitVector) AppendBits

func (v *BitVector) AppendBits(b BitVector)

func (*BitVector) Get

func (v *BitVector) Get(i int) bool

func (*BitVector) Length

func (v *BitVector) Length() int

func (*BitVector) String

func (v *BitVector) String() string

type ECLevel

type ECLevel int

Jump to

Keyboard shortcuts

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