Documentation ¶
Index ¶
- Constants
- type BaseOutput
- func (out *BaseOutput) AddOption(options ...*Option)
- func (out *BaseOutput) EvalMicroQRCodePenalty(moduleSize int) uint
- func (out *BaseOutput) EvalPenalty(moduleSize int) uint
- func (out *BaseOutput) GetModule(x int, y int) bool
- func (out *BaseOutput) GetRecommendSize(moduleSize int) []int
- func (out *BaseOutput) IsModuleSet(x int, y int) bool
- type ImageOutput
- func (out *ImageOutput) Clone() Output
- func (out *ImageOutput) GetBaseOutput() *BaseOutput
- func (out *ImageOutput) GetImage() *image.NRGBA
- func (out *ImageOutput) GetModule(x int, y int) bool
- func (out *ImageOutput) Init(version *model.Version, qz *model.QuietZone)
- func (out *ImageOutput) IsModuleSet(x int, y int) bool
- func (out *ImageOutput) ResizeToFit(moduleSize int, quietZoneSize int, pixelSize int)
- func (out *ImageOutput) Save(fileName string) error
- func (out *ImageOutput) SaveToBase64() (base64Str string, err error)
- func (out *ImageOutput) Write(x int, y int, black bool)
- func (out *ImageOutput) WriteModule(x int, y int, black bool, pixelSize int)
- func (out *ImageOutput) WriteModuleColor(x int, y int, dark bool, setColor color.Color, pixelSize int)
- type Option
- type OptionName
- type Output
- type Type
Constants ¶
const ( JPG Type = iota // 0 PNG // 1 GIF // 2 SVG // 3 // AUTO_SIZE : set auto size for qrcode , per module fill by 4 pixels AUTO_SIZE = 0 LogoOptionName OptionName = "logo" )
defined OutputType constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseOutput ¶
type BaseOutput struct { // image type Type Type // image width/height Size int Options []*Option // contains filtered or unexported fields }
func (*BaseOutput) AddOption ¶
func (out *BaseOutput) AddOption(options ...*Option)
func (*BaseOutput) EvalMicroQRCodePenalty ¶
func (out *BaseOutput) EvalMicroQRCodePenalty(moduleSize int) uint
EvalMicroQRCodePenalty :Evaluate Penalty for Micro QRCode. Page 62, 7.8.3.2 Evaluation of Micro QRCode Symbols. if SUM1 <= SUM2
Evaluation Score = SUM1 x 16 + SUM2
if SUM1 > SUM2
Evaluation Score = SUM2 x 16 + SUM2
where:
SUM1 number of dark modules in right side edge SUM2 number of dark modules in lower side edge
func (*BaseOutput) EvalPenalty ¶
func (out *BaseOutput) EvalPenalty(moduleSize int) uint
EvalPenalty :Evaluate Penalty for QRCode. param: moduleSize, not contains quiet zone size.
func (*BaseOutput) GetRecommendSize ¶
func (out *BaseOutput) GetRecommendSize(moduleSize int) []int
GetRecommendSize :Get recommend size for QRCode return: the array of two recommend sizes
func (*BaseOutput) IsModuleSet ¶
func (out *BaseOutput) IsModuleSet(x int, y int) bool
type ImageOutput ¶
type ImageOutput struct { *BaseOutput // contains filtered or unexported fields }
func NewGIFOutput ¶
func NewGIFOutput(size int) *ImageOutput
func NewGIFOutput0 ¶
func NewGIFOutput0() *ImageOutput
NewGIFOutput0 :Output a new GIF image by auto size.
func NewJPGOutput ¶
func NewJPGOutput(size int) *ImageOutput
func NewJPGOutput0 ¶
func NewJPGOutput0() *ImageOutput
NewJPGOutput0 :Output a new JPG image by auto size.
func NewPNGOutput ¶
func NewPNGOutput(size int) *ImageOutput
func NewPNGOutput0 ¶
func NewPNGOutput0() *ImageOutput
NewPNGOutput0 :Output a new PNG image by auto size.
func (*ImageOutput) Clone ¶
func (out *ImageOutput) Clone() Output
Clone : Shallow copy BaseOutput and modules from output, init new image instance
func (*ImageOutput) GetBaseOutput ¶
func (out *ImageOutput) GetBaseOutput() *BaseOutput
func (*ImageOutput) GetImage ¶
func (out *ImageOutput) GetImage() *image.NRGBA
func (*ImageOutput) Init ¶
func (out *ImageOutput) Init(version *model.Version, qz *model.QuietZone)
Init :init for output when size is AUTO_SIZE
func (*ImageOutput) IsModuleSet ¶
func (out *ImageOutput) IsModuleSet(x int, y int) bool
func (*ImageOutput) ResizeToFit ¶
func (out *ImageOutput) ResizeToFit(moduleSize int, quietZoneSize int, pixelSize int)
func (*ImageOutput) SaveToBase64 ¶
func (out *ImageOutput) SaveToBase64() (base64Str string, err error)
func (*ImageOutput) Write ¶
func (out *ImageOutput) Write(x int, y int, black bool)
Write : write data
func (*ImageOutput) WriteModule ¶
func (out *ImageOutput) WriteModule(x int, y int, black bool, pixelSize int)
WriteModule : write data
func (*ImageOutput) WriteModuleColor ¶
type Option ¶
type Option struct { Name OptionName Value string }
Option : Output Option
func LogoOption ¶
LogoOption : Option for add logo image at center of QRCode
type OptionName ¶
type OptionName = string
type Output ¶
type Output interface { GetBaseOutput() *BaseOutput // Init :init for output when size is AUTO_SIZE Init(version *model.Version, qz *model.QuietZone) Write(x int, y int, black bool) // WriteModule :write per module by pixelSize WriteModule(x int, y int, black bool, pixelSize int) WriteModuleColor(x int, y int, dark bool, setColor color.Color, pixelSize int) // IsModuleSet : check the module whether or not be set IsModuleSet(x int, y int) bool // GetModule : x,y is module axes , not pixel axes. GetModule(x int, y int) bool GetImage() *image.NRGBA Clone() Output ResizeToFit(moduleSize int, quietZoneSize int, pixelSize int) Save(fileName string) error SaveToBase64() (string, error) }
Output : the output interface for qrcode print