Update godoc comment of EncodeWithColor methods
This commit is contained in:
parent
1c8224977e
commit
b1129f9d8b
|
@ -127,7 +127,7 @@ func Encode(data []byte, minECCPercent int, userSpecifiedLayers int) (barcode.Ba
|
||||||
return EncodeWithColor(data, minECCPercent, userSpecifiedLayers, barcode.ColorScheme16)
|
return EncodeWithColor(data, minECCPercent, userSpecifiedLayers, barcode.ColorScheme16)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode returns an aztec barcode with the given content
|
// Encode returns an aztec barcode with the given content and color scheme
|
||||||
func EncodeWithColor(data []byte, minECCPercent int, userSpecifiedLayers int, color barcode.ColorScheme) (barcode.Barcode, error) {
|
func EncodeWithColor(data []byte, minECCPercent int, userSpecifiedLayers int, color barcode.ColorScheme) (barcode.Barcode, error) {
|
||||||
bits := highlevelEncode(data)
|
bits := highlevelEncode(data)
|
||||||
eccBits := ((bits.Len() * minECCPercent) / 100) + 11
|
eccBits := ((bits.Len() * minECCPercent) / 100) + 11
|
||||||
|
|
|
@ -32,7 +32,7 @@ var encodingTable = map[rune][]bool{
|
||||||
'D': []bool{true, false, true, false, false, true, true, false, false, true},
|
'D': []bool{true, false, true, false, false, true, true, false, false, true},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode creates a codabar barcode for the given content
|
// Encode creates a codabar barcode for the given content and color scheme
|
||||||
func EncodeWithColor(content string, color barcode.ColorScheme) (barcode.Barcode, error) {
|
func EncodeWithColor(content string, color barcode.ColorScheme) (barcode.Barcode, error) {
|
||||||
checkValid, _ := regexp.Compile(`[ABCD][0123456789\-\$\:/\.\+]*[ABCD]$`)
|
checkValid, _ := regexp.Compile(`[ABCD][0123456789\-\$\:/\.\+]*[ABCD]$`)
|
||||||
if content == "!" || checkValid.ReplaceAllString(content, "!") != "!" {
|
if content == "!" || checkValid.ReplaceAllString(content, "!") != "!" {
|
||||||
|
|
|
@ -155,7 +155,7 @@ func getCodeIndexList(content []rune) *utils.BitList {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode creates a Code 128 barcode for the given content
|
// Encode creates a Code 128 barcode for the given content and color scheme
|
||||||
func EncodeWithColor(content string, color barcode.ColorScheme) (barcode.BarcodeIntCS, error) {
|
func EncodeWithColor(content string, color barcode.ColorScheme) (barcode.BarcodeIntCS, error) {
|
||||||
contentRunes := strToRunes(content)
|
contentRunes := strToRunes(content)
|
||||||
if len(contentRunes) <= 0 || len(contentRunes) > 80 {
|
if len(contentRunes) <= 0 || len(contentRunes) > 80 {
|
||||||
|
|
|
@ -111,7 +111,7 @@ func prepare(content string) (string, error) {
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode returns a code39 barcode for the given content
|
// Encode returns a code39 barcode for the given content and color scheme
|
||||||
// if includeChecksum is set to true, a checksum character is calculated and added to the content
|
// if includeChecksum is set to true, a checksum character is calculated and added to the content
|
||||||
func EncodeWithColor(content string, includeChecksum bool, fullASCIIMode bool, color barcode.ColorScheme) (barcode.BarcodeIntCS, error) {
|
func EncodeWithColor(content string, includeChecksum bool, fullASCIIMode bool, color barcode.ColorScheme) (barcode.BarcodeIntCS, error) {
|
||||||
if fullASCIIMode {
|
if fullASCIIMode {
|
||||||
|
|
|
@ -74,6 +74,8 @@ func prepare(content string) (string, error) {
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Encode returns a code93 barcode for the given content and color scheme
|
||||||
|
// if includeChecksum is set to true, two checksum characters are calculated and added to the content
|
||||||
func EncodeWithColor(content string, includeChecksum bool, fullASCIIMode bool, color barcode.ColorScheme) (barcode.Barcode, error) {
|
func EncodeWithColor(content string, includeChecksum bool, fullASCIIMode bool, color barcode.ColorScheme) (barcode.Barcode, error) {
|
||||||
if fullASCIIMode {
|
if fullASCIIMode {
|
||||||
var err error
|
var err error
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"github.com/boombuler/barcode"
|
"github.com/boombuler/barcode"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Encode returns a Datamatrix barcode for the given content
|
// Encode returns a Datamatrix barcode for the given content and color scheme
|
||||||
func EncodeWithColor(content string, color barcode.ColorScheme) (barcode.Barcode, error) {
|
func EncodeWithColor(content string, color barcode.ColorScheme) (barcode.Barcode, error) {
|
||||||
data := encodeText(content)
|
data := encodeText(content)
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ func encodeEAN13(code string) *utils.BitList {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode returns a EAN 8 or EAN 13 barcode for the given code
|
// Encode returns a EAN 8 or EAN 13 barcode for the given code and color scheme
|
||||||
func EncodeWithColor(code string, color barcode.ColorScheme) (barcode.BarcodeIntCS, error) {
|
func EncodeWithColor(code string, color barcode.ColorScheme) (barcode.BarcodeIntCS, error) {
|
||||||
var checkSum int
|
var checkSum int
|
||||||
if len(code) == 7 || len(code) == 12 {
|
if len(code) == 7 || len(code) == 12 {
|
||||||
|
|
|
@ -12,7 +12,7 @@ const (
|
||||||
padding_codeword = 900
|
padding_codeword = 900
|
||||||
)
|
)
|
||||||
|
|
||||||
// Encodes the given data as PDF417 barcode.
|
// Encodes the given data and color scheme as PDF417 barcode.
|
||||||
// securityLevel should be between 0 and 8. The higher the number, the more
|
// securityLevel should be between 0 and 8. The higher the number, the more
|
||||||
// additional error-correction codes are added.
|
// additional error-correction codes are added.
|
||||||
func EncodeWithColor(data string, securityLevel byte, color barcode.ColorScheme) (barcode.Barcode, error) {
|
func EncodeWithColor(data string, securityLevel byte, color barcode.ColorScheme) (barcode.Barcode, error) {
|
||||||
|
|
|
@ -54,7 +54,7 @@ func (e Encoding) String() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode returns a QR barcode with the given content, error correction level and uses the given encoding
|
// 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) {
|
func EncodeWithColor(content string, level ErrorCorrectionLevel, mode Encoding, color barcode.ColorScheme) (barcode.Barcode, error) {
|
||||||
bits, vi, err := mode.getEncoder()(content, level)
|
bits, vi, err := mode.getEncoder()(content, level)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue