barcode.go 1014 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package barcode
  2. import "image"
  3. const (
  4. TypeAztec = "Aztec"
  5. TypeCodabar = "Codabar"
  6. TypeCode128 = "Code 128"
  7. TypeCode39 = "Code 39"
  8. TypeCode93 = "Code 93"
  9. TypeDataMatrix = "DataMatrix"
  10. TypeEAN8 = "EAN 8"
  11. TypeEAN13 = "EAN 13"
  12. TypePDF = "PDF417"
  13. TypeQR = "QR Code"
  14. Type2of5 = "2 of 5"
  15. Type2of5Interleaved = "2 of 5 (interleaved)"
  16. )
  17. // Contains some meta information about a barcode
  18. type Metadata struct {
  19. // the name of the barcode kind
  20. CodeKind string
  21. // contains 1 for 1D barcodes or 2 for 2D barcodes
  22. Dimensions byte
  23. }
  24. // a rendered and encoded barcode
  25. type Barcode interface {
  26. image.Image
  27. // returns some meta information about the barcode
  28. Metadata() Metadata
  29. // the data that was encoded in this barcode
  30. Content() string
  31. }
  32. // Additional interface that some barcodes might implement to provide
  33. // the value of its checksum.
  34. type BarcodeIntCS interface {
  35. Barcode
  36. CheckSum() int
  37. }