33 int mappingRow, mappingCol;
34 int dataRegionRows, dataRegionCols;
35 int symbolRows, mappingCols;
42 symbolRowReverse = symbolRows - symbolRow - 1;
43 mappingRow = symbolRowReverse - 1 - 2 * (symbolRowReverse / (dataRegionRows + 2));
44 mappingCol = symbolCol - 1 - 2 * (symbolCol / (dataRegionCols + 2));
47 if (symbolRow % (dataRegionRows + 2) == 0 || symbolCol % (dataRegionCols + 2) == 0) {
52 if ((symbolRow + 1) % (dataRegionRows + 2) == 0) {
57 if ((symbolCol + 1) % (dataRegionCols + 2) == 0) {
77 int mappingRows, mappingCols;
91 if ((row == mappingRows) && (col == 0)) {
93 }
else if ((row == mappingRows - 2) && (col == 0) && (mappingCols % 4 != 0)) {
95 }
else if ((row == mappingRows - 2) && (col == 0) && (mappingCols % 8 == 4)) {
97 }
else if ((row == mappingRows + 4) && (col == 2) && (mappingCols % 8 == 0)) {
103 if ((row < mappingRows) && (col >= 0) && !(modules[row * mappingCols + col] &
DmtxModuleVisited)) {
104 patternShapeStandard(modules, mappingRows, mappingCols, row, col, &(codewords[chr++]), moduleOnColor);
108 }
while ((row >= 0) && (col < mappingCols));
114 if ((row >= 0) && (col < mappingCols) && !(modules[row * mappingCols + col] &
DmtxModuleVisited)) {
115 patternShapeStandard(modules, mappingRows, mappingCols, row, col, &(codewords[chr++]), moduleOnColor);
119 }
while ((row < mappingRows) && (col >= 0));
123 }
while ((row < mappingRows) || (col < mappingCols));
127 modules[mappingRows * mappingCols - 1] |= moduleOnColor;
128 modules[(mappingRows * mappingCols) - mappingCols - 2] |= moduleOnColor;
153 unsigned char *codeword,
int moduleOnColor)
186static void patternShapeSpecial1(
unsigned char *modules,
int mappingRows,
int mappingCols,
unsigned char *codeword,
221static void patternShapeSpecial2(
unsigned char *modules,
int mappingRows,
int mappingCols,
unsigned char *codeword,
257static void patternShapeSpecial3(
unsigned char *modules,
int mappingRows,
int mappingCols,
unsigned char *codeword,
295static void patternShapeSpecial4(
unsigned char *modules,
int mappingRows,
int mappingCols,
unsigned char *codeword,
324static void placeModule(
unsigned char *modules,
int mappingRows,
int mappingCols,
int row,
int col,
325 unsigned char *codeword,
int mask,
int moduleOnColor)
329 col += 4 - ((mappingRows + 4) % 8);
333 row += 4 - ((mappingCols + 4) % 8);
337 if ((modules[row * mappingCols + col] & moduleOnColor) != 0) {
340 *codeword &= (0xff ^ mask);
343 if ((*codeword & mask) != 0x00) {
344 modules[row * mappingCols + col] |= moduleOnColor;
libdmtx - Data Matrix Encoding/Decoding Library Copyright 2008, 2009 Mike Laughton.
int dmtxGetSymbolAttribute(int attribute, int sizeIdx)
根据规格索引返回二维码规格各个参数
#define DmtxModuleAssigned
已分配
@ DmtxSymAttribSymbolRows
二维码码元总行数(包括L形框和点线)
@ DmtxSymAttribDataRegionCols
单区块二维码数据区码元列数(不包括L形框和点线)
@ DmtxSymAttribMappingMatrixRows
二维码数据区码元总行数(不包括L形框和点线)
@ DmtxSymAttribDataRegionRows
单区块二维码数据区码元行数(不包括L形框和点线)
@ DmtxSymAttribMappingMatrixCols
二维码数据区码元总列数(不包括L形框和点线)
#define DmtxModuleOnBlue
蓝
#define DmtxModuleOnRGB
OnRed | OnGreen | OnBlue.
#define DmtxModuleVisited
已访问
#define DmtxModuleOnGreen
绿
int dmtxSymbolModuleStatus(DmtxMessage *message, int sizeIdx, int symbolRow, int symbolCol)
receives symbol row and col and returns status DmtxModuleOn / !DmtxModuleOn (DmtxModuleOff) DmtxModul...
static void patternShapeStandard(unsigned char *modules, int mappingRows, int mappingCols, int row, int col, unsigned char *codeword, int moduleOnColor)
将标准码字放置到指定的模块位置
static void placeModule(unsigned char *modules, int mappingRows, int mappingCols, int row, int col, unsigned char *codeword, int mask, int moduleOnColor)
位模块放置
static void patternShapeSpecial3(unsigned char *modules, int mappingRows, int mappingCols, unsigned char *codeword, int moduleOnColor)
特殊排布3
static void patternShapeSpecial4(unsigned char *modules, int mappingRows, int mappingCols, unsigned char *codeword, int moduleOnColor)
特殊排布4
static void patternShapeSpecial2(unsigned char *modules, int mappingRows, int mappingCols, unsigned char *codeword, int moduleOnColor)
特殊排布2
static int modulePlacementEcc200(INOUT unsigned char *modules, OUT unsigned char *codewords, int sizeIdx, int moduleOnColor)
通过DataMatrix数据区的二进制矩阵,根据DataMatrix的排列规则,得到码字(codewords)
static void patternShapeSpecial1(unsigned char *modules, int mappingRows, int mappingCols, unsigned char *codeword, int moduleOnColor)
特殊排布1
libdmtx - Data Matrix Encoding/Decoding Library Copyright 2008, 2009 Mike Laughton.
unsigned char * array
指向DataMatrix数据区二进制矩阵的指针