This commit is contained in:
Florian Sundermann committed 2013-12-16 14:10:24 +01:00
1 parent a4167688a0
commit 9741f0ff8d
12 files changed
+143 -270

No files matched your search

-36
View File
@@ -1,36 +0,0 @@
package codabar
import (
"github.com/boombuler/barcode"
"github.com/boombuler/barcode/utils"
"image"
"image/color"
)
type codabarcode struct {
*utils.BitList
content string
}
func (c *codabarcode) Content() string {
return c.content
}
func (c *codabarcode) Metadata() barcode.Metadata {
return barcode.Metadata{"Codabar", 1}
}
func (c *codabarcode) ColorModel() color.Model {
return color.Gray16Model
}
func (c *codabarcode) Bounds() image.Rectangle {
return image.Rect(0, 0, c.Len(), 1)
}
func (c *codabarcode) At(x, y int) color.Color {
if c.GetBit(x) {
return color.Black
}
return color.White
}
+2 -4
View File
@@ -44,9 +44,7 @@ func Encode(content string) (barcode.Barcode, error) {
if !ok {
return nil, fmt.Errorf("can not encode \"%s\"", content)
}
for _, bit := range bits {
resBits.AddBit(bit)
}
resBits.AddBit(bits...)
}
return &codabarcode{resBits, content}, nil
return utils.New1DCode("Codabar", content, resBits), nil
}