2008-07-13 21:15:55 +00:00
/* zint.h - definitions for libzint
libzint - the open source barcode library
2018-06-10 09:16:18 +01:00
Copyright ( C ) 2009 - 2018 Robin Stuart < rstuart114 @ gmail . com >
2008-07-13 21:15:55 +00:00
2013-05-16 19:26:38 +02:00
Redistribution and use in source and binary forms , with or without
modification , are permitted provided that the following conditions
are met :
2017-10-23 21:37:52 +02:00
1. Redistributions of source code must retain the above copyright
notice , this list of conditions and the following disclaimer .
2013-05-16 19:26:38 +02:00
2. Redistributions in binary form must reproduce the above copyright
notice , this list of conditions and the following disclaimer in the
2017-10-23 21:37:52 +02:00
documentation and / or other materials provided with the distribution .
2013-05-16 19:26:38 +02:00
3. Neither the name of the project nor the names of its contributors
may be used to endorse or promote products derived from this software
2017-10-23 21:37:52 +02:00
without specific prior written permission .
2013-05-16 19:26:38 +02:00
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS " AS IS " AND
ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT , INDIRECT , INCIDENTAL , SPECIAL , EXEMPLARY , OR CONSEQUENTIAL
DAMAGES ( INCLUDING , BUT NOT LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; OR BUSINESS INTERRUPTION )
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT
LIABILITY , OR TORT ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY
2017-10-23 21:37:52 +02:00
OUT OF THE USE OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF
2013-05-16 19:26:38 +02:00
SUCH DAMAGE .
2016-02-20 11:29:19 +00:00
*/
2008-09-02 19:57:47 +00:00
2008-07-18 14:47:03 +00:00
# ifndef ZINT_H
# define ZINT_H
2008-07-13 21:15:55 +00:00
2008-07-18 14:47:03 +00:00
# ifdef __cplusplus
extern " C " {
# endif /* __cplusplus */
2008-07-13 21:15:55 +00:00
2016-02-20 11:29:19 +00:00
struct zint_render_line {
float x , y , length , width ;
struct zint_render_line * next ; /* Pointer to next line */
} ;
2018-06-10 09:16:18 +01:00
struct zint_vector_rect {
float x , y , height , width ;
int colour ;
struct zint_vector_rect * next ;
} ;
2016-02-20 11:29:19 +00:00
struct zint_render_string {
float x , y , fsize ;
float width ; /* Suggested string width, may be 0 if none recommended */
int length ;
unsigned char * text ;
struct zint_render_string * next ; /* Pointer to next character */
} ;
2018-06-10 09:16:18 +01:00
struct zint_vector_string {
float x , y , fsize ;
float width ; /* Suggested string width, may be 0 if none recommended */
int length ;
unsigned char * text ;
struct zint_vector_string * next ; /* Pointer to next character */
} ;
2016-02-20 11:29:19 +00:00
struct zint_render_ring {
float x , y , radius , line_width ;
struct zint_render_ring * next ; /* Pointer to next ring */
} ;
2018-06-10 09:16:18 +01:00
struct zint_vector_circle {
float x , y , diameter ;
int colour ;
struct zint_vector_circle * next ; /* Pointer to next circle */
} ;
2016-02-20 11:29:19 +00:00
struct zint_render_hexagon {
2017-10-16 10:01:09 +02:00
float x , y , height ;
2016-02-20 11:29:19 +00:00
struct zint_render_hexagon * next ; /* Pointer to next hexagon */
} ;
2018-06-10 09:16:18 +01:00
struct zint_vector_hexagon {
float x , y , diameter ;
struct zint_vector_hexagon * next ; /* Pointer to next hexagon */
} ;
2016-02-20 11:29:19 +00:00
struct zint_render {
float width , height ;
struct zint_render_line * lines ; /* Pointer to first line */
struct zint_render_string * strings ; /* Pointer to first string */
struct zint_render_ring * rings ; /* Pointer to first ring */
struct zint_render_hexagon * hexagons ; /* Pointer to first hexagon */
} ;
2018-06-10 09:16:18 +01:00
struct zint_vector {
float width , height ;
struct zint_vector_rect * rectangles ; /* Pointer to first rectangle */
struct zint_vector_hexagon * hexagons ; /* Pointer to first hexagon */
struct zint_vector_string * strings ; /* Points to first string */
struct zint_vector_circle * circles ; /* Points to first circle */
} ;
2016-02-20 11:29:19 +00: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 ] ;
float scale ;
int option_1 ;
int option_2 ;
int option_3 ;
int show_hrt ;
2018-02-11 09:55:28 +00:00
int fontsize ;
2016-02-20 11:29:19 +00:00
int input_mode ;
2016-08-16 12:43:41 +01:00
int eci ;
2016-02-20 11:29:19 +00:00
unsigned char text [ 128 ] ;
int rows ;
int width ;
char primary [ 128 ] ;
2016-08-21 21:58:38 +01:00
unsigned char encoded_data [ 200 ] [ 143 ] ;
int row_height [ 200 ] ; /* Largest symbol is 189 x 189 Han Xin */
2016-02-20 11:29:19 +00:00
char errtxt [ 100 ] ;
char * bitmap ;
int bitmap_width ;
int bitmap_height ;
2016-07-19 23:02:39 +01:00
unsigned int bitmap_byte_length ;
2016-09-18 14:09:58 +01:00
float dot_size ;
2018-06-10 09:16:18 +01:00
struct zint_vector * vector ;
2016-02-20 11:29:19 +00:00
struct zint_render * rendered ;
2017-04-11 10:05:38 +01:00
int debug ;
2016-02-20 11:29:19 +00:00
} ;
2016-12-10 09:04:06 +00:00
# define ZINT_VERSION_MAJOR 2
2017-05-11 21:14:38 +01:00
# define ZINT_VERSION_MINOR 6
2019-08-30 19:18:14 +02:00
# define ZINT_VERSION_RELEASE 4
2017-10-23 21:37:52 +02:00
2016-02-20 11:29:19 +00:00
/* Tbarcode 7 codes */
2008-07-13 21:15:55 +00: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
2016-10-28 19:43:08 +01:00
# define BARCODE_EANX_CHK 14
2008-07-13 21:15:55 +00:00
# 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 09:07:59 +00:00
# define BARCODE_CODE49 24
2008-07-13 21:15:55 +00: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
2016-10-28 19:43:08 +01:00
# define BARCODE_UPCA_CHK 35
2008-07-13 21:15:55 +00:00
# define BARCODE_UPCE 37
2016-10-28 19:43:08 +01:00
# define BARCODE_UPCE_CHK 38
2008-07-13 21:15:55 +00:00
# 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 09:07:59 +00:00
# define BARCODE_EAN14 72
2018-02-03 18:44:01 +00:00
# define BARCODE_VIN 73
2016-09-12 21:47:40 +01:00
# define BARCODE_CODABLOCKF 74
2008-07-13 21:15:55 +00:00
# define BARCODE_NVE18 75
2009-03-14 11:04:52 +00:00
# define BARCODE_JAPANPOST 76
2008-07-13 21:15:55 +00: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 07:50:43 +00:00
2016-02-20 11:29:19 +00:00
/* Tbarcode 8 codes */
2008-09-19 09:07:59 +00:00
# define BARCODE_TELEPEN_NUM 87
# define BARCODE_ITF14 89
2008-09-16 07:50:43 +00:00
# define BARCODE_KIX 90
# define BARCODE_AZTEC 92
# define BARCODE_DAFT 93
# define BARCODE_MICROQR 97
2016-02-20 11:29:19 +00:00
/* Tbarcode 9 codes */
2009-01-31 22:03:46 +00:00
# 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 10:54:21 +00:00
# define BARCODE_HIBC_AZTEC 112
2017-10-23 21:37:52 +02:00
2016-04-07 17:13:43 +01:00
/* Tbarcode 10 codes */
# define BARCODE_DOTCODE 115
# define BARCODE_HANXIN 116
2018-02-06 20:57:01 +00:00
/*Tbarcode 11 codes*/
# define BARCODE_MAILMARK 121
2009-01-31 22:03:46 +00:00
2016-02-20 11:29:19 +00:00
/* Zint specific */
2008-11-09 10:06:05 +00:00
# define BARCODE_AZRUNE 128
2008-09-16 07:50:43 +00: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-16 14:19:43 +00:00
# define BARCODE_CHANNEL 140
2009-07-04 20:48:42 +00:00
# define BARCODE_CODEONE 141
2009-09-29 09:45:46 +00:00
# define BARCODE_GRIDMATRIX 142
2017-05-20 23:37:50 +01:00
# define BARCODE_UPNQR 143
2019-03-21 09:14:24 +00:00
# define BARCODE_ULTRA 144
2008-07-13 21:15:55 +00:00
2016-07-19 23:02:39 +01:00
// Output options
2008-07-13 21:15:55 +00:00
# define BARCODE_NO_ASCII 1
# define BARCODE_BIND 2
# define BARCODE_BOX 4
2008-12-21 12:17:14 +00:00
# define BARCODE_STDOUT 8
2009-12-03 10:04:04 +00:00
# define READER_INIT 16
2010-12-19 22:23:59 +00:00
# define SMALL_TEXT 32
2016-06-19 14:14:30 +01:00
# define BOLD_TEXT 64
# define CMYK_COLOUR 128
2016-07-12 15:00:25 +01:00
# define BARCODE_DOTTY_MODE 256
2019-08-30 16:14:17 +02:00
# define GS1_GS_SEPARATOR 512
2008-07-13 21:15:55 +00:00
2016-07-19 23:02:39 +01:00
// Input data types
2009-01-11 09:11:03 +00:00
# define DATA_MODE 0
# define UNICODE_MODE 1
# define GS1_MODE 2
2017-10-21 12:45:50 +01:00
# define ESCAPE_MODE 8
2009-01-11 09:11:03 +00:00
2016-07-19 23:02:39 +01:00
// Data Matrix specific options
2009-08-14 16:52:08 +00:00
# define DM_SQUARE 100
2016-07-19 23:02:39 +01:00
# define DM_DMRE 101
2009-08-14 16:52:08 +00:00
2016-07-19 23:02:39 +01:00
// Warning and error conditions
2016-02-17 10:37:20 +00:00
# define ZINT_WARN_INVALID_OPTION 2
2016-09-14 22:34:59 +01:00
# define ZINT_WARN_USES_ECI 3
2016-02-17 10:37:20 +00:00
# define ZINT_ERROR_TOO_LONG 5
2016-07-19 23:02:39 +01:00
# define ZINT_ERROR_INVALID_DATA 6
2016-02-17 10:37:20 +00:00
# define ZINT_ERROR_INVALID_CHECK 7
# define ZINT_ERROR_INVALID_OPTION 8
# define ZINT_ERROR_ENCODING_PROBLEM 9
2016-07-19 23:02:39 +01:00
# define ZINT_ERROR_FILE_ACCESS 10
2016-02-17 10:37:20 +00:00
# define ZINT_ERROR_MEMORY 11
2017-10-23 21:37:52 +02:00
2016-07-19 23:02:39 +01:00
// Raster file types
2016-10-02 10:45:47 +01:00
# define OUT_BUFFER 0
2018-06-10 09:16:18 +01:00
# define OUT_SVG_FILE 10
# define OUT_EPS_FILE 20
# define OUT_EMF_FILE 30
2016-07-19 23:02:39 +01:00
# define OUT_PNG_FILE 100
# define OUT_BMP_FILE 120
2016-07-23 15:08:55 +01:00
# define OUT_GIF_FILE 140
# define OUT_PCX_FILE 160
2016-12-23 16:48:03 +00:00
# define OUT_JPG_FILE 180
# define OUT_TIF_FILE 200
2008-07-13 21:15:55 +00:00
2009-06-02 20:23:38 +00:00
# if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(_MSC_VER)
2016-02-20 11:29:19 +00:00
# if defined (DLL_EXPORT) || defined(PIC) || defined(_USRDLL)
# define ZINT_EXTERN __declspec(dllexport)
# elif defined(ZINT_DLL)
# define ZINT_EXTERN __declspec(dllimport)
2009-06-02 20:23:38 +00:00
# else
2016-02-20 11:29:19 +00:00
# define ZINT_EXTERN extern
# endif
# else
2017-10-23 21:37:52 +02:00
# define ZINT_EXTERN extern
2009-06-02 20:23:38 +00:00
# endif
2016-02-20 11:29:19 +00:00
ZINT_EXTERN struct zint_symbol * ZBarcode_Create ( void ) ;
ZINT_EXTERN void ZBarcode_Clear ( struct zint_symbol * symbol ) ;
ZINT_EXTERN void ZBarcode_Delete ( struct zint_symbol * symbol ) ;
2009-09-29 09:45:46 +00:00
2017-09-10 12:03:09 -03:00
ZINT_EXTERN int ZBarcode_Encode ( struct zint_symbol * symbol , const unsigned char * source , int in_length ) ;
2016-02-20 11:29:19 +00:00
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 ) ;
2009-09-29 09:45:46 +00:00
2016-02-29 19:42:32 +00:00
ZINT_EXTERN int ZBarcode_Render ( struct zint_symbol * symbol , const float width , const float height ) ;
2010-05-30 19:25:24 +02:00
2016-02-20 11:29:19 +00:00
ZINT_EXTERN int ZBarcode_Buffer ( struct zint_symbol * symbol , int rotate_angle ) ;
2018-06-18 02:36:40 +01:00
ZINT_EXTERN int ZBarcode_Buffer_Vector ( struct zint_symbol * symbol , int rotate_angle ) ;
2016-02-20 11:29:19 +00:00
ZINT_EXTERN int ZBarcode_Encode_and_Buffer ( struct zint_symbol * symbol , unsigned char * input , int length , int rotate_angle ) ;
2018-06-18 02:36:40 +01:00
ZINT_EXTERN int ZBarcode_Encode_and_Buffer_Vector ( struct zint_symbol * symbol , unsigned char * input , int length , int rotate_angle ) ;
2016-02-20 11:29:19 +00:00
ZINT_EXTERN int ZBarcode_Encode_File_and_Buffer ( struct zint_symbol * symbol , char * filename , int rotate_angle ) ;
2018-06-18 02:36:40 +01:00
ZINT_EXTERN int ZBarcode_Encode_File_and_Buffer_Vector ( struct zint_symbol * symbol , char * filename , int rotate_angle ) ;
2009-11-08 21:24:32 +00:00
2016-02-20 11:29:19 +00:00
ZINT_EXTERN int ZBarcode_ValidID ( int symbol_id ) ;
2017-07-01 09:06:47 +01:00
ZINT_EXTERN int ZBarcode_Version ( ) ;
2009-09-29 09:45:46 +00:00
2008-07-18 14:47:03 +00:00
# ifdef __cplusplus
}
# endif /* __cplusplus */
2009-06-02 20:23:38 +00:00
# endif /* ZINT_H */
2017-10-23 21:37:52 +02:00