package utils
import "github.com/boombuler/barcode/utils"
Package utils contain some utilities which are needed to create barcodes
Index ¶
- func IntToRune(i int) rune
- func New1DCode(codeKind, content string, bars *BitList) barcode.Barcode
- func New1DCodeIntCheckSum(codeKind, content string, bars *BitList, checksum int) barcode.BarcodeIntCS
- func RuneToInt(r rune) int
- type BitList
- func NewBitList(capacity int) *BitList
- func (bl *BitList) AddBit(bits ...bool)
- func (bl *BitList) AddBits(b int, count byte)
- func (bl *BitList) AddByte(b byte)
- func (bl *BitList) GetBit(index int) bool
- func (bl *BitList) GetBytes() []byte
- func (bl *BitList) IterateBytes() <-chan byte
- func (bl *BitList) Len() int
- func (bl *BitList) SetBit(index int, value bool)
- type GFPoly
- func NewGFPoly(field *GaloisField, coefficients []int) *GFPoly
- func NewMonominalPoly(field *GaloisField, degree int, coeff int) *GFPoly
- func (gp *GFPoly) AddOrSubstract(other *GFPoly) *GFPoly
- func (gp *GFPoly) Degree() int
- func (gp *GFPoly) Divide(other *GFPoly) (quotient *GFPoly, remainder *GFPoly)
- func (gp *GFPoly) GetCoefficient(degree int) int
- func (gp *GFPoly) MultByMonominal(degree int, coeff int) *GFPoly
- func (gp *GFPoly) Multiply(other *GFPoly) *GFPoly
- func (gp *GFPoly) Zero() bool
- type GaloisField
- func NewGaloisField(pp, fieldSize, b int) *GaloisField
- func (gf *GaloisField) AddOrSub(a, b int) int
- func (gf *GaloisField) Divide(a, b int) int
- func (gf *GaloisField) Invers(num int) int
- func (gf *GaloisField) Multiply(a, b int) int
- func (gf *GaloisField) Zero() *GFPoly
- type ReedSolomonEncoder
Functions ¶
func IntToRune ¶
IntToRune converts a digit 0 - 9 to the rune '0' - '9'. If the given int is outside of this range 'F' is returned!
func New1DCode ¶
New1DCode creates a new 1D barcode where the bars are represented by the bits in the bars BitList
func New1DCodeIntCheckSum ¶
func New1DCodeIntCheckSum(codeKind, content string, bars *BitList, checksum int) barcode.BarcodeIntCS
New1DCode creates a new 1D barcode where the bars are represented by the bits in the bars BitList
func RuneToInt ¶
RuneToInt converts a rune between '0' and '9' to an integer between 0 and 9 If the rune is outside of this range -1 is returned.
Types ¶
type BitList ¶
type BitList struct {
// contains filtered or unexported fields
}
BitList is a list that contains bits
func NewBitList ¶
NewBitList returns a new BitList with the given length all bits are initialize with false
func (*BitList) AddBit ¶
AddBit appends the given bits to the end of the list
func (*BitList) AddBits ¶
AddBits appends the last (LSB) 'count' bits of 'b' the the end of the list
func (*BitList) AddByte ¶
AddByte appends all 8 bits of the given byte to the end of the list
func (*BitList) GetBit ¶
GetBit returns the bit at the given index
func (*BitList) GetBytes ¶
GetBytes returns all bits of the BitList as a []byte
func (*BitList) IterateBytes ¶
IterateBytes iterates through all bytes contained in the BitList
func (*BitList) Len ¶
Len returns the number of contained bits
func (*BitList) SetBit ¶
SetBit sets the bit at the given index to the given value
type GFPoly ¶
type GFPoly struct { Coefficients []int // contains filtered or unexported fields }
func NewGFPoly ¶
func NewGFPoly(field *GaloisField, coefficients []int) *GFPoly
func NewMonominalPoly ¶
func NewMonominalPoly(field *GaloisField, degree int, coeff int) *GFPoly
func (*GFPoly) AddOrSubstract ¶
func (*GFPoly) Degree ¶
func (*GFPoly) Divide ¶
func (*GFPoly) GetCoefficient ¶
GetCoefficient returns the coefficient of x ^ degree
func (*GFPoly) MultByMonominal ¶
func (*GFPoly) Multiply ¶
func (*GFPoly) Zero ¶
type GaloisField ¶
GaloisField encapsulates galois field arithmetics
func NewGaloisField ¶
func NewGaloisField(pp, fieldSize, b int) *GaloisField
NewGaloisField creates a new galois field
func (*GaloisField) AddOrSub ¶
func (gf *GaloisField) AddOrSub(a, b int) int
AddOrSub add or substract two numbers
func (*GaloisField) Divide ¶
func (gf *GaloisField) Divide(a, b int) int
Divide divides two numbers
func (*GaloisField) Invers ¶
func (gf *GaloisField) Invers(num int) int
func (*GaloisField) Multiply ¶
func (gf *GaloisField) Multiply(a, b int) int
Multiply multiplys two numbers
func (*GaloisField) Zero ¶
func (gf *GaloisField) Zero() *GFPoly
type ReedSolomonEncoder ¶
type ReedSolomonEncoder struct {
// contains filtered or unexported fields
}
func NewReedSolomonEncoder ¶
func NewReedSolomonEncoder(gf *GaloisField) *ReedSolomonEncoder
func (*ReedSolomonEncoder) Encode ¶
func (rs *ReedSolomonEncoder) Encode(data []int, eccCount int) []int
Source Files ¶
base1dcode.go bitlist.go galoisfield.go gfpoly.go reedsolomon.go runeint.go
- Version
- v1.0.0
- Published
- Sep 22, 2017
- Platform
- windows/amd64
- Imports
- 4 packages
- Last checked
- 2 hours ago –
Tools for package owners.