MCPcopy
hub / github.com/skip2/go-qrcode / ToString

Method ToString

qrcode.go:555–569  ·  view source on GitHub ↗

ToString produces a multi-line string that forms a QR-code image.

(inverseColor bool)

Source from the content-addressed store, hash-verified

553
554// ToString produces a multi-line string that forms a QR-code image.
555func (q *QRCode) ToString(inverseColor bool) string {
556 bits := q.Bitmap()
557 var buf bytes.Buffer
558 for y := range bits {
559 for x := range bits[y] {
560 if bits[y][x] != inverseColor {
561 buf.WriteString(" ")
562 } else {
563 buf.WriteString("██")
564 }
565 }
566 buf.WriteString("\n")
567 }
568 return buf.String()
569}
570
571// ToSmallString produces a multi-line string that forms a QR-code image, a
572// factor two smaller in x and y then ToString.

Callers 1

mainFunction · 0.95

Calls 2

BitmapMethod · 0.95
StringMethod · 0.80

Tested by

no test coverage detected