mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Plot Codablock symbols to file and in Studio
This commit is contained in:
parent
a7bcef4ef7
commit
d86ac40b20
@ -63,6 +63,23 @@
|
|||||||
#define aCodeC (uchar)(134)
|
#define aCodeC (uchar)(134)
|
||||||
#define aShift (uchar)(135)
|
#define aShift (uchar)(135)
|
||||||
|
|
||||||
|
static const char *C128Table[107] = {
|
||||||
|
/* Code 128 character encodation - Table 1 */
|
||||||
|
"212222", "222122", "222221", "121223", "121322", "131222", "122213",
|
||||||
|
"122312", "132212", "221213", "221312", "231212", "112232", "122132", "122231", "113222",
|
||||||
|
"123122", "123221", "223211", "221132", "221231", "213212", "223112", "312131", "311222",
|
||||||
|
"321122", "321221", "312212", "322112", "322211", "212123", "212321", "232121", "111323",
|
||||||
|
"131123", "131321", "112313", "132113", "132311", "211313", "231113", "231311", "112133",
|
||||||
|
"112331", "132131", "113123", "113321", "133121", "313121", "211331", "231131", "213113",
|
||||||
|
"213311", "213131", "311123", "311321", "331121", "312113", "312311", "332111", "314111",
|
||||||
|
"221411", "431111", "111224", "111422", "121124", "121421", "141122", "141221", "112214",
|
||||||
|
"112412", "122114", "122411", "142112", "142211", "241211", "221114", "413111", "241112",
|
||||||
|
"134111", "111242", "121142", "121241", "114212", "124112", "124211", "411212", "421112",
|
||||||
|
"421211", "212141", "214121", "412121", "111143", "111341", "131141", "114113", "114311",
|
||||||
|
"411113", "411311", "113141", "114131", "311141", "411131", "211412", "211214", "211232",
|
||||||
|
"2331112"
|
||||||
|
};
|
||||||
|
|
||||||
/* Code F Analysing-Chart */
|
/* Code F Analysing-Chart */
|
||||||
typedef struct sCharacterSetTable
|
typedef struct sCharacterSetTable
|
||||||
{
|
{
|
||||||
@ -616,6 +633,8 @@ int codablock(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
int rowCur;
|
int rowCur;
|
||||||
int characterSetCur;
|
int characterSetCur;
|
||||||
int emptyColumns;
|
int emptyColumns;
|
||||||
|
char dest[1000];
|
||||||
|
int r, c;
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
CharacterSetTable *T;
|
CharacterSetTable *T;
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
@ -944,5 +963,18 @@ int codablock(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
}
|
}
|
||||||
printf("rows=%i columns=%i fillings=%i\n", rows, columns, fillings);
|
printf("rows=%i columns=%i fillings=%i\n", rows, columns, fillings);
|
||||||
#endif
|
#endif
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
|
||||||
|
|
||||||
|
for (r = 0; r < rows; r++) {
|
||||||
|
strcpy(dest, "");
|
||||||
|
for(c = 0; c < columns; c++) {
|
||||||
|
strcat(dest, C128Table[pOutput[r * columns + c]]);
|
||||||
|
}
|
||||||
|
expand(symbol, dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(symbol->output_options & BARCODE_BIND)) {
|
||||||
|
symbol->output_options += BARCODE_BIND;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -167,38 +167,27 @@ void expand(struct zint_symbol *symbol, const char data[]) {
|
|||||||
|
|
||||||
/* Indicates which symbologies can have row binding */
|
/* Indicates which symbologies can have row binding */
|
||||||
int is_stackable(const int symbology) {
|
int is_stackable(const int symbology) {
|
||||||
|
int retval = 0;
|
||||||
|
|
||||||
if (symbology < BARCODE_PDF417) {
|
if (symbology < BARCODE_PDF417) {
|
||||||
return 1;
|
retval = 1;
|
||||||
}
|
|
||||||
if (symbology == BARCODE_CODE128B) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (symbology == BARCODE_ISBNX) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (symbology == BARCODE_EAN14) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (symbology == BARCODE_NVE18) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (symbology == BARCODE_KOREAPOST) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (symbology == BARCODE_PLESSEY) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (symbology == BARCODE_TELEPEN_NUM) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (symbology == BARCODE_ITF14) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (symbology == BARCODE_CODE32) {
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
switch (symbology) {
|
||||||
|
case BARCODE_CODE128B:
|
||||||
|
case BARCODE_ISBNX:
|
||||||
|
case BARCODE_EAN14:
|
||||||
|
case BARCODE_NVE18:
|
||||||
|
case BARCODE_KOREAPOST:
|
||||||
|
case BARCODE_PLESSEY:
|
||||||
|
case BARCODE_TELEPEN_NUM:
|
||||||
|
case BARCODE_ITF14:
|
||||||
|
case BARCODE_CODE32:
|
||||||
|
case BARCODE_CODABLOCK:
|
||||||
|
retval = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Indicates which symbols can have addon (EAN-2 and EAN-5) */
|
/* Indicates which symbols can have addon (EAN-2 and EAN-5) */
|
||||||
|
@ -515,7 +515,9 @@ namespace Zint {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Add row binding */
|
/* Add row binding */
|
||||||
if (((m_zintSymbol->symbology == BARCODE_CODE16K) || (m_zintSymbol->symbology == BARCODE_CODE49)) && (row != 0)) {
|
if (((m_zintSymbol->symbology == BARCODE_CODE16K)
|
||||||
|
|| (m_zintSymbol->symbology == BARCODE_CODE49)
|
||||||
|
|| (m_zintSymbol->symbology == BARCODE_CODABLOCK)) && (row != 0)) {
|
||||||
painter.fillRect(0, y - 1, m_zintSymbol->width, 2, QBrush(m_fgColor));
|
painter.fillRect(0, y - 1, m_zintSymbol->width, 2, QBrush(m_fgColor));
|
||||||
}
|
}
|
||||||
y += m_zintSymbol->row_height[row];
|
y += m_zintSymbol->row_height[row];
|
||||||
|
Loading…
Reference in New Issue
Block a user