encoder

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2020 License: Apache-2.0, MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Encoder_DEFAULT_BYTE_MODE_ENCODING = "UTF-8" // original default is "ISO-8859-1"
)
View Source
const QRCode_NUM_MASK_PATERNS = 8

Variables

This section is empty.

Functions

func MaskUtil_applyMaskPenaltyRule1

func MaskUtil_applyMaskPenaltyRule1(matrix *ByteMatrix) int

MaskUtil_applyMaskPenaltyRule1 Apply mask penalty rule 1 and return the penalty. Find repetitive cells with the same color and give penalty to them. Example: 00000 or 11111.

func MaskUtil_applyMaskPenaltyRule2

func MaskUtil_applyMaskPenaltyRule2(matrix *ByteMatrix) int

MaskUtil_applyMaskPenaltyRule2 Apply mask penalty rule 2 and return the penalty. Find 2x2 blocks with the same color and give penalty to them. This is actually equivalent to the spec's rule, which is to find MxN blocks and give a penalty proportional to (M-1)x(N-1), because this is the number of 2x2 blocks inside such a block.

func MaskUtil_applyMaskPenaltyRule3

func MaskUtil_applyMaskPenaltyRule3(matrix *ByteMatrix) int

MaskUtil_applyMaskPenaltyRule3 Apply mask penalty rule 3 and return the penalty. Find consecutive runs of 1:1:3:1:1:4 starting with black, or 4:1:1:3:1:1 starting with white, and give penalty to them. If we find patterns like 000010111010000, we give penalty once.

func MaskUtil_applyMaskPenaltyRule4

func MaskUtil_applyMaskPenaltyRule4(matrix *ByteMatrix) int

MaskUtil_applyMaskPenaltyRule4 Apply mask penalty rule 4 and return the penalty. Calculate the ratio of dark cells and give penalty if the ratio is far from 50%. It gives 10 penalty for 5% distance.

func MaskUtil_getDataMaskBit

func MaskUtil_getDataMaskBit(maskPattern, x, y int) (bool, error)

MaskUtil_getDataMaskBit Return the mask bit for "getMaskPattern" at "x" and "y". See 8.8 of JISX0510:2004 for mask pattern conditions.

func MatrixUtil_buildMatrix

func MatrixUtil_buildMatrix(
	dataBits *gozxing.BitArray,
	ecLevel decoder.ErrorCorrectionLevel,
	version *decoder.Version,
	maskPattern int,
	matrix *ByteMatrix) error

MatrixUtil_buildMatrix Build 2D matrix of QR Code from "dataBits" with "ecLevel", "version" and "getMaskPattern". On success, store the result in "matrix" and return true.

func QRCode_IsValidMaskPattern

func QRCode_IsValidMaskPattern(maskPattern int) bool

Types

type BlockPair

type BlockPair struct {
	// contains filtered or unexported fields
}

func NewBlockPair

func NewBlockPair(data []byte, errorCorrection []byte) *BlockPair

func (*BlockPair) GetDataBytes

func (this *BlockPair) GetDataBytes() []byte

func (*BlockPair) GetErrorCorrectionBytes

func (this *BlockPair) GetErrorCorrectionBytes() []byte

type ByteMatrix

type ByteMatrix struct {
	// contains filtered or unexported fields
}

func NewByteMatrix

func NewByteMatrix(width, height int) *ByteMatrix

func (*ByteMatrix) Clear

func (this *ByteMatrix) Clear(value int8)

func (*ByteMatrix) Get

func (this *ByteMatrix) Get(x, y int) int8

func (*ByteMatrix) GetArray

func (this *ByteMatrix) GetArray() [][]int8

func (*ByteMatrix) GetHeight

func (this *ByteMatrix) GetHeight() int

func (*ByteMatrix) GetWidth

func (this *ByteMatrix) GetWidth() int

func (*ByteMatrix) Set

func (this *ByteMatrix) Set(x, y int, value int8)

func (*ByteMatrix) SetBool

func (this *ByteMatrix) SetBool(x, y int, value bool)

func (*ByteMatrix) String

func (this *ByteMatrix) String() string

type QRCode

type QRCode struct {
	// contains filtered or unexported fields
}

func Encoder_encode

func Encoder_encode(content string, ecLevel decoder.ErrorCorrectionLevel, hints map[gozxing.EncodeHintType]interface{}) (*QRCode, gozxing.WriterException)

func Encoder_encodeWithoutHint

func Encoder_encodeWithoutHint(content string, ecLevel decoder.ErrorCorrectionLevel) (*QRCode, gozxing.WriterException)

func NewQRCode

func NewQRCode() *QRCode

func (*QRCode) GetECLevel

func (this *QRCode) GetECLevel() decoder.ErrorCorrectionLevel

func (*QRCode) GetMaskPattern

func (this *QRCode) GetMaskPattern() int

func (*QRCode) GetMatrix

func (this *QRCode) GetMatrix() *ByteMatrix

func (*QRCode) GetMode

func (this *QRCode) GetMode() *decoder.Mode

func (*QRCode) GetVersion

func (this *QRCode) GetVersion() *decoder.Version

func (*QRCode) SetECLevel

func (this *QRCode) SetECLevel(value decoder.ErrorCorrectionLevel)

func (*QRCode) SetMaskPattern

func (this *QRCode) SetMaskPattern(value int)

func (*QRCode) SetMatrix

func (this *QRCode) SetMatrix(value *ByteMatrix)

func (*QRCode) SetMode

func (this *QRCode) SetMode(value *decoder.Mode)

func (*QRCode) SetVersion

func (this *QRCode) SetVersion(value *decoder.Version)

func (*QRCode) String

func (this *QRCode) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL