updated documentation
This commit is contained in:
parent
6c39380327
commit
66e4bb49cf
|
@ -237,6 +237,7 @@ func encodeEAN13(code string, result *eancode) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// encodes the given EAN 8 or EAN 13 number to a barcode image
|
||||||
func Encode(code string) (barcode.Barcode, error) {
|
func Encode(code string) (barcode.Barcode, error) {
|
||||||
if len(code) == 7 || len(code) == 12 {
|
if len(code) == 7 || len(code) == 12 {
|
||||||
code += string(calcCheckNum(code))
|
code += string(calcCheckNum(code))
|
||||||
|
|
|
@ -43,13 +43,14 @@ func (e Encoding) String() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func Encode(content string, eccLevel ErrorCorrectionLevel, mode Encoding) (barcode.Barcode, error) {
|
// Encodes the given content to a QR barcode
|
||||||
bits, vi, err := mode.getEncoder()(content, eccLevel)
|
func Encode(content string, level ErrorCorrectionLevel, mode Encoding) (barcode.Barcode, error) {
|
||||||
|
bits, vi, err := mode.getEncoder()(content, level)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if bits == nil || vi == nil {
|
if bits == nil || vi == nil {
|
||||||
return nil, fmt.Errorf("Unable to encode \"%s\" with error correction level %s and encoding mode %s", content, eccLevel, mode)
|
return nil, fmt.Errorf("Unable to encode \"%s\" with error correction level %s and encoding mode %s", content, level, mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
blocks := splitToBlocks(bits.ItterateBytes(), vi)
|
blocks := splitToBlocks(bits.ItterateBytes(), vi)
|
||||||
|
|
Loading…
Reference in New Issue