git.sr.ht/~pingoo/stdx@v0.0.0-20240218134121-094174641f6e/barcode/barcode.go (about)

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