update vendor
This commit is contained in:
parent
824f46979b
commit
8675bc4b7a
328 changed files with 27166 additions and 6537 deletions
16
vendor/github.com/boombuler/barcode/qr/encoder.go
generated
vendored
16
vendor/github.com/boombuler/barcode/qr/encoder.go
generated
vendored
|
|
@ -54,8 +54,8 @@ func (e Encoding) String() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
// Encode returns a QR barcode with the given content, error correction level and uses the given encoding
|
||||
func Encode(content string, level ErrorCorrectionLevel, mode Encoding) (barcode.Barcode, error) {
|
||||
// Encode returns a QR barcode with the given content and color scheme, error correction level and uses the given encoding
|
||||
func EncodeWithColor(content string, level ErrorCorrectionLevel, mode Encoding, color barcode.ColorScheme) (barcode.Barcode, error) {
|
||||
bits, vi, err := mode.getEncoder()(content, level)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -63,19 +63,23 @@ func Encode(content string, level ErrorCorrectionLevel, mode Encoding) (barcode.
|
|||
|
||||
blocks := splitToBlocks(bits.IterateBytes(), vi)
|
||||
data := blocks.interleave(vi)
|
||||
result := render(data, vi)
|
||||
result := render(data, vi, color)
|
||||
result.content = content
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func render(data []byte, vi *versionInfo) *qrcode {
|
||||
func Encode(content string, level ErrorCorrectionLevel, mode Encoding) (barcode.Barcode, error) {
|
||||
return EncodeWithColor(content, level, mode, barcode.ColorScheme16)
|
||||
}
|
||||
|
||||
func render(data []byte, vi *versionInfo, color barcode.ColorScheme) *qrcode {
|
||||
dim := vi.modulWidth()
|
||||
results := make([]*qrcode, 8)
|
||||
for i := 0; i < 8; i++ {
|
||||
results[i] = newBarcode(dim)
|
||||
results[i] = newBarCodeWithColor(dim, color)
|
||||
}
|
||||
|
||||
occupied := newBarcode(dim)
|
||||
occupied := newBarCodeWithColor(dim, color)
|
||||
|
||||
setAll := func(x int, y int, val bool) {
|
||||
occupied.Set(x, y, true)
|
||||
|
|
|
|||
18
vendor/github.com/boombuler/barcode/qr/qrcode.go
generated
vendored
18
vendor/github.com/boombuler/barcode/qr/qrcode.go
generated
vendored
|
|
@ -13,6 +13,7 @@ type qrcode struct {
|
|||
dimension int
|
||||
data *utils.BitList
|
||||
content string
|
||||
color barcode.ColorScheme
|
||||
}
|
||||
|
||||
func (qr *qrcode) Content() string {
|
||||
|
|
@ -24,7 +25,11 @@ func (qr *qrcode) Metadata() barcode.Metadata {
|
|||
}
|
||||
|
||||
func (qr *qrcode) ColorModel() color.Model {
|
||||
return color.Gray16Model
|
||||
return qr.color.Model
|
||||
}
|
||||
|
||||
func (c *qrcode) ColorScheme() barcode.ColorScheme {
|
||||
return c.color
|
||||
}
|
||||
|
||||
func (qr *qrcode) Bounds() image.Rectangle {
|
||||
|
|
@ -33,9 +38,9 @@ func (qr *qrcode) Bounds() image.Rectangle {
|
|||
|
||||
func (qr *qrcode) At(x, y int) color.Color {
|
||||
if qr.Get(x, y) {
|
||||
return color.Black
|
||||
return qr.color.Foreground
|
||||
}
|
||||
return color.White
|
||||
return qr.color.Background
|
||||
}
|
||||
|
||||
func (qr *qrcode) Get(x, y int) bool {
|
||||
|
|
@ -158,9 +163,14 @@ func (qr *qrcode) calcPenaltyRule4() uint {
|
|||
return uint(math.Min(floor, ceil) * 10)
|
||||
}
|
||||
|
||||
func newBarcode(dim int) *qrcode {
|
||||
func newBarCodeWithColor(dim int, color barcode.ColorScheme) *qrcode {
|
||||
res := new(qrcode)
|
||||
res.dimension = dim
|
||||
res.data = utils.NewBitList(dim * dim)
|
||||
res.color = color
|
||||
return res
|
||||
}
|
||||
|
||||
func newBarcode(dim int) *qrcode {
|
||||
return newBarCodeWithColor(dim, barcode.ColorScheme16)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue