encoder

package
v1.39.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StringUtils_ASSUME_SHIFT_JIS = false
	// Retained for ABI compatibility with earlier versions
	StringUtils_SHIFT_JIS = "SJIS"
	StringUtils_GB2312    = "GB2312"
)
View Source
const QRCode_NUM_MASK_PATERNS = 8

Variables

View Source
var (
	CharacterSetECI_Cp437     = newCharsetECI([]int{0, 2}, charmap.CodePage437, "Cp437")
	CharacterSetECI_ISO8859_1 = newCharsetECI([]int{1, 3}, charmap.ISO8859_1, "ISO-8859-1", "ISO8859_1")
	CharacterSetECI_ISO8859_2 = newCharsetECI([]int{4}, charmap.ISO8859_2, "ISO-8859-2", "ISO8859_2")
	CharacterSetECI_ISO8859_3 = newCharsetECI([]int{5}, charmap.ISO8859_3, "ISO-8859-3", "ISO8859_3")
	CharacterSetECI_ISO8859_4 = newCharsetECI([]int{6}, charmap.ISO8859_4, "ISO-8859-4", "ISO8859_4")
	CharacterSetECI_ISO8859_5 = newCharsetECI([]int{7}, charmap.ISO8859_5, "ISO-8859-5", "ISO8859_5")
	//CharacterSetECI_ISO8859_6  = newCharsetECI([]int{8}, charmap.ISO8859_6, "ISO-8859-6", "ISO8859_6")
	CharacterSetECI_ISO8859_7 = newCharsetECI([]int{9}, charmap.ISO8859_7, "ISO-8859-7", "ISO8859_7")
	//CharacterSetECI_ISO8859_8  = newCharsetECI([]int{10}, charmap.ISO8859_8, "ISO-8859-8", "ISO8859_8")
	CharacterSetECI_ISO8859_9 = newCharsetECI([]int{11}, charmap.ISO8859_9, "ISO-8859-9", "ISO8859_9")

	CharacterSetECI_ISO8859_13 = newCharsetECI([]int{15}, charmap.ISO8859_13, "ISO-8859-13", "ISO8859_13")
	//CharacterSetECI_ISO8859_14         = newCharsetECI([]int{16}, charmap.ISO8859_14, "ISO-8859-14", "ISO8859_14")
	CharacterSetECI_ISO8859_15         = newCharsetECI([]int{17}, charmap.ISO8859_15, "ISO-8859-15", "ISO8859_15")
	CharacterSetECI_ISO8859_16         = newCharsetECI([]int{18}, charmap.ISO8859_16, "ISO-8859-16", "ISO8859_16")
	CharacterSetECI_SJIS               = newCharsetECI([]int{20}, japanese.ShiftJIS, "Shift_JIS", "SJIS")
	CharacterSetECI_Cp1250             = newCharsetECI([]int{21}, charmap.Windows1250, "windows-1250", "Cp1250")
	CharacterSetECI_Cp1251             = newCharsetECI([]int{22}, charmap.Windows1251, "windows-1251", "Cp1251")
	CharacterSetECI_Cp1252             = newCharsetECI([]int{23}, charmap.Windows1252, "windows-1252", "Cp1252")
	CharacterSetECI_Cp1256             = newCharsetECI([]int{24}, charmap.Windows1256, "windows-1256", "Cp1256")
	CharacterSetECI_UnicodeBigUnmarked = newCharsetECI([]int{25}, utf16beEnc, "UTF-16BE", "UnicodeBig", "UnicodeBigUnmarked")
	CharacterSetECI_UTF8               = newCharsetECI([]int{26}, unicode.UTF8, "UTF-8", "UTF8")
	CharacterSetECI_ASCII              = newCharsetECI([]int{27, 170}, asciiEnc, "ASCII", "US-ASCII")
	CharacterSetECI_Big5               = newCharsetECI([]int{28}, traditionalchinese.Big5, "Big5")
	CharacterSetECI_GB18030            = newCharsetECI([]int{29}, simplifiedchinese.GB18030, "GB18030", "GB2312", "EUC_CN", "GBK") // BG18030 is upward compatible with others
	CharacterSetECI_EUC_KR             = newCharsetECI([]int{30}, korean.EUCKR, "EUC-KR", "EUC_KR")
)
View Source
var (
	Mode_TERMINATOR           = NewMode([]int{0, 0, 0}, 0x00) // Not really a mode...
	Mode_NUMERIC              = NewMode([]int{10, 12, 14}, 0x01)
	Mode_ALPHANUMERIC         = NewMode([]int{9, 11, 13}, 0x02)
	Mode_STRUCTURED_APPEND    = NewMode([]int{0, 0, 0}, 0x03) // Not supported
	Mode_BYTE                 = NewMode([]int{8, 16, 16}, 0x04)
	Mode_ECI                  = NewMode([]int{0, 0, 0}, 0x07) // character counts don't apply
	Mode_KANJI                = NewMode([]int{8, 10, 12}, 0x08)
	Mode_FNC1_FIRST_POSITION  = NewMode([]int{0, 0, 0}, 0x05)
	Mode_FNC1_SECOND_POSITION = NewMode([]int{0, 0, 0}, 0x09)
	/** See GBT 18284-2000; "Hanzi" is a transliteration of this mode name. */
	Mode_HANZI = NewMode([]int{8, 10, 12}, 0x0D)
)
View Source
var (
	StringUtils_PLATFORM_DEFAULT_ENCODING = unicode.UTF8
	StringUtils_SHIFT_JIS_CHARSET         = japanese.ShiftJIS         // "SJIS"
	StringUtils_GB2312_CHARSET            = simplifiedchinese.GB18030 // "GB2312"
	StringUtils_EUC_JP                    = japanese.EUCJP            // "EUC_JP"
)
View Source
var (
	Encoder_DEFAULT_BYTE_MODE_ENCODING textencoding.Encoding = unicode.UTF8 // original default is "ISO-8859-1"
)
View Source
var VERSIONS = []*Version{
	NewVersion(1, []int{},
		ECBlocks{7, []ECB{{1, 19}}},
		ECBlocks{10, []ECB{{1, 16}}},
		ECBlocks{13, []ECB{{1, 13}}},
		ECBlocks{17, []ECB{{1, 9}}}),
	NewVersion(2, []int{6, 18},
		ECBlocks{10, []ECB{{1, 34}}},
		ECBlocks{16, []ECB{{1, 28}}},
		ECBlocks{22, []ECB{{1, 22}}},
		ECBlocks{28, []ECB{{1, 16}}}),
	NewVersion(3, []int{6, 22},
		ECBlocks{15, []ECB{{1, 55}}},
		ECBlocks{26, []ECB{{1, 44}}},
		ECBlocks{18, []ECB{{2, 17}}},
		ECBlocks{22, []ECB{{2, 13}}}),
	NewVersion(4, []int{6, 26},
		ECBlocks{20, []ECB{{1, 80}}},
		ECBlocks{18, []ECB{{2, 32}}},
		ECBlocks{26, []ECB{{2, 24}}},
		ECBlocks{16, []ECB{{4, 9}}}),
	NewVersion(5, []int{6, 30},
		ECBlocks{26, []ECB{{1, 108}}},
		ECBlocks{24, []ECB{{2, 43}}},
		ECBlocks{18, []ECB{{2, 15}, {2, 16}}},
		ECBlocks{22, []ECB{{2, 11}, {2, 12}}}),
	NewVersion(6, []int{6, 34},
		ECBlocks{18, []ECB{{2, 68}}},
		ECBlocks{16, []ECB{{4, 27}}},
		ECBlocks{24, []ECB{{4, 19}}},
		ECBlocks{28, []ECB{{4, 15}}}),
	NewVersion(7, []int{6, 22, 38},
		ECBlocks{20, []ECB{{2, 78}}},
		ECBlocks{18, []ECB{{4, 31}}},
		ECBlocks{18, []ECB{{2, 14}, {4, 15}}},
		ECBlocks{26, []ECB{{4, 13}, {1, 14}}}),
	NewVersion(8, []int{6, 24, 42},
		ECBlocks{24, []ECB{{2, 97}}},
		ECBlocks{22, []ECB{{2, 38}, {2, 39}}},
		ECBlocks{22, []ECB{{4, 18}, {2, 19}}},
		ECBlocks{26, []ECB{{4, 14}, {2, 15}}}),
	NewVersion(9, []int{6, 26, 46},
		ECBlocks{30, []ECB{{2, 116}}},
		ECBlocks{22, []ECB{{3, 36}, {2, 37}}},
		ECBlocks{20, []ECB{{4, 16}, {4, 17}}},
		ECBlocks{24, []ECB{{4, 12}, {4, 13}}}),
	NewVersion(10, []int{6, 28, 50},
		ECBlocks{18, []ECB{{2, 68}, {2, 69}}},
		ECBlocks{26, []ECB{{4, 43}, {1, 44}}},
		ECBlocks{24, []ECB{{6, 19}, {2, 20}}},
		ECBlocks{28, []ECB{{6, 15}, {2, 16}}}),
	NewVersion(11, []int{6, 30, 54},
		ECBlocks{20, []ECB{{4, 81}}},
		ECBlocks{30, []ECB{{1, 50}, {4, 51}}},
		ECBlocks{28, []ECB{{4, 22}, {4, 23}}},
		ECBlocks{24, []ECB{{3, 12}, {8, 13}}}),
	NewVersion(12, []int{6, 32, 58},
		ECBlocks{24, []ECB{{2, 92}, {2, 93}}},
		ECBlocks{22, []ECB{{6, 36}, {2, 37}}},
		ECBlocks{26, []ECB{{4, 20}, {6, 21}}},
		ECBlocks{28, []ECB{{7, 14}, {4, 15}}}),
	NewVersion(13, []int{6, 34, 62},
		ECBlocks{26, []ECB{{4, 107}}},
		ECBlocks{22, []ECB{{8, 37}, {1, 38}}},
		ECBlocks{24, []ECB{{8, 20}, {4, 21}}},
		ECBlocks{22, []ECB{{12, 11}, {4, 12}}}),
	NewVersion(14, []int{6, 26, 46, 66},
		ECBlocks{30, []ECB{{3, 115}, {1, 116}}},
		ECBlocks{24, []ECB{{4, 40}, {5, 41}}},
		ECBlocks{20, []ECB{{11, 16}, {5, 17}}},
		ECBlocks{24, []ECB{{11, 12}, {5, 13}}}),
	NewVersion(15, []int{6, 26, 48, 70},
		ECBlocks{22, []ECB{{5, 87}, {1, 88}}},
		ECBlocks{24, []ECB{{5, 41}, {5, 42}}},
		ECBlocks{30, []ECB{{5, 24}, {7, 25}}},
		ECBlocks{24, []ECB{{11, 12}, {7, 13}}}),
	NewVersion(16, []int{6, 26, 50, 74},
		ECBlocks{24, []ECB{{5, 98}, {1, 99}}},
		ECBlocks{28, []ECB{{7, 45}, {3, 46}}},
		ECBlocks{24, []ECB{{15, 19}, {2, 20}}},
		ECBlocks{30, []ECB{{3, 15}, {13, 16}}}),
	NewVersion(17, []int{6, 30, 54, 78},
		ECBlocks{28, []ECB{{1, 107}, {5, 108}}},
		ECBlocks{28, []ECB{{10, 46}, {1, 47}}},
		ECBlocks{28, []ECB{{1, 22}, {15, 23}}},
		ECBlocks{28, []ECB{{2, 14}, {17, 15}}}),
	NewVersion(18, []int{6, 30, 56, 82},
		ECBlocks{30, []ECB{{5, 120}, {1, 121}}},
		ECBlocks{26, []ECB{{9, 43}, {4, 44}}},
		ECBlocks{28, []ECB{{17, 22}, {1, 23}}},
		ECBlocks{28, []ECB{{2, 14}, {19, 15}}}),
	NewVersion(19, []int{6, 30, 58, 86},
		ECBlocks{28, []ECB{{3, 113}, {4, 114}}},
		ECBlocks{26, []ECB{{3, 44}, {11, 45}}},
		ECBlocks{26, []ECB{{17, 21}, {4, 22}}},
		ECBlocks{26, []ECB{{9, 13}, {16, 14}}}),
	NewVersion(20, []int{6, 34, 62, 90},
		ECBlocks{28, []ECB{{3, 107}, {5, 108}}},
		ECBlocks{26, []ECB{{3, 41}, {13, 42}}},
		ECBlocks{30, []ECB{{15, 24}, {5, 25}}},
		ECBlocks{28, []ECB{{15, 15}, {10, 16}}}),
	NewVersion(21, []int{6, 28, 50, 72, 94},
		ECBlocks{28, []ECB{{4, 116}, {4, 117}}},
		ECBlocks{26, []ECB{{17, 42}}},
		ECBlocks{28, []ECB{{17, 22}, {6, 23}}},
		ECBlocks{30, []ECB{{19, 16}, {6, 17}}}),
	NewVersion(22, []int{6, 26, 50, 74, 98},
		ECBlocks{28, []ECB{{2, 111}, {7, 112}}},
		ECBlocks{28, []ECB{{17, 46}}},
		ECBlocks{30, []ECB{{7, 24}, {16, 25}}},
		ECBlocks{24, []ECB{{34, 13}}}),
	NewVersion(23, []int{6, 30, 54, 78, 102},
		ECBlocks{30, []ECB{{4, 121}, {5, 122}}},
		ECBlocks{28, []ECB{{4, 47}, {14, 48}}},
		ECBlocks{30, []ECB{{11, 24}, {14, 25}}},
		ECBlocks{30, []ECB{{16, 15}, {14, 16}}}),
	NewVersion(24, []int{6, 28, 54, 80, 106},
		ECBlocks{30, []ECB{{6, 117}, {4, 118}}},
		ECBlocks{28, []ECB{{6, 45}, {14, 46}}},
		ECBlocks{30, []ECB{{11, 24}, {16, 25}}},
		ECBlocks{30, []ECB{{30, 16}, {2, 17}}}),
	NewVersion(25, []int{6, 32, 58, 84, 110},
		ECBlocks{26, []ECB{{8, 106}, {4, 107}}},
		ECBlocks{28, []ECB{{8, 47}, {13, 48}}},
		ECBlocks{30, []ECB{{7, 24}, {22, 25}}},
		ECBlocks{30, []ECB{{22, 15}, {13, 16}}}),
	NewVersion(26, []int{6, 30, 58, 86, 114},
		ECBlocks{28, []ECB{{10, 114}, {2, 115}}},
		ECBlocks{28, []ECB{{19, 46}, {4, 47}}},
		ECBlocks{28, []ECB{{28, 22}, {6, 23}}},
		ECBlocks{30, []ECB{{33, 16}, {4, 17}}}),
	NewVersion(27, []int{6, 34, 62, 90, 118},
		ECBlocks{30, []ECB{{8, 122}, {4, 123}}},
		ECBlocks{28, []ECB{{22, 45}, {3, 46}}},
		ECBlocks{30, []ECB{{8, 23}, {26, 24}}},
		ECBlocks{30, []ECB{{12, 15}, {28, 16}}}),
	NewVersion(28, []int{6, 26, 50, 74, 98, 122},
		ECBlocks{30, []ECB{{3, 117}, {10, 118}}},
		ECBlocks{28, []ECB{{3, 45}, {23, 46}}},
		ECBlocks{30, []ECB{{4, 24}, {31, 25}}},
		ECBlocks{30, []ECB{{11, 15}, {31, 16}}}),
	NewVersion(29, []int{6, 30, 54, 78, 102, 126},
		ECBlocks{30, []ECB{{7, 116}, {7, 117}}},
		ECBlocks{28, []ECB{{21, 45}, {7, 46}}},
		ECBlocks{30, []ECB{{1, 23}, {37, 24}}},
		ECBlocks{30, []ECB{{19, 15}, {26, 16}}}),
	NewVersion(30, []int{6, 26, 52, 78, 104, 130},
		ECBlocks{30, []ECB{{5, 115}, {10, 116}}},
		ECBlocks{28, []ECB{{19, 47}, {10, 48}}},
		ECBlocks{30, []ECB{{15, 24}, {25, 25}}},
		ECBlocks{30, []ECB{{23, 15}, {25, 16}}}),
	NewVersion(31, []int{6, 30, 56, 82, 108, 134},
		ECBlocks{30, []ECB{{13, 115}, {3, 116}}},
		ECBlocks{28, []ECB{{2, 46}, {29, 47}}},
		ECBlocks{30, []ECB{{42, 24}, {1, 25}}},
		ECBlocks{30, []ECB{{23, 15}, {28, 16}}}),
	NewVersion(32, []int{6, 34, 60, 86, 112, 138},
		ECBlocks{30, []ECB{{17, 115}}},
		ECBlocks{28, []ECB{{10, 46}, {23, 47}}},
		ECBlocks{30, []ECB{{10, 24}, {35, 25}}},
		ECBlocks{30, []ECB{{19, 15}, {35, 16}}}),
	NewVersion(33, []int{6, 30, 58, 86, 114, 142},
		ECBlocks{30, []ECB{{17, 115}, {1, 116}}},
		ECBlocks{28, []ECB{{14, 46}, {21, 47}}},
		ECBlocks{30, []ECB{{29, 24}, {19, 25}}},
		ECBlocks{30, []ECB{{11, 15}, {46, 16}}}),
	NewVersion(34, []int{6, 34, 62, 90, 118, 146},
		ECBlocks{30, []ECB{{13, 115}, {6, 116}}},
		ECBlocks{28, []ECB{{14, 46}, {23, 47}}},
		ECBlocks{30, []ECB{{44, 24}, {7, 25}}},
		ECBlocks{30, []ECB{{59, 16}, {1, 17}}}),
	NewVersion(35, []int{6, 30, 54, 78, 102, 126, 150},
		ECBlocks{30, []ECB{{12, 121}, {7, 122}}},
		ECBlocks{28, []ECB{{12, 47}, {26, 48}}},
		ECBlocks{30, []ECB{{39, 24}, {14, 25}}},
		ECBlocks{30, []ECB{{22, 15}, {41, 16}}}),
	NewVersion(36, []int{6, 24, 50, 76, 102, 128, 154},
		ECBlocks{30, []ECB{{6, 121}, {14, 122}}},
		ECBlocks{28, []ECB{{6, 47}, {34, 48}}},
		ECBlocks{30, []ECB{{46, 24}, {10, 25}}},
		ECBlocks{30, []ECB{{2, 15}, {64, 16}}}),
	NewVersion(37, []int{6, 28, 54, 80, 106, 132, 158},
		ECBlocks{30, []ECB{{17, 122}, {4, 123}}},
		ECBlocks{28, []ECB{{29, 46}, {14, 47}}},
		ECBlocks{30, []ECB{{49, 24}, {10, 25}}},
		ECBlocks{30, []ECB{{24, 15}, {46, 16}}}),
	NewVersion(38, []int{6, 32, 58, 84, 110, 136, 162},
		ECBlocks{30, []ECB{{4, 122}, {18, 123}}},
		ECBlocks{28, []ECB{{13, 46}, {32, 47}}},
		ECBlocks{30, []ECB{{48, 24}, {14, 25}}},
		ECBlocks{30, []ECB{{42, 15}, {32, 16}}}),
	NewVersion(39, []int{6, 26, 54, 82, 110, 138, 166},
		ECBlocks{30, []ECB{{20, 117}, {4, 118}}},
		ECBlocks{28, []ECB{{40, 47}, {7, 48}}},
		ECBlocks{30, []ECB{{43, 24}, {22, 25}}},
		ECBlocks{30, []ECB{{10, 15}, {67, 16}}}),
	NewVersion(40, []int{6, 30, 58, 86, 114, 142, 170},
		ECBlocks{30, []ECB{{19, 118}, {6, 119}}},
		ECBlocks{28, []ECB{{18, 47}, {31, 48}}},
		ECBlocks{30, []ECB{{34, 24}, {34, 25}}},
		ECBlocks{30, []ECB{{20, 15}, {61, 16}}}),
}
View Source
var VERSION_DECODE_INFO = []int{
	0x07C94, 0x085BC, 0x09A99, 0x0A4D3, 0x0BBF6,
	0x0C762, 0x0D847, 0x0E60D, 0x0F928, 0x10B78,
	0x1145D, 0x12A17, 0x13532, 0x149A6, 0x15683,
	0x168C9, 0x177EC, 0x18EC4, 0x191E1, 0x1AFAB,
	0x1B08E, 0x1CC1A, 0x1D33F, 0x1ED75, 0x1F250,
	0x209D5, 0x216F0, 0x228BA, 0x2379F, 0x24B0B,
	0x2542E, 0x26A64, 0x27541, 0x28C69,
}

Functions

func FormatInformation_NumBitsDiffering

func FormatInformation_NumBitsDiffering(a, b uint) int

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 *utils.BitArray,
	ecLevel ErrorCorrectionLevel,
	version *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 (bp *BlockPair) GetDataBytes() []byte

func (*BlockPair) GetErrorCorrectionBytes

func (bp *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 (m *ByteMatrix) Clear(value int8)

func (*ByteMatrix) Get

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

func (*ByteMatrix) GetArray

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

func (*ByteMatrix) GetHeight

func (m *ByteMatrix) GetHeight() int

func (*ByteMatrix) GetWidth

func (m *ByteMatrix) GetWidth() int

func (*ByteMatrix) Set

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

func (*ByteMatrix) SetBool

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

func (*ByteMatrix) String

func (m *ByteMatrix) String() string

type CharacterSetECI

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

func GetCharacterSetECI

func GetCharacterSetECI(charset encoding.Encoding) (*CharacterSetECI, bool)

func GetCharacterSetECIByName

func GetCharacterSetECIByName(name string) (*CharacterSetECI, bool)

func GetCharacterSetECIByValue

func GetCharacterSetECIByValue(value int) (*CharacterSetECI, error)

func (*CharacterSetECI) GetCharset

func (eci *CharacterSetECI) GetCharset() encoding.Encoding

func (*CharacterSetECI) GetValue

func (eci *CharacterSetECI) GetValue() int

func (*CharacterSetECI) Name

func (eci *CharacterSetECI) Name() string

type ECB

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

func (ECB) GetCount

func (e ECB) GetCount() int

func (ECB) GetDataCodewords

func (e ECB) GetDataCodewords() int

type ECBlocks

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

func (*ECBlocks) GetECBlocks

func (b *ECBlocks) GetECBlocks() []ECB

func (*ECBlocks) GetECCodewordsPerBlock

func (b *ECBlocks) GetECCodewordsPerBlock() int

func (*ECBlocks) GetNumBlocks

func (b *ECBlocks) GetNumBlocks() int

func (*ECBlocks) GetTotalECCodewords

func (b *ECBlocks) GetTotalECCodewords() int

type ErrorCorrectionLevel

type ErrorCorrectionLevel int
const (
	ErrorCorrectionLevel_L ErrorCorrectionLevel = 0x01 // ~7% correction
	ErrorCorrectionLevel_M ErrorCorrectionLevel = 0x00 // ~15% correction
	ErrorCorrectionLevel_Q ErrorCorrectionLevel = 0x03 // ~25% correction
	ErrorCorrectionLevel_H ErrorCorrectionLevel = 0x02 // ~30% correction
)

func ErrorCorrectionLevel_ForBits

func ErrorCorrectionLevel_ForBits(bits uint) (ErrorCorrectionLevel, error)

func ErrorCorrectionLevel_ValueOf

func ErrorCorrectionLevel_ValueOf(s string) (ErrorCorrectionLevel, error)

func (ErrorCorrectionLevel) GetBits

func (e ErrorCorrectionLevel) GetBits() int

func (ErrorCorrectionLevel) String

func (e ErrorCorrectionLevel) String() string

type FormatInformation

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

func FormatInformation_DecodeFormatInformation

func FormatInformation_DecodeFormatInformation(maskedFormatInfo1, maskedFormatInfo2 uint) *FormatInformation

func (*FormatInformation) GetDataMask

func (f *FormatInformation) GetDataMask() byte

func (*FormatInformation) GetErrorCorrectionLevel

func (f *FormatInformation) GetErrorCorrectionLevel() ErrorCorrectionLevel

type Mode

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

func ModeForBits

func ModeForBits(bits int) (*Mode, error)

func NewMode

func NewMode(characterCountBitsForVersions []int, bits int) *Mode

func (*Mode) GetBits

func (m *Mode) GetBits() int

func (*Mode) GetCharacterCountBits

func (m *Mode) GetCharacterCountBits(version *Version) int

func (*Mode) String

func (m *Mode) String() string

type Options

type Options struct {
	Mode             *Mode
	CharacterSetName string
	AppendGS1        bool
	VersionNumber    int
	MaskPattern      *int
	QuietZone        int
}

type QRCode

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

func Encoder_encode

func Encoder_encode(content string, ecLevel ErrorCorrectionLevel, opts Options) (*QRCode, error)

func NewQRCode

func NewQRCode() *QRCode

func (*QRCode) GetECLevel

func (code *QRCode) GetECLevel() ErrorCorrectionLevel

func (*QRCode) GetMaskPattern

func (code *QRCode) GetMaskPattern() int

func (*QRCode) GetMatrix

func (code *QRCode) GetMatrix() *ByteMatrix

func (*QRCode) GetMode

func (code *QRCode) GetMode() *Mode

func (*QRCode) GetVersion

func (code *QRCode) GetVersion() *Version

func (*QRCode) SetECLevel

func (code *QRCode) SetECLevel(value ErrorCorrectionLevel)

func (*QRCode) SetMaskPattern

func (code *QRCode) SetMaskPattern(value int)

func (*QRCode) SetMatrix

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

func (*QRCode) SetMode

func (code *QRCode) SetMode(value *Mode)

func (*QRCode) SetVersion

func (code *QRCode) SetVersion(value *Version)

func (*QRCode) String

func (code *QRCode) String() string

type Version

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

func NewVersion

func NewVersion(versionNumber int, alignmentPatternCenters []int, ecBlocks ...ECBlocks) *Version

func Version_GetProvisionalVersionForDimension

func Version_GetProvisionalVersionForDimension(dimension int) (*Version, error)

func Version_GetVersionForNumber

func Version_GetVersionForNumber(versionNumber int) (*Version, error)

func Version_decodeVersionInformation

func Version_decodeVersionInformation(versionBits int) (*Version, error)

func (*Version) GetAlignmentPatternCenters

func (v *Version) GetAlignmentPatternCenters() []int

func (*Version) GetDimensionForVersion

func (v *Version) GetDimensionForVersion() int

func (*Version) GetECBlocksForLevel

func (v *Version) GetECBlocksForLevel(ecLevel ErrorCorrectionLevel) *ECBlocks

func (*Version) GetTotalCodewords

func (v *Version) GetTotalCodewords() int

func (*Version) GetVersionNumber

func (v *Version) GetVersionNumber() int

func (*Version) String

func (v *Version) String() string

Jump to

Keyboard shortcuts

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