Documentation ¶
Index ¶
- Constants
- func Bash(l Level, text string) error
- func BlockWrite(w io.Writer, l Level, text string) error
- func BlockWriteFile(filename string, l Level, text string) error
- func HalfBash(l Level, text string) error
- func HalfBlockWrite(w io.Writer, l Level, text string) error
- func HalfBlockWriteFile(filename string, l Level, text string) error
- func JPEG(filename string, l Level, text string) error
- func PNG(filename string, l Level, text string) error
- type BashWriter
- type BlockWriter
- type HalfBashWriter
- type HalfBlockWriter
- type Image
- type JPEGWriter
- type Level
- type PNGWriter
- type Writer
Constants ¶
const ( // L low tolerant of errors L = Level(qr.L) // 20% redundant // M middle tolerant of errors M = Level(qr.M) // 38% redundant // Q half tolerant of errors Q = Level(qr.Q) // 55% redundant // H high tolerant of errors H = Level(qr.H) // 65% redundant )
const QuietZoneBlocks = 4
QuietZoneBlocks is the default number of QR quiet zone blocks
Variables ¶
This section is empty.
Functions ¶
func Bash ¶
Bash generates a QR Code with bash color and output to Unix shell. Two characters as a QR block.
func BlockWrite ¶
BlockWrite generates a QR Code with Unicode characters and output to io.Writer. Two characters as a QR block.
func BlockWriteFile ¶
BlockWriteFile generates a QR Code with Unicode characters and output to a file named by filename. Two characters as a QR block.
func HalfBash ¶
HalfBash generates a QR Code with bash color and output to Unix shell. Half character as a QR block.
func HalfBlockWrite ¶
HalfBlockWrite generates a QR Code with Unicode Block Elements and output to io.Writer. Half character as a QR block.
func HalfBlockWriteFile ¶
HalfBlockWriteFile generates a QR Code with Unicode Block Elements and output to a file named by filename. Half character as a QR block.
Types ¶
type BashWriter ¶
BashWriter implements QR Writer by 'echo' command, output to terminal stdout.
func NewBashWriter ¶
func NewBashWriter(l Level, w io.Writer) *BashWriter
NewBashWriter returns a BashWriter instance after initialization.
func (*BashWriter) QR ¶
func (w *BashWriter) QR(text string) error
QR encode text at the given error correction level, and write to the given io.Writer.
func (*BashWriter) Write ¶
func (w *BashWriter) Write(p []byte) (err error)
Write the io.Writer wraps the basic Write method.
type BlockWriter ¶
BlockWriter implements QR Writer use Unicode characters, output to text.
func NewBlockWriter ¶
func NewBlockWriter(l Level, w io.Writer) *BlockWriter
NewBlockWriter returns a BlockWriter instance after initialization.
func (*BlockWriter) QR ¶
func (w *BlockWriter) QR(text string) error
QR encode text at the given error correction level, and write to the given io.Writer.
func (*BlockWriter) QRFile ¶
func (w *BlockWriter) QRFile(filename, text string) error
QRFile encode text at the given error correction level, and rewrite to a file named by filename.
type HalfBashWriter ¶
type HalfBashWriter struct { Writer Buffer *bytes.Buffer BlockBB []byte BlockWB []byte BlockBW []byte BlockWW []byte }
HalfBashWriter implements QR Writer by 'echo' command, output to terminal stdout.
func NewHalfBashWriter ¶
func NewHalfBashWriter(l Level, w io.Writer) *HalfBashWriter
NewHalfBashWriter returns a HalfBashWriter instance after initialization.
func (*HalfBashWriter) Invert ¶
func (w *HalfBashWriter) Invert() *HalfBashWriter
Invert the color of block.
func (*HalfBashWriter) QR ¶
func (w *HalfBashWriter) QR(text string) error
QR encode text at the given error correction level, and write to the given io.Writer.
func (*HalfBashWriter) Write ¶
func (w *HalfBashWriter) Write(p []byte) (err error)
Write the io.Writer wraps the basic Write method.
type HalfBlockWriter ¶
HalfBlockWriter implements QR Writer use Unicode Block Elements, output to text.
func NewHalfBlockWriter ¶
func NewHalfBlockWriter(l Level, w io.Writer) *HalfBlockWriter
NewHalfBlockWriter returns a HalfBlockWriter instance after initialization.
func (*HalfBlockWriter) Invert ¶
func (w *HalfBlockWriter) Invert() *HalfBlockWriter
Invert the color of block.
func (*HalfBlockWriter) QR ¶
func (w *HalfBlockWriter) QR(text string) error
QR encode text at the given error correction level, and write to the given io.Writer.
func (*HalfBlockWriter) QRFile ¶
func (w *HalfBlockWriter) QRFile(filename, text string) error
QRFile encode text at the given error correction level, and rewrite to a file named by filename.
type Image ¶
Image implements image.Image
func (*Image) At ¶
At returns the color of the pixel at (x, y). At(Bounds().Min.X, Bounds().Min.Y) returns the upper-left pixel of the grid. At(Bounds().Max.X-1, Bounds().Max.Y-1) returns the lower-right one.
func (*Image) Bounds ¶
Bounds returns the domain for which At can return non-zero color. The bounds do not necessarily contain the point (0, 0).
func (*Image) ColorModel ¶
ColorModel returns the Image's color model.
type JPEGWriter ¶
type JPEGWriter struct {
Writer
}
JPEGWriter implements QR Writer for a JPEG image.
func NewJPEGWriter ¶
func NewJPEGWriter(l Level, ws ...io.Writer) *JPEGWriter
NewJPEGWriter returns a JPEGWriter instance after initialization.
func (*JPEGWriter) QR ¶
func (w *JPEGWriter) QR(text string) error
QR encode text at the given error correction level, and write to the given io.Writer.
func (*JPEGWriter) QRFile ¶
func (w *JPEGWriter) QRFile(filename, text string) error
QRFile encode text at the given error correction level, and rewrite to a file named by filename.
type Level ¶
Level denotes a QR error correction level. From least to most tolerant of errors, they are L, M, Q, H.
type PNGWriter ¶
type PNGWriter struct {
Writer
}
PNGWriter implements QR Writer for a PNG image.
func NewPNGWriter ¶
NewPNGWriter returns a PNGWriter instance after initialization.