2008-07-14 09:15:55 +12:00
|
|
|
/* zint.h - definitions for libzint
|
|
|
|
|
|
|
|
libzint - the open source barcode library
|
2009-11-09 10:24:32 +13:00
|
|
|
Copyright (C) 2009 Robin Stuart <robin@zint.org.uk>
|
2008-07-14 09:15:55 +12:00
|
|
|
|
|
|
|
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
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along
|
|
|
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2008-09-03 07:57:47 +12:00
|
|
|
|
2008-07-19 02:47:03 +12:00
|
|
|
#ifndef ZINT_H
|
|
|
|
#define ZINT_H
|
2008-07-14 09:15:55 +12:00
|
|
|
|
2008-07-19 02:47:03 +12:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
2008-07-14 09:15:55 +12:00
|
|
|
|
2010-05-31 05:25:24 +12:00
|
|
|
struct zint_render_line {
|
|
|
|
float x, y, length, width;
|
|
|
|
struct zint_render_line *next; /* Pointer to next line */
|
|
|
|
};
|
|
|
|
|
2010-06-12 03:25:41 +12:00
|
|
|
struct zint_render_string {
|
2010-05-31 05:25:24 +12:00
|
|
|
float x, y, fsize;
|
2010-06-19 22:41:49 +12:00
|
|
|
float width; /* Suggested string width, may be 0 if none recommended */
|
|
|
|
int length;
|
|
|
|
unsigned char *text;
|
2010-06-12 03:25:41 +12:00
|
|
|
struct zint_render_string *next; /* Pointer to next character */
|
2010-05-31 05:25:24 +12:00
|
|
|
};
|
|
|
|
|
|
|
|
struct zint_render {
|
|
|
|
float width, height;
|
|
|
|
struct zint_render_line *lines; /* Pointer to first line */
|
2010-06-12 03:25:41 +12:00
|
|
|
struct zint_render_string *strings; /* Pointer to first string */
|
2010-05-31 05:25:24 +12:00
|
|
|
};
|
|
|
|
|
2008-07-14 09:15:55 +12:00
|
|
|
struct zint_symbol {
|
|
|
|
int symbology;
|
|
|
|
int height;
|
|
|
|
int whitespace_width;
|
|
|
|
int border_width;
|
|
|
|
int output_options;
|
|
|
|
char fgcolour[10];
|
|
|
|
char bgcolour[10];
|
|
|
|
char outfile[256];
|
2008-12-21 04:21:04 +13:00
|
|
|
float scale;
|
2008-07-14 09:15:55 +12:00
|
|
|
int option_1;
|
|
|
|
int option_2;
|
2008-07-19 02:47:03 +12:00
|
|
|
int option_3;
|
2010-05-17 09:58:18 +12:00
|
|
|
int show_hrt;
|
2009-01-11 22:11:03 +13:00
|
|
|
int input_mode;
|
2009-10-07 08:03:00 +13:00
|
|
|
unsigned char text[128];
|
2008-07-14 09:15:55 +12:00
|
|
|
int rows;
|
|
|
|
int width;
|
2009-10-07 08:03:00 +13:00
|
|
|
char primary[128];
|
2009-06-01 08:33:54 +12:00
|
|
|
unsigned char encoded_data[178][143];
|
|
|
|
int row_height[178]; /* Largest symbol is 177x177 QR Code */
|
2008-07-14 09:15:55 +12:00
|
|
|
char errtxt[100];
|
2009-11-09 10:24:32 +13:00
|
|
|
char *bitmap;
|
|
|
|
int bitmap_width;
|
|
|
|
int bitmap_height;
|
2010-05-31 05:25:24 +12:00
|
|
|
struct zint_render *rendered;
|
2008-07-14 09:15:55 +12:00
|
|
|
};
|
|
|
|
|
2010-05-31 05:25:24 +12:00
|
|
|
|
2008-09-16 19:50:43 +12:00
|
|
|
/* Tbarcode 7 codes */
|
2008-07-14 09:15:55 +12:00
|
|
|
#define BARCODE_CODE11 1
|
|
|
|
#define BARCODE_C25MATRIX 2
|
|
|
|
#define BARCODE_C25INTER 3
|
|
|
|
#define BARCODE_C25IATA 4
|
|
|
|
#define BARCODE_C25LOGIC 6
|
|
|
|
#define BARCODE_C25IND 7
|
|
|
|
#define BARCODE_CODE39 8
|
|
|
|
#define BARCODE_EXCODE39 9
|
|
|
|
#define BARCODE_EANX 13
|
|
|
|
#define BARCODE_EAN128 16
|
|
|
|
#define BARCODE_CODABAR 18
|
|
|
|
#define BARCODE_CODE128 20
|
|
|
|
#define BARCODE_DPLEIT 21
|
|
|
|
#define BARCODE_DPIDENT 22
|
|
|
|
#define BARCODE_CODE16K 23
|
2008-09-19 21:07:59 +12:00
|
|
|
#define BARCODE_CODE49 24
|
2008-07-14 09:15:55 +12:00
|
|
|
#define BARCODE_CODE93 25
|
|
|
|
#define BARCODE_FLAT 28
|
|
|
|
#define BARCODE_RSS14 29
|
|
|
|
#define BARCODE_RSS_LTD 30
|
|
|
|
#define BARCODE_RSS_EXP 31
|
|
|
|
#define BARCODE_TELEPEN 32
|
|
|
|
#define BARCODE_UPCA 34
|
|
|
|
#define BARCODE_UPCE 37
|
|
|
|
#define BARCODE_POSTNET 40
|
|
|
|
#define BARCODE_MSI_PLESSEY 47
|
|
|
|
#define BARCODE_FIM 49
|
|
|
|
#define BARCODE_LOGMARS 50
|
|
|
|
#define BARCODE_PHARMA 51
|
|
|
|
#define BARCODE_PZN 52
|
|
|
|
#define BARCODE_PHARMA_TWO 53
|
|
|
|
#define BARCODE_PDF417 55
|
|
|
|
#define BARCODE_PDF417TRUNC 56
|
|
|
|
#define BARCODE_MAXICODE 57
|
|
|
|
#define BARCODE_QRCODE 58
|
|
|
|
#define BARCODE_CODE128B 60
|
|
|
|
#define BARCODE_AUSPOST 63
|
|
|
|
#define BARCODE_AUSREPLY 66
|
|
|
|
#define BARCODE_AUSROUTE 67
|
|
|
|
#define BARCODE_AUSREDIRECT 68
|
|
|
|
#define BARCODE_ISBNX 69
|
|
|
|
#define BARCODE_RM4SCC 70
|
|
|
|
#define BARCODE_DATAMATRIX 71
|
2008-09-19 21:07:59 +12:00
|
|
|
#define BARCODE_EAN14 72
|
2008-09-16 19:50:43 +12:00
|
|
|
#define BARCODE_CODABLOCKF 74
|
2008-07-14 09:15:55 +12:00
|
|
|
#define BARCODE_NVE18 75
|
2009-03-15 00:04:52 +13:00
|
|
|
#define BARCODE_JAPANPOST 76
|
2008-07-14 09:15:55 +12:00
|
|
|
#define BARCODE_KOREAPOST 77
|
|
|
|
#define BARCODE_RSS14STACK 79
|
|
|
|
#define BARCODE_RSS14STACK_OMNI 80
|
|
|
|
#define BARCODE_RSS_EXPSTACK 81
|
|
|
|
#define BARCODE_PLANET 82
|
|
|
|
#define BARCODE_MICROPDF417 84
|
|
|
|
#define BARCODE_ONECODE 85
|
|
|
|
#define BARCODE_PLESSEY 86
|
2008-09-16 19:50:43 +12:00
|
|
|
|
|
|
|
/* Tbarcode 8 codes */
|
2008-09-19 21:07:59 +12:00
|
|
|
#define BARCODE_TELEPEN_NUM 87
|
|
|
|
#define BARCODE_ITF14 89
|
2008-09-16 19:50:43 +12:00
|
|
|
#define BARCODE_KIX 90
|
|
|
|
#define BARCODE_AZTEC 92
|
|
|
|
#define BARCODE_DAFT 93
|
|
|
|
#define BARCODE_MICROQR 97
|
|
|
|
|
2009-02-01 11:03:46 +13:00
|
|
|
/* Tbarcode 9 codes */
|
|
|
|
#define BARCODE_HIBC_128 98
|
|
|
|
#define BARCODE_HIBC_39 99
|
|
|
|
#define BARCODE_HIBC_DM 102
|
|
|
|
#define BARCODE_HIBC_QR 104
|
|
|
|
#define BARCODE_HIBC_PDF 106
|
|
|
|
#define BARCODE_HIBC_MICPDF 108
|
|
|
|
#define BARCODE_HIBC_BLOCKF 110
|
2009-11-03 23:54:21 +13:00
|
|
|
#define BARCODE_HIBC_AZTEC 112
|
2009-02-01 11:03:46 +13:00
|
|
|
|
2008-09-16 19:50:43 +12:00
|
|
|
/* Zint specific */
|
2008-11-09 23:06:05 +13:00
|
|
|
#define BARCODE_AZRUNE 128
|
2008-09-16 19:50:43 +12:00
|
|
|
#define BARCODE_CODE32 129
|
|
|
|
#define BARCODE_EANX_CC 130
|
|
|
|
#define BARCODE_EAN128_CC 131
|
|
|
|
#define BARCODE_RSS14_CC 132
|
|
|
|
#define BARCODE_RSS_LTD_CC 133
|
|
|
|
#define BARCODE_RSS_EXP_CC 134
|
|
|
|
#define BARCODE_UPCA_CC 135
|
|
|
|
#define BARCODE_UPCE_CC 136
|
|
|
|
#define BARCODE_RSS14STACK_CC 137
|
|
|
|
#define BARCODE_RSS14_OMNI_CC 138
|
|
|
|
#define BARCODE_RSS_EXPSTACK_CC 139
|
2009-05-17 02:19:43 +12:00
|
|
|
#define BARCODE_CHANNEL 140
|
2009-07-05 08:48:42 +12:00
|
|
|
#define BARCODE_CODEONE 141
|
2009-09-29 22:45:46 +13:00
|
|
|
#define BARCODE_GRIDMATRIX 142
|
2008-07-14 09:15:55 +12:00
|
|
|
|
|
|
|
#define BARCODE_NO_ASCII 1
|
|
|
|
#define BARCODE_BIND 2
|
|
|
|
#define BARCODE_BOX 4
|
2008-12-22 01:17:14 +13:00
|
|
|
#define BARCODE_STDOUT 8
|
2009-12-03 23:04:04 +13:00
|
|
|
#define READER_INIT 16
|
2008-07-14 09:15:55 +12:00
|
|
|
|
2009-01-11 22:11:03 +13:00
|
|
|
#define DATA_MODE 0
|
|
|
|
#define UNICODE_MODE 1
|
|
|
|
#define GS1_MODE 2
|
|
|
|
#define KANJI_MODE 3
|
2009-02-23 03:13:32 +13:00
|
|
|
#define SJIS_MODE 4
|
2009-01-11 22:11:03 +13:00
|
|
|
|
2009-08-15 04:52:08 +12:00
|
|
|
#define DM_SQUARE 100
|
|
|
|
|
2008-07-14 09:15:55 +12:00
|
|
|
#define WARN_INVALID_OPTION 2
|
|
|
|
#define ERROR_TOO_LONG 5
|
|
|
|
#define ERROR_INVALID_DATA 6
|
|
|
|
#define ERROR_INVALID_CHECK 7
|
|
|
|
#define ERROR_INVALID_OPTION 8
|
|
|
|
#define ERROR_ENCODING_PROBLEM 9
|
|
|
|
#define ERROR_FILE_ACCESS 10
|
|
|
|
#define ERROR_MEMORY 11
|
|
|
|
|
2009-06-03 08:23:38 +12:00
|
|
|
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(_MSC_VER)
|
|
|
|
# if defined (DLL_EXPORT) || defined(PIC) || defined(_USRDLL)
|
|
|
|
# define ZINT_EXTERN __declspec(dllexport)
|
|
|
|
# elif defined(ZINT_DLL)
|
|
|
|
# define ZINT_EXTERN __declspec(dllimport)
|
|
|
|
# else
|
|
|
|
# define ZINT_EXTERN extern
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
# define ZINT_EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
|
|
|
ZINT_EXTERN struct zint_symbol *ZBarcode_Create(void);
|
2009-12-02 22:09:45 +13:00
|
|
|
ZINT_EXTERN void ZBarcode_Clear(struct zint_symbol *symbol);
|
|
|
|
ZINT_EXTERN void ZBarcode_Delete(struct zint_symbol *symbol);
|
2009-09-29 22:45:46 +13:00
|
|
|
|
|
|
|
ZINT_EXTERN int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *input, int length);
|
|
|
|
ZINT_EXTERN int ZBarcode_Encode_File(struct zint_symbol *symbol, char *filename);
|
|
|
|
ZINT_EXTERN int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle);
|
|
|
|
ZINT_EXTERN int ZBarcode_Encode_and_Print(struct zint_symbol *symbol, unsigned char *input, int length, int rotate_angle);
|
|
|
|
ZINT_EXTERN int ZBarcode_Encode_File_and_Print(struct zint_symbol *symbol, char *filename, int rotate_angle);
|
|
|
|
|
2010-06-19 22:41:49 +12:00
|
|
|
ZINT_EXTERN int ZBarcode_Render(struct zint_symbol *symbol, float width, float height);
|
2010-05-31 05:25:24 +12:00
|
|
|
|
2009-11-09 10:24:32 +13:00
|
|
|
ZINT_EXTERN int ZBarcode_Buffer(struct zint_symbol *symbol, int rotate_angle);
|
2009-12-02 22:09:45 +13:00
|
|
|
ZINT_EXTERN int ZBarcode_Encode_and_Buffer(struct zint_symbol *symbol, unsigned char *input, int length, int rotate_angle);
|
2009-11-09 10:24:32 +13:00
|
|
|
ZINT_EXTERN int ZBarcode_Encode_File_and_Buffer(struct zint_symbol *symbol, char *filename, int rotate_angle);
|
|
|
|
|
2009-09-29 22:45:46 +13:00
|
|
|
ZINT_EXTERN int ZBarcode_ValidID(int symbol_id);
|
|
|
|
|
2008-07-19 02:47:03 +12:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2009-06-03 08:23:38 +12:00
|
|
|
#endif /* ZINT_H */
|