Documentation ¶
Index ¶
- Constants
- Variables
- func MaskUtil_applyMaskPenaltyRule1(matrix *ByteMatrix) int
- func MaskUtil_applyMaskPenaltyRule2(matrix *ByteMatrix) int
- func MaskUtil_applyMaskPenaltyRule3(matrix *ByteMatrix) int
- func MaskUtil_applyMaskPenaltyRule4(matrix *ByteMatrix) int
- func MaskUtil_getDataMaskBit(maskPattern, x, y int) (bool, error)
- func MatrixUtil_buildMatrix(dataBits *gozxing.BitArray, ecLevel decoder.ErrorCorrectionLevel, ...) error
- func QRCode_IsValidMaskPattern(maskPattern int) bool
- type BlockPair
- type ByteMatrix
- func (this *ByteMatrix) Clear(value int8)
- func (this *ByteMatrix) Get(x, y int) int8
- func (this *ByteMatrix) GetArray() [][]int8
- func (this *ByteMatrix) GetHeight() int
- func (this *ByteMatrix) GetWidth() int
- func (this *ByteMatrix) Set(x, y int, value int8)
- func (this *ByteMatrix) SetBool(x, y int, value bool)
- func (this *ByteMatrix) String() string
- type QRCode
- func (this *QRCode) GetECLevel() decoder.ErrorCorrectionLevel
- func (this *QRCode) GetMaskPattern() int
- func (this *QRCode) GetMatrix() *ByteMatrix
- func (this *QRCode) GetMode() *decoder.Mode
- func (this *QRCode) GetVersion() *decoder.Version
- func (this *QRCode) SetECLevel(value decoder.ErrorCorrectionLevel)
- func (this *QRCode) SetMaskPattern(value int)
- func (this *QRCode) SetMatrix(value *ByteMatrix)
- func (this *QRCode) SetMode(value *decoder.Mode)
- func (this *QRCode) SetVersion(value *decoder.Version)
- func (this *QRCode) String() string
Constants ¶
const QRCode_NUM_MASK_PATERNS = 8
Variables ¶
var (
Encoder_DEFAULT_BYTE_MODE_ENCODING textencoding.Encoding = unicode.UTF8 // original default is "ISO-8859-1"
)
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 ¶
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.
Types ¶
type BlockPair ¶
type BlockPair struct {
// contains filtered or unexported fields
}
func NewBlockPair ¶
func (*BlockPair) GetDataBytes ¶
func (*BlockPair) GetErrorCorrectionBytes ¶
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 (*QRCode) GetECLevel ¶
func (this *QRCode) GetECLevel() decoder.ErrorCorrectionLevel
func (*QRCode) GetMaskPattern ¶
func (*QRCode) GetMatrix ¶
func (this *QRCode) GetMatrix() *ByteMatrix
func (*QRCode) GetVersion ¶
func (*QRCode) SetECLevel ¶
func (this *QRCode) SetECLevel(value decoder.ErrorCorrectionLevel)
func (*QRCode) SetMaskPattern ¶
func (*QRCode) SetMatrix ¶
func (this *QRCode) SetMatrix(value *ByteMatrix)