Added Aztec Runes

This commit is contained in:
hooper114 2008-11-09 10:06:05 +00:00
parent 50f3861d0d
commit 49a14d9d73
11 changed files with 150 additions and 6 deletions

View File

@ -24,6 +24,7 @@ auspost.c:
aztec.c: aztec.c:
Aztec Code Aztec Code
Compact Aztec Code Compact Aztec Code
Aztec Runes
blockf.c: blockf.c:
Codablock-F Codablock-F
@ -51,8 +52,15 @@ composite.c:
CC-B Composite Symbology CC-B Composite Symbology
CC-C Composite Symbology CC-C Composite Symbology
dm200.c:
Data Matrix ECC 200
dmatrix.c: dmatrix.c:
Data Matrix (Semacode) Data Matrix ECC 000
Data Matrix ECC 050
Data Matrix ECC 080
Data Matrix ECC 100
Data Matrix ECC 140
imail.c: imail.c:
USPS OneCode (Intelligent Mail) USPS OneCode (Intelligent Mail)
@ -66,6 +74,9 @@ medical.c:
Codabar Codabar
Code 32 Code 32
micqr.c:
Micro QR Code
pdf417.c: pdf417.c:
PDF417 PDF417
Truncated PDF417 Truncated PDF417

View File

@ -1039,3 +1039,96 @@ int aztec(struct zint_symbol *symbol, unsigned char source[])
return err_code; return err_code;
} }
int aztec_runes(struct zint_symbol *symbol, unsigned char source[])
{
int input_length, error_number, i, y, x;
int input_value;
char binary_string[28];
unsigned char data_codewords[3], ecc_codewords[6];
error_number = 0;
input_value = 0;
input_length = ustrlen(source);
if(input_length > 3) {
strcpy(symbol->errtxt, "Input too large");
return ERROR_INVALID_DATA;
}
error_number = is_sane(NESET, source);
if(error_number != 0) {
strcpy(symbol->errtxt, "Invalid characters in input");
return ERROR_INVALID_DATA;
}
switch(input_length) {
case 3: input_value = 100 * ctoi(source[0]);
input_value += 10 * ctoi(source[1]);
input_value += ctoi(source[2]);
break;
case 2: input_value = 10 * ctoi(source[0]);
input_value += ctoi(source[1]);
break;
case 1: input_value = ctoi(source[0]);
break;
}
if(input_value > 255) {
strcpy(symbol->errtxt, "Input too large");
return ERROR_INVALID_DATA;
}
strcpy(binary_string, "");
if(input_value & 0x80) { concat(binary_string, "1"); } else { concat(binary_string, "0"); }
if(input_value & 0x40) { concat(binary_string, "1"); } else { concat(binary_string, "0"); }
if(input_value & 0x20) { concat(binary_string, "1"); } else { concat(binary_string, "0"); }
if(input_value & 0x10) { concat(binary_string, "1"); } else { concat(binary_string, "0"); }
if(input_value & 0x08) { concat(binary_string, "1"); } else { concat(binary_string, "0"); }
if(input_value & 0x04) { concat(binary_string, "1"); } else { concat(binary_string, "0"); }
if(input_value & 0x02) { concat(binary_string, "1"); } else { concat(binary_string, "0"); }
if(input_value & 0x01) { concat(binary_string, "1"); } else { concat(binary_string, "0"); }
data_codewords[0] = 0;
data_codewords[1] = 0;
for(i = 0; i < 2; i++) {
if(binary_string[i * 4] == '1') { data_codewords[i] += 8; }
if(binary_string[(i * 4) + 1] == '1') { data_codewords[i] += 4; }
if(binary_string[(i * 4) + 2] == '1') { data_codewords[i] += 2; }
if(binary_string[(i * 4) + 3] == '1') { data_codewords[i] += 1; }
}
rs_init_gf(0x13);
rs_init_code(5, 1);
rs_encode(2, data_codewords, ecc_codewords);
rs_free();
strcpy(binary_string, "");
for(i = 0; i < 5; i++) {
if(ecc_codewords[4 - i] & 0x08) { binary_string[(i * 4) + 8] = '1'; } else { binary_string[(i * 4) + 8] = '0'; }
if(ecc_codewords[4 - i] & 0x04) { binary_string[(i * 4) + 9] = '1'; } else { binary_string[(i * 4) + 9] = '0'; }
if(ecc_codewords[4 - i] & 0x02) { binary_string[(i * 4) + 10] = '1'; } else { binary_string[(i * 4) + 10] = '0'; }
if(ecc_codewords[4 - i] & 0x01) { binary_string[(i * 4) + 11] = '1'; } else { binary_string[(i * 4) + 11] = '0'; }
}
for(i = 0; i < 28; i += 2) {
if(binary_string[i] == '1') { binary_string[i] = '0'; } else { binary_string[i] = '1'; }
}
for(y = 8; y < 19; y++) {
for(x = 8; x < 19; x++) {
if(CompactAztecMap[(y * 27) + x] == 1) {
symbol->encoded_data[y - 8][x - 8] = '1';
}
if(CompactAztecMap[(y * 27) + x] >= 2) {
if(binary_string[CompactAztecMap[(y * 27) + x] - 2000] == '1') {
symbol->encoded_data[y - 8][x - 8] = '1';
}
}
}
symbol->row_height[y - 8] = 1;
}
symbol->rows = 11;
symbol->width = 11;
return 0;
}

View File

@ -110,6 +110,7 @@ extern int daft_code(struct zint_symbol *symbol, unsigned char source[]); /* DAF
extern int ean_14(struct zint_symbol *symbol, unsigned char source[]); /* EAN-14 */ extern int ean_14(struct zint_symbol *symbol, unsigned char source[]); /* EAN-14 */
extern int nve_18(struct zint_symbol *symbol, unsigned char source[]); /* NVE-18 */ extern int nve_18(struct zint_symbol *symbol, unsigned char source[]); /* NVE-18 */
extern int microqr(struct zint_symbol *symbol, unsigned char source[]); /* Micro QR Code */ extern int microqr(struct zint_symbol *symbol, unsigned char source[]); /* Micro QR Code */
extern int aztec_runes(struct zint_symbol *symbol, unsigned char source[]); /* Aztec Runes */
#ifndef NO_PNG #ifndef NO_PNG
int png_handle(struct zint_symbol *symbol, int rotate_angle); int png_handle(struct zint_symbol *symbol, int rotate_angle);
@ -175,7 +176,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *input)
if(symbol->symbology == 88) { symbol->symbology = BARCODE_EAN128; } if(symbol->symbology == 88) { symbol->symbology = BARCODE_EAN128; }
if(symbol->symbology == 91) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128 [Z09]"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; } if(symbol->symbology == 91) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128 [Z09]"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; }
if((symbol->symbology >= 94) && (symbol->symbology <= 96)) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128 [Z10]"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; } if((symbol->symbology >= 94) && (symbol->symbology <= 96)) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128 [Z10]"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; }
if((symbol->symbology >= 98) && (symbol->symbology <= 128)) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128 [Z10]"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; } if((symbol->symbology >= 98) && (symbol->symbology <= 127)) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128 [Z10]"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; }
/* Everything from 128 up is Zint-specific */ /* Everything from 128 up is Zint-specific */
if(symbol->symbology >= 140) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128 [Z11]"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; } if(symbol->symbology >= 140) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128 [Z11]"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; }
@ -268,6 +269,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *input)
case BARCODE_DAFT: error_number = daft_code(symbol, input); break; case BARCODE_DAFT: error_number = daft_code(symbol, input); break;
case BARCODE_EAN14: error_number = ean_14(symbol, input); break; case BARCODE_EAN14: error_number = ean_14(symbol, input); break;
case BARCODE_MICROQR: error_number = microqr(symbol, input); break; case BARCODE_MICROQR: error_number = microqr(symbol, input); break;
case BARCODE_AZRUNE: error_number = aztec_runes(symbol, input); break;
} }
if(error_number == 0) { if(error_number == 0) {
error_number = error_buffer; error_number = error_buffer;

View File

@ -112,6 +112,7 @@ struct zint_symbol {
#define BARCODE_MICROQR 97 #define BARCODE_MICROQR 97
/* Zint specific */ /* Zint specific */
#define BARCODE_AZRUNE 128
#define BARCODE_CODE32 129 #define BARCODE_CODE32 129
#define BARCODE_EANX_CC 130 #define BARCODE_EANX_CC 130
#define BARCODE_EAN128_CC 131 #define BARCODE_EAN128_CC 131

BIN
docs/azrune.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 336 B

View File

@ -5,7 +5,7 @@
<TITLE>Using the API</TITLE> <TITLE>Using the API</TITLE>
<META NAME="GENERATOR" CONTENT="OpenOffice.org 2.4 (Unix)"> <META NAME="GENERATOR" CONTENT="OpenOffice.org 2.4 (Unix)">
<META NAME="CREATED" CONTENT="20070730;21081900"> <META NAME="CREATED" CONTENT="20070730;21081900">
<META NAME="CHANGED" CONTENT="20081102;13564600"> <META NAME="CHANGED" CONTENT="20081109;9211000">
<STYLE TYPE="text/css"> <STYLE TYPE="text/css">
<!-- <!--
TD P { color: #000000 } TD P { color: #000000 }
@ -1169,6 +1169,17 @@ following table. For example</P>
<P ALIGN=CENTER>Micro QR Code</P> <P ALIGN=CENTER>Micro QR Code</P>
</TD> </TD>
</TR> </TR>
<TR VALIGN=TOP>
<TD WIDTH=150>
<P ALIGN=CENTER>128</P>
</TD>
<TD WIDTH=382>
<P ALIGN=CENTER><FONT FACE="Courier">BARCODE_AZRUNE</FONT></P>
</TD>
<TD WIDTH=366>
<P ALIGN=CENTER>Aztec Runes</P>
</TD>
</TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD WIDTH=150> <TD WIDTH=150>
<P ALIGN=CENTER>129</P> <P ALIGN=CENTER>129</P>

View File

@ -5,7 +5,7 @@
<TITLE>Using the Front End</TITLE> <TITLE>Using the Front End</TITLE>
<META NAME="GENERATOR" CONTENT="OpenOffice.org 2.4 (Unix)"> <META NAME="GENERATOR" CONTENT="OpenOffice.org 2.4 (Unix)">
<META NAME="CREATED" CONTENT="20070730;21081900"> <META NAME="CREATED" CONTENT="20070730;21081900">
<META NAME="CHANGED" CONTENT="20081102;13553900"> <META NAME="CHANGED" CONTENT="20081109;9200500">
<STYLE TYPE="text/css"> <STYLE TYPE="text/css">
<!-- <!--
TD P { color: #000000 } TD P { color: #000000 }
@ -553,6 +553,14 @@ appropriate integer value in the following table.</P>
<P ALIGN=CENTER>Micro QR Code</P> <P ALIGN=CENTER>Micro QR Code</P>
</TD> </TD>
</TR> </TR>
<TR VALIGN=TOP>
<TD WIDTH=139>
<P ALIGN=CENTER>128</P>
</TD>
<TD WIDTH=643>
<P ALIGN=CENTER>Aztec Runes</P>
</TD>
</TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD WIDTH=139> <TD WIDTH=139>
<P ALIGN=CENTER>129</P> <P ALIGN=CENTER>129</P>

View File

@ -260,6 +260,8 @@ the barcode symbologies supported by them.</P>
5.6.4 <A HREF="twodims.html#MAXI">Maxicode (ISO 16023)</A> 5.6.4 <A HREF="twodims.html#MAXI">Maxicode (ISO 16023)</A>
</DT><DT> </DT><DT>
5.6.5 <A HREF="twodims.html#AZTEC">Aztec Code (ISO 24778)</A> 5.6.5 <A HREF="twodims.html#AZTEC">Aztec Code (ISO 24778)</A>
</DT><DT>
5.6.6 <A HREF="twodims.html#AZRUNE">Aztec Runes</A>
</DT></DL> </DT></DL>
<DT> <DT>
5.7 <A HREF="markings.html">Other Barcode-Like Markings</A></DT><DL> 5.7 <A HREF="markings.html">Other Barcode-Like Markings</A></DT><DL>

View File

@ -5,7 +5,7 @@
<TITLE>Two-Dimensional Symbols</TITLE> <TITLE>Two-Dimensional Symbols</TITLE>
<META NAME="GENERATOR" CONTENT="OpenOffice.org 2.4 (Unix)"> <META NAME="GENERATOR" CONTENT="OpenOffice.org 2.4 (Unix)">
<META NAME="CREATED" CONTENT="20070730;21081900"> <META NAME="CREATED" CONTENT="20070730;21081900">
<META NAME="CHANGED" CONTENT="20081102;14024700"> <META NAME="CHANGED" CONTENT="20081109;9283500">
<STYLE TYPE="text/css"> <STYLE TYPE="text/css">
<!-- <!--
TD P { color: #000000 } TD P { color: #000000 }
@ -606,7 +606,14 @@ then the error correction capacity selection will be ignored.</P>
<P ALIGN=LEFT>Aztec Code is able to encode any extended ASCII <P ALIGN=LEFT>Aztec Code is able to encode any extended ASCII
character data up to a maximum length of approximately 3823 numeric character data up to a maximum length of approximately 3823 numeric
or 3067 alphabetic characters or 1914 bytes of data.</P> or 3067 alphabetic characters or 1914 bytes of data.</P>
<P ALIGN=LEFT><IMG SRC="aztec.png" NAME="graphics4" ALIGN=BOTTOM WIDTH=114 HEIGHT=114 BORDER=0></P> <P ALIGN=LEFT><IMG SRC="aztec.png" NAME="graphics4" ALIGN=LEFT WIDTH=46 HEIGHT=46 BORDER=0><BR CLEAR=LEFT><BR><BR>
</P>
<P><A NAME="AZRUNE"></A><FONT SIZE=5><B>5.6.6 Aztec Runes</B></FONT></P>
<P ALIGN=LEFT>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.</P>
<P ALIGN=LEFT><IMG SRC="azrune.png" NAME="graphics6" ALIGN=LEFT WIDTH=22 HEIGHT=22 BORDER=0><BR CLEAR=LEFT><BR><BR>
</P>
<HR> <HR>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0> <TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0>
<TR VALIGN=TOP> <TR VALIGN=TOP>

View File

@ -164,6 +164,9 @@ echo testing Royal Mail 4 State
echo testing Data Matrix echo testing Data Matrix
./zint -o bar71.png -b 71 -d "Demonstration Data Matrix symbol generated by libzint" ./zint -o bar71.png -b 71 -d "Demonstration Data Matrix symbol generated by libzint"
./zint -o bar71.eps -b 71 -d "Demonstration Data Matrix symbol generated by libzint" ./zint -o bar71.eps -b 71 -d "Demonstration Data Matrix symbol generated by libzint"
echo testing Data Matrix ECC 050
./zint -o bar71b.png --mode=3 -b 71 -d "Demonstration Data Matrix symbol generated by libzint"
./zint -o bar71b.eps --mode=3 -b 71 -d "Demonstration Data Matrix symbol generated by libzint"
echo testing EAN-14 echo testing EAN-14
./zint -o bar72.png -b 72 --height=50 -d 3210987654321 ./zint -o bar72.png -b 72 --height=50 -d 3210987654321
./zint -o bar72.eps -b 72 --height=50 -d 3210987654321 ./zint -o bar72.eps -b 72 --height=50 -d 3210987654321
@ -215,6 +218,12 @@ echo testing Aztec Code
echo testing DAFT Code echo testing DAFT Code
./zint -o bar93.eps -b 93 -d "daftdaftdaftdaftdaftdaftdaftdaftdaft" ./zint -o bar93.eps -b 93 -d "daftdaftdaftdaftdaftdaftdaftdaftdaft"
./zint -o bar93.png -b 93 -d "daftdaftdaftdaftdaftdaftdaftdaftdaft" ./zint -o bar93.png -b 93 -d "daftdaftdaftdaftdaftdaftdaftdaftdaft"
echo testing Micro QR Code
./zint -o bar97.eps -b 97 -d "MicroQR Code"
./zint -o bar97.png -b 97 -d "MicroQR Code"
echo testing Aztec Runes
./zint -o bar128.eps -b 128 -d 125
./zint -o bar128.png -b 128 -d 125
echo testing Code 23 echo testing Code 23
./zint -o bar129.eps -b 129 -d "12345678" ./zint -o bar129.eps -b 129 -d "12345678"
./zint -o bar129.png -b 129 -d "12345678" ./zint -o bar129.png -b 129 -d "12345678"