Documentation ¶
Index ¶
- type HalftoneQRCode
- func (q *HalftoneQRCode) AddOption(cfg Option) *HalftoneQRCode
- func (q *HalftoneQRCode) Bitmap() [][]bool
- func (q *HalftoneQRCode) CodeGif(pointWidth int) (ret *gif.GIF, err error)
- func (q *HalftoneQRCode) CodeImage(pointWidth int) (ret image.Image, err error)
- func (q *HalftoneQRCode) ImageData(pointWidth int) (ret []byte, err error)
- func (q HalftoneQRCode) Option() *Option
- func (q *HalftoneQRCode) RemoveOption(opt OptionKey) *HalftoneQRCode
- func (q *HalftoneQRCode) ToString() string
- type HalftoneRegularSymbol
- type HalftoneSymbol
- type Option
- type OptionKey
- type RecoveryLevel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HalftoneQRCode ¶
type HalftoneQRCode struct { // Original content encoded. Content string // QR Code type. Level RecoveryLevel // QR Code version number VersionNumber int // contains filtered or unexported fields }
HalftoneQRCode specify the basic qrcode and another options to generate a qrcode with image
func NewHalftoneCode ¶
func NewHalftoneCode(content string, level RecoveryLevel) (*HalftoneQRCode, error)
NewHalftoneCode constructs a basic QRCode.
var q *cmd.HalftoneQRCode q, err := cmd.NewHalftoneCode("my content", cmd.Medium)
An error occurs if the content is too long.
func (*HalftoneQRCode) AddOption ¶
func (q *HalftoneQRCode) AddOption(cfg Option) *HalftoneQRCode
AddOption add Option to a HalftoneQRCode. Attention: only the none-zero field will be merged into HalftoneQRCode's option. If you want to delete an option, use RemoveOption method.
func (*HalftoneQRCode) Bitmap ¶
func (q *HalftoneQRCode) Bitmap() [][]bool
Bitmap returns the QR Code as a 2D array of 1-bit pixels.
bitmap[y][x] is true if the pixel at (x, y) is set.
The bitmap includes the required "quiet zone" around the QR Code to aid decoding.
func (*HalftoneQRCode) CodeGif ¶
func (q *HalftoneQRCode) CodeGif(pointWidth int) (ret *gif.GIF, err error)
CodeGif generates the code as a gif. pointWidth parameter set the width of a qr code module.
func (*HalftoneQRCode) CodeImage ¶
func (q *HalftoneQRCode) CodeImage(pointWidth int) (ret image.Image, err error)
CodeImage generate the code as a normal image. pointWidth parameter set the width of a qr code module.
func (*HalftoneQRCode) ImageData ¶
func (q *HalftoneQRCode) ImageData(pointWidth int) (ret []byte, err error)
ImageData generate code and return the bytes represents the cod image(png/gif). pointWidth parameter set the width of a qr code module.
func (HalftoneQRCode) Option ¶
func (q HalftoneQRCode) Option() *Option
Option method returns the pointer point to option.
func (*HalftoneQRCode) RemoveOption ¶
func (q *HalftoneQRCode) RemoveOption(opt OptionKey) *HalftoneQRCode
RemoveOption method set the option field's value to its zero value.
func (*HalftoneQRCode) ToString ¶
func (q *HalftoneQRCode) ToString() string
ToString produces a multi-line string that forms a QR-code image. This method return the pure qrcode without mask image.
type HalftoneRegularSymbol ¶
type HalftoneRegularSymbol struct {
// contains filtered or unexported fields
}
type HalftoneSymbol ¶
type HalftoneSymbol struct {
// contains filtered or unexported fields
}
type Option ¶
type Option struct { // User settable drawing options. ForegroundColor color.Color BackgroundColor color.Color MaskImagePath string MaskImageFile io.Reader MaskRectangle image.Rectangle Embed bool }
Option struct contains the option to build code
type OptionKey ¶
type OptionKey string
OptionKey act as the key of Option struct
const ( // Field name of ForegroundColor in Option ForegroundColorOpt OptionKey = "ForegroundColor" // Field name of BackgroundColor in Option BackgroundColorOpt OptionKey = "BackgroundColor" // Field name of MaskImagePath in Option MaskImagePathOpt OptionKey = "MaskImagePath" // Field name of MaskImageFile in Option MaskImageFileOpt OptionKey = "MaskImageFile" // Field name of MaskRectangle in Option MaskRectangleOpt OptionKey = "MaskRectangle" // Field name of Embed in Option EmbedOpt OptionKey = "Embed" )
type RecoveryLevel ¶
type RecoveryLevel int
Error detection/recovery capacity.
There are several levels of error detection/recovery capacity. Higher levels of error recovery are able to correct more errors, with the trade-off of increased symbol size.
const ( // Level L: 7% error recovery. Low RecoveryLevel = iota // Level M: 15% error recovery. Good default choice. Medium // Level Q: 25% error recovery. High // Level H: 30% error recovery. Highest )
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package bitset implements an append only bit array.
|
Package bitset implements an append only bit array. |
Package reedsolomon provides error correction encoding for QR Code 2005.
|
Package reedsolomon provides error correction encoding for QR Code 2005. |