mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Merge rMQR support in to master
This commit is contained in:
commit
8295883987
@ -178,6 +178,7 @@ extern int dmatrix(struct zint_symbol *symbol, const unsigned char source[], con
|
||||
extern int vin(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* VIN Code (Vehicle Identification Number) */
|
||||
extern int mailmark(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* Royal Mail 4-state Mailmark */
|
||||
extern int ultracode(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* Ultracode */
|
||||
extern int rmqr(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* rMQR */
|
||||
|
||||
extern int plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_type); /* Plot to PNG/BMP/PCX */
|
||||
extern int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_type); /* Plot to EPS/EMF/SVG */
|
||||
@ -409,6 +410,7 @@ static int gs1_compliant(const int symbology) {
|
||||
case BARCODE_CODE49:
|
||||
case BARCODE_QRCODE:
|
||||
case BARCODE_DOTCODE:
|
||||
case BARCODE_RMQR:
|
||||
result = 1;
|
||||
break;
|
||||
}
|
||||
@ -435,6 +437,7 @@ static int is_matrix(const int symbology) {
|
||||
case BARCODE_HANXIN:
|
||||
case BARCODE_DOTCODE:
|
||||
case BARCODE_UPNQR:
|
||||
case BARCODE_RMQR:
|
||||
result = 1;
|
||||
break;
|
||||
}
|
||||
@ -628,6 +631,7 @@ int ZBarcode_ValidID(int symbol_id) {
|
||||
case BARCODE_VIN:
|
||||
case BARCODE_MAILMARK:
|
||||
case BARCODE_ULTRA:
|
||||
case BARCODE_RMQR:
|
||||
result = 1;
|
||||
break;
|
||||
}
|
||||
@ -652,6 +656,8 @@ static int extended_or_reduced_charset(struct zint_symbol *symbol, const unsigne
|
||||
break;
|
||||
case BARCODE_UPNQR: error_number = upnqr(symbol, source, length);
|
||||
break;
|
||||
case BARCODE_RMQR: error_number = rmqr(symbol, source, length);
|
||||
break;
|
||||
default: error_number = reduced_charset(symbol, source, length);
|
||||
break;
|
||||
}
|
||||
@ -1124,7 +1130,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int
|
||||
}
|
||||
}
|
||||
/* Everything from 128 up is Zint-specific */
|
||||
if (symbol->symbology >= 145) {
|
||||
if (symbol->symbology > 145) {
|
||||
strcpy(symbol->errtxt, "216: Symbology out of range, using Code 128");
|
||||
symbol->symbology = BARCODE_CODE128;
|
||||
error_number = ZINT_WARN_INVALID_OPTION;
|
||||
|
499
backend/qr.c
499
backend/qr.c
@ -1,8 +1,7 @@
|
||||
/* qr.c Handles QR Code */
|
||||
/* qr.c Handles QR Code, Micro QR Code, UPNQR and rMQR
|
||||
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2009 -2017 Robin Stuart <rstuart114@gmail.com>
|
||||
Copyright (C) 2009 - 2019 Robin Stuart <rstuart114@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
@ -151,7 +150,7 @@ static int tribus(const int version,const int a,const int b,const int c) {
|
||||
}
|
||||
|
||||
/* Convert input data to a binary stream and add padding */
|
||||
static void qr_binary(unsigned char datastream[], const int version, const int target_binlen, const char mode[], const unsigned int jisdata[], const size_t length,
|
||||
static void qr_binary(unsigned char datastream[], const int version, const int target_codewords, const char mode[], const unsigned int jisdata[], const size_t length,
|
||||
const int gs1, const int eci, const int est_binlen,const int debug) {
|
||||
int position = 0;
|
||||
int i;
|
||||
@ -168,10 +167,14 @@ static void qr_binary(unsigned char datastream[], const int version, const int t
|
||||
strcpy(binary, "");
|
||||
|
||||
if (gs1) {
|
||||
if (version < RMQR_VERSION) {
|
||||
strcat(binary, "0101"); /* FNC1 */
|
||||
} else {
|
||||
strcat(binary, "101");
|
||||
}
|
||||
}
|
||||
|
||||
if (eci != 0) {
|
||||
if (eci != 0) { /* Not applicable to RMQR */
|
||||
strcat(binary, "0111"); /* ECI (Table 4) */
|
||||
if (eci <= 127) {
|
||||
bin_append(eci, 8, binary); /* 000000 to 000127 */
|
||||
@ -207,10 +210,18 @@ static void qr_binary(unsigned char datastream[], const int version, const int t
|
||||
case 'K':
|
||||
/* Kanji mode */
|
||||
/* Mode indicator */
|
||||
if (version < RMQR_VERSION) {
|
||||
strcat(binary, "1000");
|
||||
} else {
|
||||
strcat(binary, "100");
|
||||
}
|
||||
|
||||
/* Character count indicator */
|
||||
if (version < RMQR_VERSION) {
|
||||
bin_append(short_data_block_length, tribus(version, 8, 10, 12), binary);
|
||||
} else {
|
||||
bin_append(short_data_block_length, rmqr_kanji_cci[version - RMQR_VERSION], binary);
|
||||
}
|
||||
|
||||
if (debug & ZINT_DEBUG_PRINT) {
|
||||
printf("Kanji block (length %d)\n\t", short_data_block_length);
|
||||
@ -244,10 +255,18 @@ static void qr_binary(unsigned char datastream[], const int version, const int t
|
||||
case 'B':
|
||||
/* Byte mode */
|
||||
/* Mode indicator */
|
||||
if (version < RMQR_VERSION) {
|
||||
strcat(binary, "0100");
|
||||
} else {
|
||||
strcat(binary, "011");
|
||||
}
|
||||
|
||||
/* Character count indicator */
|
||||
if (version < RMQR_VERSION) {
|
||||
bin_append(short_data_block_length + double_byte, tribus(version, 8, 16, 16), binary);
|
||||
} else {
|
||||
bin_append(short_data_block_length + double_byte, rmqr_byte_cci[version - RMQR_VERSION], binary);
|
||||
}
|
||||
|
||||
if (debug & ZINT_DEBUG_PRINT) {
|
||||
printf("Byte block (length %d)\n\t", short_data_block_length + double_byte);
|
||||
@ -276,7 +295,11 @@ static void qr_binary(unsigned char datastream[], const int version, const int t
|
||||
case 'A':
|
||||
/* Alphanumeric mode */
|
||||
/* Mode indicator */
|
||||
if (version < RMQR_VERSION) {
|
||||
strcat(binary, "0010");
|
||||
} else {
|
||||
strcat(binary, "010");
|
||||
}
|
||||
|
||||
percent_count = 0;
|
||||
for (i = 0; i < short_data_block_length; i++) {
|
||||
@ -286,7 +309,11 @@ static void qr_binary(unsigned char datastream[], const int version, const int t
|
||||
}
|
||||
|
||||
/* Character count indicator */
|
||||
if (version < RMQR_VERSION) {
|
||||
bin_append(short_data_block_length + percent_count, tribus(version, 9, 11, 13), binary);
|
||||
} else {
|
||||
bin_append(short_data_block_length + percent_count, rmqr_alphanum_cci[version - RMQR_VERSION], binary);
|
||||
}
|
||||
|
||||
if (debug & ZINT_DEBUG_PRINT) {
|
||||
printf("Alpha block (length %d)\n\t", short_data_block_length + percent_count);
|
||||
@ -374,10 +401,18 @@ static void qr_binary(unsigned char datastream[], const int version, const int t
|
||||
case 'N':
|
||||
/* Numeric mode */
|
||||
/* Mode indicator */
|
||||
if (version >= RMQR_VERSION) {
|
||||
strcat(binary, "0001");
|
||||
} else {
|
||||
strcat(binary, "001");
|
||||
}
|
||||
|
||||
/* Character count indicator */
|
||||
if (version < RMQR_VERSION) {
|
||||
bin_append(short_data_block_length, tribus(version, 10, 12, 14), binary);
|
||||
} else {
|
||||
bin_append(short_data_block_length, rmqr_numeric_cci[version - RMQR_VERSION], binary);
|
||||
}
|
||||
|
||||
if (debug & ZINT_DEBUG_PRINT) {
|
||||
printf("Number block (length %d)\n\t", short_data_block_length);
|
||||
@ -425,7 +460,11 @@ static void qr_binary(unsigned char datastream[], const int version, const int t
|
||||
} while (position < length);
|
||||
|
||||
/* Terminator */
|
||||
if (version < RMQR_VERSION) {
|
||||
strcat(binary, "0000");
|
||||
} else {
|
||||
strcat(binary, "000");
|
||||
}
|
||||
|
||||
current_binlen = (int)strlen(binary);
|
||||
padbits = 8 - (current_binlen % 8);
|
||||
@ -452,7 +491,7 @@ static void qr_binary(unsigned char datastream[], const int version, const int t
|
||||
|
||||
/* Add pad codewords */
|
||||
toggle = 0;
|
||||
for (i = current_bytes; i < target_binlen; i++) {
|
||||
for (i = current_bytes; i < target_codewords; i++) {
|
||||
if (toggle == 0) {
|
||||
datastream[i] = 0xec;
|
||||
toggle = 1;
|
||||
@ -464,7 +503,7 @@ static void qr_binary(unsigned char datastream[], const int version, const int t
|
||||
|
||||
if (debug & ZINT_DEBUG_PRINT) {
|
||||
printf("Resulting codewords:\n\t");
|
||||
for (i = 0; i < target_binlen; i++) {
|
||||
for (i = 0; i < target_codewords; i++) {
|
||||
printf("0x%2X ", datastream[i]);
|
||||
}
|
||||
printf("\n");
|
||||
@ -473,7 +512,14 @@ static void qr_binary(unsigned char datastream[], const int version, const int t
|
||||
|
||||
/* Split data into blocks, add error correction and then interleave the blocks and error correction data */
|
||||
static void add_ecc(unsigned char fullstream[], const unsigned char datastream[], const int version, const int data_cw, const int blocks, int debug) {
|
||||
int ecc_cw = qr_total_codewords[version - 1] - data_cw;
|
||||
int ecc_cw;
|
||||
|
||||
if (version < RMQR_VERSION) {
|
||||
ecc_cw = qr_total_codewords[version - 1] - data_cw;
|
||||
} else {
|
||||
ecc_cw = rmqr_total_codewords[version - RMQR_VERSION] - data_cw;
|
||||
}
|
||||
|
||||
int short_data_block_length = data_cw / blocks;
|
||||
int qty_long_blocks = data_cw % blocks;
|
||||
int qty_short_blocks = blocks - qty_long_blocks;
|
||||
@ -678,36 +724,36 @@ static int cwbit(const unsigned char* fullstream, const int i) {
|
||||
return resultant;
|
||||
}
|
||||
|
||||
static void populate_grid(unsigned char* grid, const int size, const unsigned char* fullstream, const int cw) {
|
||||
static void populate_grid(unsigned char* grid, const int h_size, const int v_size, const unsigned char* fullstream, const int cw) {
|
||||
int direction = 1; /* up */
|
||||
int row = 0; /* right hand side */
|
||||
|
||||
int i, n, y;
|
||||
|
||||
n = cw * 8;
|
||||
y = size - 1;
|
||||
y = v_size - 1;
|
||||
i = 0;
|
||||
do {
|
||||
int x = (size - 2) - (row * 2);
|
||||
int x = (h_size - 2) - (row * 2);
|
||||
|
||||
if (x < 6)
|
||||
if ((x < 6) && (v_size == h_size))
|
||||
x--; /* skip over vertical timing pattern */
|
||||
|
||||
if (!(grid[(y * size) + (x + 1)] & 0xf0)) {
|
||||
if (!(grid[(y * h_size) + (x + 1)] & 0xf0)) {
|
||||
if (cwbit(fullstream, i)) {
|
||||
grid[(y * size) + (x + 1)] = 0x01;
|
||||
grid[(y * h_size) + (x + 1)] = 0x01;
|
||||
} else {
|
||||
grid[(y * size) + (x + 1)] = 0x00;
|
||||
grid[(y * h_size) + (x + 1)] = 0x00;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
if (i < n) {
|
||||
if (!(grid[(y * size) + x] & 0xf0)) {
|
||||
if (!(grid[(y * h_size) + x] & 0xf0)) {
|
||||
if (cwbit(fullstream, i)) {
|
||||
grid[(y * size) + x] = 0x01;
|
||||
grid[(y * h_size) + x] = 0x01;
|
||||
} else {
|
||||
grid[(y * size) + x] = 0x00;
|
||||
grid[(y * h_size) + x] = 0x00;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@ -724,10 +770,10 @@ static void populate_grid(unsigned char* grid, const int size, const unsigned ch
|
||||
y = 0;
|
||||
direction = 0;
|
||||
}
|
||||
if (y == size) {
|
||||
if (y == v_size) {
|
||||
/* reached the bottom */
|
||||
row++;
|
||||
y = size - 1;
|
||||
y = v_size - 1;
|
||||
direction = 1;
|
||||
}
|
||||
} while (i < n);
|
||||
@ -1344,10 +1390,14 @@ static int getBinaryLength(const int version, char inputMode[], const unsigned i
|
||||
currentMode = ' '; // Null
|
||||
|
||||
if (gs1 == 1) {
|
||||
if (version < RMQR_VERSION) {
|
||||
count += 4;
|
||||
} else {
|
||||
count += 3;
|
||||
}
|
||||
}
|
||||
|
||||
if (eci != 0) {
|
||||
if (eci != 0) { // RMQR does not support ECI
|
||||
count += 4;
|
||||
if (eci <= 127) {
|
||||
count += 8;
|
||||
@ -1363,11 +1413,19 @@ static int getBinaryLength(const int version, char inputMode[], const unsigned i
|
||||
count += 4;
|
||||
switch (inputMode[i]) {
|
||||
case 'K':
|
||||
if (version < RMQR_VERSION) {
|
||||
count += tribus(version, 8, 10, 12);
|
||||
} else {
|
||||
count += 3 + rmqr_kanji_cci[version - RMQR_VERSION];
|
||||
}
|
||||
count += (blockLength(i, inputMode, inputLength) * 13);
|
||||
break;
|
||||
case 'B':
|
||||
if (version < RMQR_VERSION) {
|
||||
count += tribus(version, 8, 16, 16);
|
||||
} else {
|
||||
count += 3 + rmqr_byte_cci[version - RMQR_VERSION];
|
||||
}
|
||||
for (j = i; j < (i + blockLength(i, inputMode, inputLength)); j++) {
|
||||
if (inputData[j] > 0xff) {
|
||||
count += 16;
|
||||
@ -1377,7 +1435,11 @@ static int getBinaryLength(const int version, char inputMode[], const unsigned i
|
||||
}
|
||||
break;
|
||||
case 'A':
|
||||
if (version < RMQR_VERSION) {
|
||||
count += tribus(version, 9, 11, 13);
|
||||
} else {
|
||||
count += 3 + rmqr_alphanum_cci[version - RMQR_VERSION];
|
||||
}
|
||||
alphalength = blockLength(i, inputMode, inputLength);
|
||||
// In alphanumeric mode % becomes %%
|
||||
for (j = i; j < (i + alphalength); j++) {
|
||||
@ -1397,7 +1459,11 @@ static int getBinaryLength(const int version, char inputMode[], const unsigned i
|
||||
}
|
||||
break;
|
||||
case 'N':
|
||||
if (version < RMQR_VERSION) {
|
||||
count += tribus(version, 10, 12, 14);
|
||||
} else {
|
||||
count += 3 + rmqr_numeric_cci[version - RMQR_VERSION];
|
||||
}
|
||||
switch (blockLength(i, inputMode, inputLength) % 3) {
|
||||
case 0:
|
||||
count += (blockLength(i, inputMode, inputLength) / 3) * 10;
|
||||
@ -1430,7 +1496,7 @@ static void qr_test_codeword_dump(struct zint_symbol *symbol, unsigned char* cod
|
||||
|
||||
int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
|
||||
int i, j, est_binlen;
|
||||
int ecc_level, autosize, version, max_cw, target_binlen, blocks, size;
|
||||
int ecc_level, autosize, version, max_cw, target_codewords, blocks, size;
|
||||
int bitmask, gs1;
|
||||
int canShrink;
|
||||
|
||||
@ -1594,31 +1660,31 @@ int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t len
|
||||
ecc_level = LEVEL_H;
|
||||
}
|
||||
|
||||
target_binlen = qr_data_codewords_L[version - 1];
|
||||
target_codewords = qr_data_codewords_L[version - 1];
|
||||
blocks = qr_blocks_L[version - 1];
|
||||
switch (ecc_level) {
|
||||
case LEVEL_M: target_binlen = qr_data_codewords_M[version - 1];
|
||||
case LEVEL_M: target_codewords = qr_data_codewords_M[version - 1];
|
||||
blocks = qr_blocks_M[version - 1];
|
||||
break;
|
||||
case LEVEL_Q: target_binlen = qr_data_codewords_Q[version - 1];
|
||||
case LEVEL_Q: target_codewords = qr_data_codewords_Q[version - 1];
|
||||
blocks = qr_blocks_Q[version - 1];
|
||||
break;
|
||||
case LEVEL_H: target_binlen = qr_data_codewords_H[version - 1];
|
||||
case LEVEL_H: target_codewords = qr_data_codewords_H[version - 1];
|
||||
blocks = qr_blocks_H[version - 1];
|
||||
break;
|
||||
}
|
||||
|
||||
#ifndef _MSC_VER
|
||||
unsigned char datastream[target_binlen + 1];
|
||||
unsigned char datastream[target_codewords + 1];
|
||||
unsigned char fullstream[qr_total_codewords[version - 1] + 1];
|
||||
#else
|
||||
datastream = (unsigned char *) _alloca(target_binlen + 1);
|
||||
datastream = (unsigned char *) _alloca(target_codewords + 1);
|
||||
fullstream = (unsigned char *) _alloca(qr_total_codewords[version - 1] + 1);
|
||||
#endif
|
||||
|
||||
qr_binary(datastream, version, target_binlen, mode, jisdata, length, gs1, symbol->eci, est_binlen, symbol->debug);
|
||||
if (symbol->debug & ZINT_DEBUG_TEST) qr_test_codeword_dump(symbol, datastream, target_binlen);
|
||||
add_ecc(fullstream, datastream, version, target_binlen, blocks, symbol->debug);
|
||||
qr_binary(datastream, version, target_codewords, mode, jisdata, length, gs1, symbol->eci, est_binlen, symbol->debug);
|
||||
if (symbol->debug & ZINT_DEBUG_TEST) qr_test_codeword_dump(symbol, datastream, target_codewords);
|
||||
add_ecc(fullstream, datastream, version, target_codewords, blocks, symbol->debug);
|
||||
|
||||
size = qr_sizes[version - 1];
|
||||
#ifndef _MSC_VER
|
||||
@ -1634,7 +1700,7 @@ int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t len
|
||||
}
|
||||
|
||||
setup_grid(grid, size, version);
|
||||
populate_grid(grid, size, fullstream, qr_total_codewords[version - 1]);
|
||||
populate_grid(grid, size, size, fullstream, qr_total_codewords[version - 1]);
|
||||
|
||||
if (version >= 7) {
|
||||
add_version_info(grid, size, version);
|
||||
@ -2906,7 +2972,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], size_t len
|
||||
/* For UPNQR the symbol size and error correction capacity is fixed */
|
||||
int upnqr(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
|
||||
int i, j, est_binlen;
|
||||
int ecc_level, version, target_binlen, blocks, size;
|
||||
int ecc_level, version, target_codewords, blocks, size;
|
||||
int bitmask, error_number;
|
||||
|
||||
#ifndef _MSC_VER
|
||||
@ -2964,20 +3030,19 @@ int upnqr(struct zint_symbol *symbol, const unsigned char source[], size_t lengt
|
||||
|
||||
version = 15; // 77 x 77
|
||||
|
||||
target_binlen = qr_data_codewords_M[version - 1];
|
||||
target_codewords = qr_data_codewords_M[version - 1];
|
||||
blocks = qr_blocks_M[version - 1];
|
||||
|
||||
#ifndef _MSC_VER
|
||||
unsigned char datastream[target_binlen + 1];
|
||||
unsigned char datastream[target_codewords + 1];
|
||||
unsigned char fullstream[qr_total_codewords[version - 1] + 1];
|
||||
#else
|
||||
datastream = (unsigned char *) _alloca(target_binlen + 1);
|
||||
datastream = (unsigned char *) _alloca(target_codewords + 1);
|
||||
fullstream = (unsigned char *) _alloca(qr_total_codewords[version - 1] + 1);
|
||||
#endif
|
||||
|
||||
qr_binary(datastream, version, target_binlen, mode, jisdata, length, 0, symbol->eci, est_binlen, symbol->debug);
|
||||
if (symbol->debug & ZINT_DEBUG_TEST) qr_test_codeword_dump(symbol, datastream, target_binlen);
|
||||
add_ecc(fullstream, datastream, version, target_binlen, blocks, symbol->debug);
|
||||
qr_binary(datastream, version, target_codewords, mode, jisdata, length, 0, symbol->eci, est_binlen, symbol->debug);
|
||||
if (symbol->debug & ZINT_DEBUG_TEST) qr_test_codeword_dump(symbol, datastream, target_codewords);
|
||||
add_ecc(fullstream, datastream, version, target_codewords, blocks, symbol->debug);
|
||||
|
||||
size = qr_sizes[version - 1];
|
||||
#ifndef _MSC_VER
|
||||
@ -2993,7 +3058,7 @@ int upnqr(struct zint_symbol *symbol, const unsigned char source[], size_t lengt
|
||||
}
|
||||
|
||||
setup_grid(grid, size, version);
|
||||
populate_grid(grid, size, fullstream, qr_total_codewords[version - 1]);
|
||||
populate_grid(grid, size, size, fullstream, qr_total_codewords[version - 1]);
|
||||
|
||||
add_version_info(grid, size, version);
|
||||
|
||||
@ -3016,4 +3081,356 @@ int upnqr(struct zint_symbol *symbol, const unsigned char source[], size_t lengt
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void setup_rmqr_grid(unsigned char* grid,const int h_size,const int v_size,const int version) {
|
||||
int i, j;
|
||||
char alignment[] = {0x1F, 0x11, 0x15, 0x11, 0x1F};
|
||||
int h_version, finder_position;
|
||||
|
||||
/* Add timing patterns - top and bottom */
|
||||
for (i = 0; i < h_size; i++) {
|
||||
if (i % 2) {
|
||||
grid[i] = 0x20;
|
||||
grid[((v_size - 1) * h_size) + i] = 0x20;
|
||||
} else {
|
||||
grid[i] = 0x21;
|
||||
grid[((v_size - 1) * h_size) + i] = 0x21;
|
||||
}
|
||||
}
|
||||
|
||||
/* Add timing patterns - left and right */
|
||||
for (i = 0; i < v_size; i++) {
|
||||
if (i % 2) {
|
||||
grid[i * h_size] = 0x20;
|
||||
grid[(i * h_size) + (h_size - 1)] = 0x20;
|
||||
} else {
|
||||
grid[i * h_size] = 0x21;
|
||||
grid[(i * h_size) + (h_size - 1)] = 0x21;
|
||||
}
|
||||
}
|
||||
|
||||
/* Add finder pattern */
|
||||
place_finder(grid, h_size, 0, 0); // This works because finder is always top left
|
||||
|
||||
/* Add finder sub-pattern to bottom right */
|
||||
for (i = 0; i < 5; i++) {
|
||||
for (j = 0; j < 5; j++) {
|
||||
if (alignment[j] & 0x10 >> i) {
|
||||
grid[((v_size - 5) * h_size) + (h_size * i) + (h_size - 5) + j] = 0x11;
|
||||
} else {
|
||||
grid[((v_size - 5) * h_size) + (h_size * i) + (h_size - 5) + j] = 0x10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Add corner finder pattern - bottom left */
|
||||
grid[(v_size - 2) * h_size] = 0x11;
|
||||
grid[((v_size - 2) * h_size) + 1] = 0x10;
|
||||
grid[((v_size - 1) * h_size) + 1] = 0x11;
|
||||
|
||||
/* Add corner finder pattern - top right */
|
||||
grid[h_size - 2] = 0x11;
|
||||
grid[(h_size * 2) - 2] = 0x10;
|
||||
grid[(h_size * 2) - 1] = 0x11;
|
||||
|
||||
/* Add seperator */
|
||||
for (i = 0; i < 7; i++) {
|
||||
grid[(i * h_size) + 7] = 0x20;
|
||||
}
|
||||
if (v_size > 7) {
|
||||
// Note for v_size = 9 this overrides the bottom right corner finder pattern
|
||||
for(i = 0; i < 8; i++) {
|
||||
grid[(7 * h_size) + i] = 0x20;
|
||||
}
|
||||
}
|
||||
|
||||
/* Add alignment patterns */
|
||||
if (h_size > 27) {
|
||||
for(i = 0; i < 5; i++) {
|
||||
if (h_size == rmqr_width[i]) {
|
||||
h_version = i;
|
||||
}
|
||||
}
|
||||
|
||||
for(i = 0; i < 4; i++) {
|
||||
finder_position = rmqr_table_d1[(h_version * 4) + i];
|
||||
|
||||
if (finder_position != 0) {
|
||||
for (j = 0; j < v_size; j++) {
|
||||
if (j % 2) {
|
||||
grid[(j * h_size) + finder_position] = 0x10;
|
||||
} else {
|
||||
grid[(j * h_size) + finder_position] = 0x11;
|
||||
}
|
||||
}
|
||||
|
||||
// Top square
|
||||
grid[h_size + finder_position - 1] = 0x11;
|
||||
grid[(h_size * 2) + finder_position - 1] = 0x11;
|
||||
grid[h_size + finder_position + 1] = 0x11;
|
||||
grid[(h_size * 2) + finder_position + 1] = 0x11;
|
||||
|
||||
// Bottom square
|
||||
grid[(h_size * (v_size - 3)) + finder_position - 1] = 0x11;
|
||||
grid[(h_size * (v_size - 2)) + finder_position - 1] = 0x11;
|
||||
grid[(h_size * (v_size - 3)) + finder_position + 1] = 0x11;
|
||||
grid[(h_size * (v_size - 2)) + finder_position + 1] = 0x11;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Reserve space for format information */
|
||||
for (i = 0; i < 5; i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
grid[(h_size * (i + 1)) + j + 8] = 0x20;
|
||||
grid[(h_size * (v_size - 6)) + (h_size * i) + j + (h_size - 8)] = 0x20;
|
||||
}
|
||||
}
|
||||
grid[(h_size * 1) + 11] = 0x20;
|
||||
grid[(h_size * 2) + 11] = 0x20;
|
||||
grid[(h_size * 3) + 11] = 0x20;
|
||||
grid[(h_size * (v_size - 6)) + (h_size - 5)] = 0x20;
|
||||
grid[(h_size * (v_size - 6)) + (h_size - 4)] = 0x20;
|
||||
grid[(h_size * (v_size - 6)) + (h_size - 3)] = 0x20;
|
||||
}
|
||||
|
||||
/* rMQR according to 2018 draft standard */
|
||||
int rmqr(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
|
||||
int i, j, est_binlen;
|
||||
int ecc_level, autosize, version, max_cw, target_codewords, blocks, h_size, v_size;
|
||||
int gs1;
|
||||
int footprint, best_footprint, format_data;
|
||||
unsigned int left_format_info, right_format_info;
|
||||
|
||||
#ifndef _MSC_VER
|
||||
unsigned int jisdata[length + 1];
|
||||
char mode[length + 1];
|
||||
#else
|
||||
unsigned char* datastream;
|
||||
unsigned char* fullstream;
|
||||
unsigned char* grid;
|
||||
unsigned int* jisdata = (unsigned int *) _alloca((length + 1) * sizeof (unsigned int));
|
||||
char* mode = (char *) _alloca(length + 1);
|
||||
#endif
|
||||
|
||||
gs1 = ((symbol->input_mode & 0x07) == GS1_MODE);
|
||||
|
||||
if ((symbol->input_mode & 0x07) == DATA_MODE) {
|
||||
sjis_cpy(source, &length, jisdata);
|
||||
} else {
|
||||
int done = 0;
|
||||
if (symbol->eci != 20) { /* Unless ECI 20 (Shift JIS) */
|
||||
/* Try single byte (Latin) conversion first */
|
||||
int error_number = sjis_utf8tosb(symbol->eci && symbol->eci <= 899 ? symbol->eci : 3, source, &length, jisdata);
|
||||
if (error_number == 0) {
|
||||
done = 1;
|
||||
} else if (symbol->eci && symbol->eci <= 899) {
|
||||
strcpy(symbol->errtxt, "575: Invalid characters in input data");
|
||||
return error_number;
|
||||
}
|
||||
}
|
||||
if (!done) {
|
||||
/* Try Shift-JIS */
|
||||
int error_number = sjis_utf8tomb(symbol, source, &length, jisdata);
|
||||
if (error_number != 0) {
|
||||
return error_number;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
define_mode(mode, jisdata, length, gs1);
|
||||
est_binlen = getBinaryLength(RMQR_VERSION + 31, mode, jisdata, length, gs1, symbol->eci);
|
||||
|
||||
ecc_level = LEVEL_M;
|
||||
max_cw = 152;
|
||||
if (symbol->option_1 == 1) {
|
||||
strcpy(symbol->errtxt, "576: Error correction level L not available in rMQR");
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
if (symbol->option_1 == 3) {
|
||||
strcpy(symbol->errtxt, "577: Error correction level Q not available in rMQR");
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
if (symbol->option_1 == 4) {
|
||||
ecc_level = LEVEL_H;
|
||||
max_cw = 76;
|
||||
}
|
||||
|
||||
if (est_binlen > (8 * max_cw)) {
|
||||
strcpy(symbol->errtxt, "578: Input too long for selected error correction level");
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
if ((symbol->option_2 < 0) || (symbol->option_2 > 38)) {
|
||||
strcpy(symbol->errtxt, "579: Invalid rMQR symbol size");
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
version = 31; // Set default to keep compiler happy
|
||||
|
||||
if (symbol->option_2 == 0) {
|
||||
// Automatic symbol size
|
||||
autosize = 31;
|
||||
best_footprint = rmqr_height[31] * rmqr_width[31];
|
||||
for (version = 30; version >= 0; version--) {
|
||||
est_binlen = getBinaryLength(RMQR_VERSION + version, mode, jisdata, length, gs1, symbol->eci);
|
||||
footprint = rmqr_height[version] * rmqr_width[version];
|
||||
if (ecc_level == LEVEL_M) {
|
||||
if (8 * rmqr_data_codewords_M[version] >= est_binlen) {
|
||||
if (footprint < best_footprint) {
|
||||
autosize = version;
|
||||
best_footprint = footprint;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (8 * rmqr_data_codewords_H[version] >= est_binlen) {
|
||||
if (footprint < best_footprint) {
|
||||
autosize = version;
|
||||
best_footprint = footprint;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
version = autosize;
|
||||
est_binlen = getBinaryLength(RMQR_VERSION + version, mode, jisdata, length, gs1, symbol->eci);
|
||||
}
|
||||
|
||||
if ((symbol->option_2 >= 1) && (symbol->option_2 <= 32)) {
|
||||
// User specified symbol size
|
||||
version = symbol->option_2 - 1;
|
||||
}
|
||||
|
||||
if (symbol->option_2 >= 33) {
|
||||
// User has specified symbol height only
|
||||
version = rmqr_fixed_height_upper_bound[symbol->option_2 - 32];
|
||||
for(i = version - 1; i > rmqr_fixed_height_upper_bound[symbol->option_2 - 33]; i--) {
|
||||
est_binlen = getBinaryLength(RMQR_VERSION + i, mode, jisdata, length, gs1, symbol->eci);
|
||||
if (ecc_level == LEVEL_M) {
|
||||
if (8 * rmqr_data_codewords_M[i] >= est_binlen) {
|
||||
version = i;
|
||||
}
|
||||
} else {
|
||||
if (8 * rmqr_data_codewords_H[i] >= est_binlen) {
|
||||
version = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
est_binlen = getBinaryLength(RMQR_VERSION + version, mode, jisdata, length, gs1, symbol->eci);
|
||||
}
|
||||
|
||||
if (symbol->option_1 == -1) {
|
||||
// Detect if there is enough free space to increase ECC level
|
||||
if (est_binlen < (rmqr_data_codewords_H[version] * 8)) {
|
||||
ecc_level = LEVEL_H;
|
||||
}
|
||||
}
|
||||
|
||||
if (ecc_level == LEVEL_M) {
|
||||
target_codewords = rmqr_data_codewords_M[version];
|
||||
blocks = rmqr_blocks_M[version];
|
||||
} else {
|
||||
target_codewords = rmqr_data_codewords_H[version];
|
||||
blocks = rmqr_blocks_H[version];
|
||||
}
|
||||
|
||||
if (est_binlen > (target_codewords * 8)) {
|
||||
// User has selected a symbol too small for the data
|
||||
strcpy(symbol->errtxt, "580: Input too long for selected symbol size");
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
if (symbol->debug) {
|
||||
printf("Minimum codewords = %d\n", est_binlen / 8);
|
||||
printf("Selected version: %d = R%dx%d-", (version + 1), rmqr_height[version], rmqr_width[version]);
|
||||
if (ecc_level == LEVEL_M) {
|
||||
printf("M\n");
|
||||
} else {
|
||||
printf("H\n");
|
||||
}
|
||||
printf("Number of data codewords in symbol = %d\n", target_codewords);
|
||||
printf("Number of ECC blocks = %d\n", blocks);
|
||||
}
|
||||
|
||||
#ifndef _MSC_VER
|
||||
unsigned char datastream[target_codewords + 1];
|
||||
unsigned char fullstream[rmqr_total_codewords[version] + 1];
|
||||
#else
|
||||
datastream = (unsigned char *) _alloca((target_codewords + 1) * sizeof (unsigned char));
|
||||
fullstream = (unsigned char *) _alloca((rmqr_total_codewords[version] + 1) * sizeof (unsigned char));
|
||||
#endif
|
||||
|
||||
qr_binary(datastream, RMQR_VERSION + version, target_codewords, mode, jisdata, length, gs1, symbol->eci, est_binlen, symbol->debug);
|
||||
add_ecc(fullstream, datastream, RMQR_VERSION + version, target_codewords, blocks, symbol->debug);
|
||||
|
||||
h_size = rmqr_width[version];
|
||||
v_size = rmqr_height[version];
|
||||
|
||||
#ifndef _MSC_VER
|
||||
unsigned char grid[h_size * v_size];
|
||||
#else
|
||||
grid = (unsigned char *) _alloca((h_size * v_size) * sizeof (unsigned char));
|
||||
#endif
|
||||
|
||||
for (i = 0; i < v_size; i++) {
|
||||
for (j = 0; j < h_size; j++) {
|
||||
grid[(i * h_size) + j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
setup_rmqr_grid(grid, h_size, v_size, version);
|
||||
populate_grid(grid, h_size, v_size, fullstream, rmqr_total_codewords[version]);
|
||||
|
||||
/* apply bitmask */
|
||||
for (i = 0; i < v_size; i++) {
|
||||
for (j = 0; j < h_size; j++) {
|
||||
if ((grid[(i * h_size) + j] & 0xf0) == 0) {
|
||||
// This is a data module
|
||||
if (((i / 2) + (j / 3)) % 2 == 0) { // < This is the data mask from section 7.8.2
|
||||
// This module needs to be changed
|
||||
if (grid[(i * h_size) + j] == 0x01) {
|
||||
grid[(i * h_size) + j] = 0x00;
|
||||
} else {
|
||||
grid[(i * h_size) + j] = 0x01;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* add format information */
|
||||
format_data = version;
|
||||
if (ecc_level == LEVEL_H) {
|
||||
format_data += 32;
|
||||
}
|
||||
left_format_info = rmqr_format_info_left[format_data];
|
||||
right_format_info = rmqr_format_info_right[format_data];
|
||||
|
||||
for (i = 0; i < 5; i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
grid[(h_size * (i + 1)) + j + 8] = (left_format_info >> ((j * 5) + i)) & 0x01;
|
||||
grid[(h_size * (v_size - 6)) + (h_size * i) + j + (h_size - 8)] = (right_format_info >> ((j * 5) + i)) & 0x01;
|
||||
}
|
||||
}
|
||||
grid[(h_size * 1) + 11] = (left_format_info >> 15) & 0x01;
|
||||
grid[(h_size * 2) + 11] = (left_format_info >> 16) & 0x01;
|
||||
grid[(h_size * 3) + 11] = (left_format_info >> 17) & 0x01;
|
||||
grid[(h_size * (v_size - 6)) + (h_size - 5)] = (right_format_info >> 15) & 0x01;
|
||||
grid[(h_size * (v_size - 6)) + (h_size - 4)] = (right_format_info >> 16) & 0x01;
|
||||
grid[(h_size * (v_size - 6)) + (h_size - 3)] = (right_format_info >> 17) & 0x01;
|
||||
|
||||
|
||||
symbol->width = h_size;
|
||||
symbol->rows = v_size;
|
||||
|
||||
for (i = 0; i < v_size; i++) {
|
||||
for (j = 0; j < h_size; j++) {
|
||||
if (grid[(i * h_size) + j] & 0x01) {
|
||||
set_module(symbol, i, j);
|
||||
}
|
||||
}
|
||||
symbol->row_height[i] = 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
143
backend/qr.h
143
backend/qr.h
@ -1,8 +1,7 @@
|
||||
/* qr.h Data for QR Code */
|
||||
/* qr.h Data for QR Code, Micro QR Code and rMQR
|
||||
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2008-2017 Robin Stuart <rstuart114@gmail.com>
|
||||
Copyright (C) 2008-2019 Robin Stuart <rstuart114@gmail.com>
|
||||
Copyright (C) 2006 Kentaro Fukuchi <fukuchi@megaui.net>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -38,6 +37,8 @@
|
||||
|
||||
#define RHODIUM "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:"
|
||||
|
||||
#define RMQR_VERSION 100
|
||||
|
||||
/* From ISO/IEC 18004:2006 Table 7 */
|
||||
static const unsigned short int qr_data_codewords_L[] = {
|
||||
19, 34, 55, 80, 108, 136, 156, 194, 232, 274, 324, 370, 428, 461, 523, 589, 647,
|
||||
@ -69,6 +70,92 @@ static const unsigned short int qr_total_codewords[] = {
|
||||
2185, 2323, 2465, 2611, 2761, 2876, 3034, 3196, 3362, 3532, 3706
|
||||
};
|
||||
|
||||
static const unsigned short int rmqr_height[] = {
|
||||
7, 7, 7, 7, 7,
|
||||
9, 9, 9, 9, 9,
|
||||
11, 11, 11, 11, 11, 11,
|
||||
13, 13, 13, 13, 13, 13,
|
||||
15, 15, 15, 15, 15,
|
||||
17, 17, 17, 17, 17
|
||||
};
|
||||
|
||||
static const unsigned short int rmqr_width[] = {
|
||||
43, 59, 77, 99, 139,
|
||||
43, 59, 77, 99, 139,
|
||||
27, 43, 59, 77, 99, 139,
|
||||
27, 43, 59, 77, 99, 139,
|
||||
43, 59, 77, 99, 139,
|
||||
43, 59, 77, 99, 139
|
||||
};
|
||||
|
||||
static const unsigned short int rmqr_data_codewords_M[] = {
|
||||
6, 12, 20, 28, 44, // R7x
|
||||
12, 21, 31, 42, 63, // R9x
|
||||
7, 19, 31, 43, 57, 84, // R11x
|
||||
12, 27, 38, 53, 73, 106, // R13x
|
||||
33, 48, 67, 88, 127, // R15x
|
||||
39, 56, 78, 100, 152 // R17x
|
||||
};
|
||||
|
||||
static const unsigned short int rmqr_data_codewords_H[] = {
|
||||
3, 7, 10, 14, 24, // R7x
|
||||
7, 11, 17, 22, 33, // R9x
|
||||
5, 11, 15, 23, 29, 42, // R11x
|
||||
7, 13, 20, 29, 35, 54, // R13x
|
||||
15, 26, 31, 48, 69, // R15x
|
||||
21, 28, 38, 56, 76 // R17x
|
||||
};
|
||||
|
||||
static const short int rmqr_fixed_height_upper_bound[] = {
|
||||
-1, 4, 9, 15, 21, 26, 31
|
||||
};
|
||||
|
||||
static const unsigned short int rmqr_total_codewords[] = {
|
||||
13, 21, 32, 44, 68, // R7x
|
||||
21, 33, 49, 66, 99, // R9x
|
||||
15, 31, 47, 67, 89, 132, // R11x
|
||||
21, 41, 60, 85, 113, 166, // R13x
|
||||
51, 74, 103, 136, 199, // R15x
|
||||
61, 88, 122, 160, 232 // R17x
|
||||
};
|
||||
|
||||
|
||||
static const unsigned short int rmqr_numeric_cci[] = {
|
||||
4, 5, 6, 7, 7,
|
||||
5, 6, 7, 7, 8,
|
||||
5, 6, 7, 7, 8, 8,
|
||||
5, 7, 7, 8, 8, 8,
|
||||
7, 7, 8, 8, 9,
|
||||
7, 8, 8, 8, 9
|
||||
};
|
||||
|
||||
static const unsigned short int rmqr_alphanum_cci[] = {
|
||||
4, 5, 5, 6, 6,
|
||||
5, 5, 6, 6, 7,
|
||||
4, 5, 6, 6, 7, 7,
|
||||
5, 6, 6, 7, 7, 8,
|
||||
6, 7, 7, 7, 8,
|
||||
6, 7, 7, 8, 8
|
||||
};
|
||||
|
||||
static const unsigned short int rmqr_byte_cci[] = {
|
||||
3, 4, 5, 5, 6,
|
||||
4, 5, 5, 6, 6,
|
||||
3, 5, 5, 6, 6, 7,
|
||||
4, 5, 6, 6, 7, 7,
|
||||
6, 6, 7, 7, 7,
|
||||
6, 6, 7, 7, 8
|
||||
};
|
||||
|
||||
static const unsigned short int rmqr_kanji_cci[] = {
|
||||
2, 3, 4, 5, 5,
|
||||
3, 4, 5, 5, 6,
|
||||
2, 4, 5, 5, 6, 6,
|
||||
3, 5, 5, 6, 6, 7,
|
||||
5, 5, 6, 6, 7,
|
||||
5, 6, 6, 6, 7
|
||||
};
|
||||
|
||||
static const char qr_blocks_L[] = {
|
||||
1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12,
|
||||
12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25
|
||||
@ -89,6 +176,24 @@ static const char qr_blocks_H[] = {
|
||||
32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81
|
||||
};
|
||||
|
||||
static const char rmqr_blocks_M[] = {
|
||||
1, 1, 1, 1, 1, // R7x
|
||||
1, 1, 1, 1, 2, // R9x
|
||||
1, 1, 1, 1, 2, 2, // R11x
|
||||
1, 1, 1, 2, 2, 3, // R13x
|
||||
1, 1, 2, 2, 3, // R15x
|
||||
1, 2, 2, 3, 4 // R17x
|
||||
};
|
||||
|
||||
static const char rmqr_blocks_H[] = {
|
||||
1, 1, 1, 1, 2, // R7x
|
||||
1, 1, 2, 2, 3, // R9x
|
||||
1, 1, 2, 2, 2, 3, // R11x
|
||||
1, 1, 2, 2, 3, 4, // R13x
|
||||
2, 2, 3, 4, 5, // R15x
|
||||
2, 2, 3, 4, 6 // R17x
|
||||
};
|
||||
|
||||
static const unsigned short int qr_sizes[] = {
|
||||
21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97,
|
||||
101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177
|
||||
@ -102,6 +207,7 @@ static const char qr_align_loopsize[] = {
|
||||
0, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7
|
||||
};
|
||||
|
||||
// Table E1 - Row/column coordinates of center module of alignment patterns
|
||||
static const unsigned short int qr_table_e1[] = {
|
||||
6, 18, 0, 0, 0, 0, 0,
|
||||
6, 22, 0, 0, 0, 0, 0,
|
||||
@ -144,6 +250,15 @@ static const unsigned short int qr_table_e1[] = {
|
||||
6, 30, 58, 86, 114, 142, 170
|
||||
};
|
||||
|
||||
// Table D1 - Column coordinates of centre module of alignment patterns
|
||||
static const unsigned short int rmqr_table_d1[] = {
|
||||
21, 0, 0, 0,
|
||||
19, 39, 0, 0,
|
||||
25, 51, 0, 0,
|
||||
23, 49, 75, 0,
|
||||
27, 55, 83, 111
|
||||
};
|
||||
|
||||
static const unsigned int qr_annex_c[] = {
|
||||
/* Format information bit sequences */
|
||||
0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0, 0x77c4, 0x72f3, 0x7daa, 0x789d,
|
||||
@ -165,3 +280,25 @@ static const unsigned int qr_annex_c1[] = {
|
||||
0x7c16, 0x7921, 0x06de, 0x03e9, 0x0cb0, 0x0987, 0x1735, 0x1202, 0x1d5b, 0x186c, 0x2508, 0x203f, 0x2f66, 0x2a51, 0x34e3,
|
||||
0x31d4, 0x3e8d, 0x3bba
|
||||
};
|
||||
|
||||
static const unsigned int rmqr_format_info_left[] = {
|
||||
/* rMQR format information for finder pattern side */
|
||||
0x1FAB2, 0x1E597, 0x1DBDD, 0x1C4F8, 0x1B86C, 0x1A749, 0x19903, 0x18626, 0x17F0E, 0x1602B,
|
||||
0x15E61, 0x14144, 0x13DD0, 0x122F5, 0x11CBF, 0x1039A, 0x0F1CA, 0x0EEEF, 0x0D0A5, 0x0CF80,
|
||||
0x0B314, 0x0AC31, 0x0927B, 0x08D5E, 0x07476, 0x06B53, 0x05519, 0x04A3C, 0x036A8, 0x0298D,
|
||||
0x017C7, 0x008E2, 0x3F367, 0x3EC42, 0x3D208, 0x3CD2D, 0x3B1B9, 0x3AE9C, 0x390D6, 0x38FF3,
|
||||
0x376DB, 0x369FE, 0x357B4, 0x34891, 0x33405, 0x32B20, 0x3156A, 0x30A4F, 0x2F81F, 0x2E73A,
|
||||
0x2D970, 0x2C655, 0x2BAC1, 0x2A5E4, 0x29BAE, 0x2848B, 0x27DA3, 0x26286, 0x25CCC, 0x243E9,
|
||||
0x23F7D, 0x22058, 0x21E12, 0x20137
|
||||
};
|
||||
|
||||
static const unsigned int rmqr_format_info_right[] = {
|
||||
/* rMQR format information for subfinder pattern side */
|
||||
0x20A7B, 0x2155E, 0x22B14, 0x23431, 0x248A5, 0x25780, 0x269CA, 0x276EF, 0x28FC7, 0x290E2,
|
||||
0x2AEA8, 0x2B18D, 0x2CD19, 0x2D23C, 0x2EC76, 0x2F353, 0x30103, 0x31E26, 0x3206C, 0x33F49,
|
||||
0x343DD, 0x35CF8, 0x362B2, 0x37D97, 0x384BF, 0x39B9A, 0x3A5D0, 0x3BAF5, 0x3C661, 0x3D944,
|
||||
0x3E70E, 0x3F82B, 0x003AE, 0x01C8B, 0x022C1, 0x03DE4, 0x04170, 0x05E55, 0x0601F, 0x07F3A,
|
||||
0x08612, 0x09937, 0x0A77D, 0x0B858, 0x0C4CC, 0x0DBE9, 0x0E5A3, 0x0FA86, 0x108D6, 0x117F3,
|
||||
0x129B9, 0x1369C, 0x14A08, 0x1552D, 0x16B67, 0x17442, 0x18D6A, 0x1924F, 0x1AC05, 0x1B320,
|
||||
0x1CFB4, 0x1D091, 0x1EEDB, 0x1F1FE
|
||||
};
|
@ -1,7 +1,7 @@
|
||||
/* zint.h - definitions for libzint
|
||||
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2009-2018 Robin Stuart <rstuart114@gmail.com>
|
||||
Copyright (C) 2009-2019 Robin Stuart <rstuart114@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
@ -243,6 +243,7 @@ extern "C" {
|
||||
#define BARCODE_GRIDMATRIX 142
|
||||
#define BARCODE_UPNQR 143
|
||||
#define BARCODE_ULTRA 144
|
||||
#define BARCODE_RMQR 145
|
||||
|
||||
// Output options
|
||||
#define BARCODE_NO_ASCII 1
|
||||
|
@ -325,6 +325,7 @@ Numeric Value | Barcode Name
|
||||
141 | Code One
|
||||
142 | Grid Matrix
|
||||
143 | UPNQR (Univerzalnega Plačilnega Naloga QR)
|
||||
145 | Rectangular Micro QR Code (rMQR)
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
4.4 Adjusting height
|
||||
@ -1034,6 +1035,7 @@ Value |
|
||||
141 | BARCODE_CODEONE | Code One
|
||||
142 | BARCODE_GRIDMATRIX | Grid Matrix
|
||||
143 | BARCODE_UPNQR | UPNQR (Univerzalnega Plačilnega Naloga QR)
|
||||
145 | BARCODE_RMQR | Rectangular Micro QR Code (rMQR)
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
5.8 Adjusting other output options
|
||||
@ -1963,7 +1965,71 @@ Input | Version | Symbol Size
|
||||
4 | M4 | 17 x 17
|
||||
---------------------------------
|
||||
|
||||
6.6.4 UPNQR (Univerzalnega Plačilnega Naloga QR)
|
||||
6.6.4 Rectangular Micro QR Code (rMQR)
|
||||
--------------------------------------
|
||||
A rectangular version of QR Code. Like QR code rMQR supports encoding of
|
||||
GS-1 data, Latin-1 and Kanji characters in the Shift-JIS encoding scheme.
|
||||
It does not support other ISO 8859 character sets or Unicode. As with other
|
||||
symbologies data should be entered as UTF-8 with the conversion to Shift-JIS
|
||||
being handled by Zint. The amount of ECC codewords can be adjusted using
|
||||
--secure=, however only ECC levels M and H are valid for this type of symbol.
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
Input | ECC Level | Error Correction Capacity | Recovery Capacity
|
||||
-------------------------------------------------------------------------
|
||||
2 | M (default) | Approx 37% of symbol | Approx 15%
|
||||
4 | H | Approx 65% of symbol | Approx 30%
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
The preferred symbol sizes can be selected using the --vers= option as shown
|
||||
in the table below. Input values between 33 and 38 fix the height of the
|
||||
symbol while allowing Zint to determine the minimum symbol width.
|
||||
|
||||
---------------------------------
|
||||
Input | Version | Symbol Size
|
||||
---------------------------------
|
||||
1 | R7x43 | 7 x 73
|
||||
2 | R7x59 | 7 x 59
|
||||
3 | R7x77 | 7 x 77
|
||||
4 | R7x99 | 7 x 99
|
||||
5 | R7x139 | 7 x 139
|
||||
6 | R9x43 | 9 x 43
|
||||
7 | R9x59 | 9 x 59
|
||||
8 | R9x77 | 9 x 77
|
||||
9 | R9x99 | 9 x 99
|
||||
10 | R9x139 | 9 x 139
|
||||
11 | R11x27 | 11 x 27
|
||||
12 | R11x43 | 11 x 43
|
||||
13 | R11x59 | 11 x 59
|
||||
14 | R11x77 | 11 x 77
|
||||
15 | R11x99 | 11 x 99
|
||||
16 | R11x139 | 11 x 139
|
||||
17 | R13x27 | 13 x 27
|
||||
18 | R13x43 | 13 x 43
|
||||
19 | R13x59 | 13 x 59
|
||||
20 | R13x77 | 13 x 77
|
||||
21 | R13x99 | 13 x 99
|
||||
22 | R13x139 | 13 x 139
|
||||
23 | R15x43 | 15 x 43
|
||||
24 | R15x59 | 15 x 59
|
||||
25 | R15x77 | 15 x 77
|
||||
26 | R15x99 | 15 x 99
|
||||
27 | R15x139 | 15 x 139
|
||||
28 | R17x43 | 17 x 43
|
||||
29 | R17x59 | 17 x 59
|
||||
30 | R17x77 | 17 x 77
|
||||
31 | R17x99 | 17 x 99
|
||||
32 | R17x139 | 17 x 139
|
||||
---------------------------------
|
||||
33 | Fixed height 7
|
||||
34 | Fixed height 9
|
||||
35 | Fixed height 11
|
||||
36 | Fixed height 13
|
||||
37 | Fixed height 15
|
||||
38 | Fixed height 17
|
||||
---------------------------------
|
||||
|
||||
6.6.5 UPNQR (Univerzalnega Plačilnega Naloga QR)
|
||||
------------------------------------------------
|
||||
A variation of QR Code used by Združenje Bank Slovenije (Bank Association of
|
||||
Slovenia). The size, error correction level and ECI are set by Zint and do not
|
||||
@ -1976,7 +2042,7 @@ The following example creates a symbol from data saved as an ISO-8859-2 file:
|
||||
|
||||
zint -o upnqr.png -b 143 --border=5 --scale=3 --binary -i ./upn.txt
|
||||
|
||||
6.6.5 Maxicode (ISO 16023)
|
||||
6.6.6 Maxicode (ISO 16023)
|
||||
--------------------------
|
||||
Developed by UPS the Maxicode symbology employs a grid of hexagons surrounding
|
||||
a 'bulls-eye' finder pattern. This symbology is designed for the identification
|
||||
@ -2034,7 +2100,7 @@ Mode | Maximum Data Lenth | Maximum Data Length | Number of Error
|
||||
-----------------------------------------------------------------------------
|
||||
* - secondary only
|
||||
|
||||
6.6.6 Aztec Code (ISO 24778)
|
||||
6.6.7 Aztec Code (ISO 24778)
|
||||
----------------------------
|
||||
Invented by Andrew Longacre at Welch Allyn Inc in 1995 the Aztec Code symbol is
|
||||
a matrix symbol with a distinctive bulls-eye finder pattern. Zint can generate
|
||||
@ -2116,13 +2182,13 @@ A separate symbology ID can be used to encode Health Industry Barcode (HIBC)
|
||||
data which adds a leading '+' character and a modulo-49 check digit to the
|
||||
encoded data.
|
||||
|
||||
6.6.7 Aztec Runes
|
||||
6.6.8 Aztec Runes
|
||||
-----------------
|
||||
A truncated version of compact Aztec Code for encoding whole integers between 0
|
||||
and 255. Includes Reed-Solomon error correction. As defined in ISO/IEC 24778
|
||||
Annex A.
|
||||
|
||||
6.6.8 Code One
|
||||
6.6.9 Code One
|
||||
--------------
|
||||
A matrix symbology developed by Ted Williams in 1992 which encodes data in a
|
||||
way similar to Data Matrix ECC200. Code One is able to encode the Latin-1
|
||||
@ -2150,7 +2216,7 @@ Input | Version | Size | Numeric | Alphanumeric
|
||||
Version S symbols can only encode numeric data. The width of version S and
|
||||
version T symbols is determined by the length of the input data.
|
||||
|
||||
6.6.9 Grid Matrix
|
||||
6.6.10 Grid Matrix
|
||||
-----------------
|
||||
By default Grid Matrix supports encoding in Latin-1 and Chinese characters
|
||||
within the GB 2312 standard set to be encoded in a checkerboard pattern. Input
|
||||
@ -2191,7 +2257,7 @@ Mode | Error Correction Capacity
|
||||
5 | Approximately 50%
|
||||
----------------------------------
|
||||
|
||||
6.6.10 DotCode
|
||||
6.6.11 DotCode
|
||||
-------------
|
||||
DotCode uses a grid of dots in a rectangular formation to encode characters up
|
||||
to a maximum of approximately 450 characters (or 900 numeric digits). The
|
||||
@ -2203,7 +2269,7 @@ the image to a larger value than the default (e.g. approx 10) for the dots to
|
||||
be plotted correctly. Approximately 33% of the resulting symbol is comprised of
|
||||
error correction codewords.
|
||||
|
||||
6.6.11 Han Xin Code
|
||||
6.6.12 Han Xin Code
|
||||
-------------------
|
||||
Also known as Chinese Sensible Code, Han Xin is a symbology which is still
|
||||
under
|
||||
|
@ -67,7 +67,7 @@ void types(void) {
|
||||
"40: Postnet 86: UK Plessey 141: Code One\n"
|
||||
"47: MSI Plessey 87: Telepen Numeric 142: Grid Matrix\n"
|
||||
"49: FIM 89: ITF-14 143: UPNQR\n"
|
||||
"50: Logmars 90: KIX Code\n"
|
||||
"50: Logmars 90: KIX Code 145: rMQR\n"
|
||||
);
|
||||
}
|
||||
|
||||
|
344
frontend_qt/grpRMQR.ui
Normal file
344
frontend_qt/grpRMQR.ui
Normal file
@ -0,0 +1,344 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>grpRMQR</class>
|
||||
<widget class="QWidget" name="grpRMQR">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>441</width>
|
||||
<height>238</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="grpRMQROptions">
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="radRMQRAuto">
|
||||
<property name="text">
|
||||
<string>A&utomatic Resizing</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="radRMQRSize">
|
||||
<property name="text">
|
||||
<string>Adjust Si&ze To:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="cmbRMQRSize">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R7x43</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R7x59</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R7x77</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R7x99</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R7x139</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R9x43</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R9x59</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R9x77</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R9x99</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R9x139</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R11x27</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R11x43</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R11x59</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R11x77</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R11x99</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R11x139</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R13x27</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R13x43</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R13x59</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R13x77</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R13x99</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R13x139</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R15x43</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R15x59</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R15x77</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R15x99</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R15x139</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R17x43</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R17x59</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R17x77</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R17x99</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R17x139</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R7x Automatic Width</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R9x Automatic Width</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R11x Automatic Width</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R13x Automatic Width</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R15 x Automatic Width</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>R17 x Automatic Width</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QRadioButton" name="radRMQRECC">
|
||||
<property name="text">
|
||||
<string>Add &Error Correction:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="cmbRMQRECC">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>~37% (Level M)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>~65% (Level H)</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="grpRMQRMode">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>70</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Data Encoding</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="gridLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>411</width>
|
||||
<height>80</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="radRMQRStand">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>S&tandard Mode</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QRadioButton" name="radRMQRGS1">
|
||||
<property name="text">
|
||||
<string>&GS-1 Data Mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>radRMQRSize</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>cmbRMQRSize</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>89</x>
|
||||
<y>39</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>255</x>
|
||||
<y>46</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radRMQRECC</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>cmbRMQRECC</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>95</x>
|
||||
<y>79</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>308</x>
|
||||
<y>79</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -1,6 +1,6 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2008 by BogDan Vatra <bogdan@licentia.eu> *
|
||||
* Copyright (C) 2009-2017 by Robin Stuart <rstuart114@gmail.com> *
|
||||
* Copyright (C) 2009-2019 by Robin Stuart <rstuart114@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
@ -101,6 +101,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl)
|
||||
"PLANET",
|
||||
"Postnet",
|
||||
"QR Code (ISO 18004)",
|
||||
"Rectangular Micro QR (rMQR)",
|
||||
"Royal Mail 4-state Barcode",
|
||||
"Royal Mail 4-state Mailmark",
|
||||
"Telepen",
|
||||
@ -112,9 +113,6 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl)
|
||||
"USPS Intelligent Mail"
|
||||
};
|
||||
|
||||
/* createActions();
|
||||
createMenus(); */
|
||||
|
||||
scene = new QGraphicsScene(this);
|
||||
|
||||
setupUi(this);
|
||||
@ -286,9 +284,7 @@ void MainWindow::about()
|
||||
"ISO/IEC 24724:2011, ISO/IEC 24728:2006, ISO/IEC 24778:2008,<br>"
|
||||
"ISO/IEC 21471:2019, ANSI-HIBC 2.3-2009, ANSI/AIM BC6-2000,<br>"
|
||||
"ANSI/AIM BC12-1998, AIMD014 (v 1.63), USPS-B-3200"
|
||||
"</small></td></tr></table>"
|
||||
|
||||
));
|
||||
"</small></td></tr></table>"));
|
||||
}
|
||||
|
||||
int MainWindow::open_data_dialog()
|
||||
@ -415,7 +411,6 @@ void MainWindow::change_options()
|
||||
else
|
||||
chkComposite->setText(tr("Add 2D Component"));
|
||||
|
||||
|
||||
if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_PDF417)
|
||||
{
|
||||
QFile file(":/grpPDF417.ui");
|
||||
@ -572,6 +567,23 @@ void MainWindow::change_options()
|
||||
connect(m_optionWidget->findChild<QObject*>("radQRHIBC"), SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
}
|
||||
|
||||
if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_RMQR)
|
||||
{
|
||||
QFile file(":/grpRMQR.ui");
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
return;
|
||||
m_optionWidget=uiload.load(&file);
|
||||
file.close();
|
||||
tabMain->insertTab(1,m_optionWidget,tr("rMQR Code"));
|
||||
connect(m_optionWidget->findChild<QObject*>("radRMQRAuto"), SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(m_optionWidget->findChild<QObject*>("radRMQRSize"), SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(m_optionWidget->findChild<QObject*>("radRMQRECC"), SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(m_optionWidget->findChild<QObject*>("cmbRMQRSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(m_optionWidget->findChild<QObject*>("cmbRMQRECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(m_optionWidget->findChild<QObject*>("radRMQRStand"), SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(m_optionWidget->findChild<QObject*>("radRMQRGS1"), SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
}
|
||||
|
||||
if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_HANXIN)
|
||||
{
|
||||
QFile file (":/grpHX.ui");
|
||||
@ -749,7 +761,6 @@ void MainWindow::update_preview()
|
||||
m_bc.bc.setText(txtComposite->toPlainText());
|
||||
} else {
|
||||
m_bc.bc.setText(txtData->text());
|
||||
/*m_bc.bc.setPrimaryMessage(txtComposite->text());*/
|
||||
}
|
||||
m_bc.bc.setSecurityLevel(0);
|
||||
m_bc.bc.setWidth(0);
|
||||
@ -985,6 +996,19 @@ void MainWindow::update_preview()
|
||||
m_bc.bc.setSecurityLevel(m_optionWidget->findChild<QComboBox*>("cmbMQRECC")->currentIndex() + 1);
|
||||
break;
|
||||
|
||||
case BARCODE_RMQR:
|
||||
m_bc.bc.setSymbol(BARCODE_RMQR);
|
||||
|
||||
if(m_optionWidget->findChild<QRadioButton*>("radRMQRGS1")->isChecked())
|
||||
m_bc.bc.setInputMode(GS1_MODE);
|
||||
|
||||
if(m_optionWidget->findChild<QRadioButton*>("radRMQRSize")->isChecked())
|
||||
m_bc.bc.setWidth(m_optionWidget->findChild<QComboBox*>("cmbRMQRSize")->currentIndex() + 1);
|
||||
|
||||
if(m_optionWidget->findChild<QRadioButton*>("radRMQRECC")->isChecked())
|
||||
m_bc.bc.setSecurityLevel(m_optionWidget->findChild<QComboBox*>("cmbRMQRECC")->currentIndex() * 2 + 2);
|
||||
break;
|
||||
|
||||
case BARCODE_GRIDMATRIX:
|
||||
m_bc.bc.setSymbol(BARCODE_GRIDMATRIX);
|
||||
if(m_optionWidget->findChild<QRadioButton*>("radGridSize")->isChecked())
|
||||
@ -1058,4 +1082,3 @@ void MainWindow::update_preview()
|
||||
scene->setSceneRect(0, 0, width - 10, height - 10);
|
||||
scene->update();
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2008 by BogDan Vatra <bogdan@licentia.eu> *
|
||||
* Copyright (C) 2009-2016 by Robin Stuart <rstuart114@gmail.com> *
|
||||
* Copyright (C) 2009-2019 by Robin Stuart <rstuart114@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
@ -96,6 +96,7 @@ public:
|
||||
PLANET = 82,
|
||||
POSTNET = 40,
|
||||
QRCODE = 58,
|
||||
RMQR = 145,
|
||||
RM4SCC = 70,
|
||||
MAILMARK = 121,
|
||||
TELEPEN = 32,
|
||||
@ -137,20 +138,10 @@ private slots:
|
||||
void copy_to_clipboard_bmp();
|
||||
|
||||
private:
|
||||
/* void createActions();
|
||||
void createMenus(); */
|
||||
|
||||
QColor m_fgcolor,m_bgcolor;
|
||||
BarcodeItem m_bc;
|
||||
QWidget *m_optionWidget;
|
||||
QGraphicsScene *scene;
|
||||
/* QMenu *fileMenu;
|
||||
QMenu *helpMenu;
|
||||
QAction *saveAct;
|
||||
QAction *aboutQtAct; */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@ -24,5 +24,6 @@
|
||||
<file>grpHX.ui</file>
|
||||
<file>grpDotCode.ui</file>
|
||||
<file>grpCodablockF.ui</file>
|
||||
<file>grpRMQR.ui</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
Loading…
Reference in New Issue
Block a user