update vendor

This commit is contained in:
ston1th 2025-10-15 22:37:57 +02:00
commit 8675bc4b7a
328 changed files with 27166 additions and 6537 deletions

View file

@ -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)