Eneboo - Documentación para desarrolladores
|
00001 /*************************************************************************** 00002 barcode.h - description 00003 ------------------- 00004 begin : Mie Jun 18 2003 00005 copyright : (C) 2003 by InfoSiAL, S.L. 00006 email : mail@infosial.com 00007 ***************************************************************************/ 00008 /*************************************************************************** 00009 * * 00010 * This program is free software; you can redistribute it and/or modify * 00011 * it under the terms of the GNU General Public License as published by * 00012 * the Free Software Foundation; either version 2 of the License, or * 00013 * (at your option) any later version. * 00014 * * 00015 ***************************************************************************/ 00016 00017 /* 00018 * barcode.h -- definitions for libbarcode 00019 * 00020 * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) 00021 * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) 00022 * 00023 * This program is free software; you can redistribute it and/or modify 00024 * it under the terms of the GNU General Public License as published by 00025 * the Free Software Foundation; either version 2 of the License, or 00026 * (at your option) any later version. 00027 * 00028 * This program is distributed in the hope that it will be useful, 00029 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00030 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00031 * GNU General Public License for more details. 00032 * 00033 * You should have received a copy of the GNU General Public License 00034 * along with this program; if not, write to the Free Software 00035 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 00036 */ 00037 00038 #ifndef _BARCODE_H_ 00039 #define _BARCODE_H_ 00040 00041 #include <stdio.h> 00042 #include <qstring.h> 00043 00044 #define BARCODE_VERSION "0.98" 00045 #define BARCODE_VERSION_INT 9800 00046 00047 /* 00048 * The object 00049 */ 00050 struct Barcode_Item { 00051 int flags; /* type of encoding and decoding */ 00052 char *ascii; /* malloced */ 00053 char *partial; /* malloced too */ 00054 char *textinfo; /* information about text positioning */ 00055 char *encoding; /* code name, filled by encoding engine */ 00056 int width, height; /* output units */ 00057 int xoff, yoff; /* output units */ 00058 int margin; /* output units */ 00059 double scalef; /* requested scaling for barcode */ 00060 int error; /* an errno-like value, in case of failure */ 00061 }; 00062 00063 /* 00064 * The flags field 00065 */ 00066 #define BARCODE_DEFAULT_FLAGS 0x00000000 00067 00068 #define BARCODE_ENCODING_MASK 0x000000ff /* 256 possibilites... */ 00069 #define BARCODE_NO_ASCII 0x00000100 /* avoid text in output */ 00070 #define BARCODE_NO_CHECKSUM 0x00000200 /* avoid checksum in output */ 00071 00072 #define BARCODE_OUTPUT_MASK 0x000ff000 /* 256 output types */ 00073 #define BARCODE_OUT_EPS 0x00001000 00074 #define BARCODE_OUT_PS 0x00002000 00075 #define BARCODE_OUT_PCL 0x00004000 /* by Andrea Scopece */ 00076 /* PCL_III 0x00008000 */ 00077 #define BARCODE_OUT_PCL_III 0x0000C000 00078 #define BARCODE_OUT_NOHEADERS 0x00100000 /* no header nor footer */ 00079 00080 enum { 00081 BARCODE_ANY = 0, /* choose best-fit */ 00082 BARCODE_EAN, 00083 BARCODE_UPC, /* upc == 12-digit ean */ 00084 BARCODE_ISBN, /* isbn numbers (still EAN13) */ 00085 BARCODE_39, /* code 39 */ 00086 BARCODE_128, /* code 128 (a,b,c: autoselection) */ 00087 BARCODE_128C, /* code 128 (compact form for digits) */ 00088 BARCODE_128B, /* code 128, full printable ascii */ 00089 BARCODE_I25, /* interleaved 2 of 5 (only digits) */ 00090 BARCODE_128RAW, /* Raw code 128 (by Leonid A. Broukhis) */ 00091 BARCODE_CBR, /* Codabar (by Leonid A. Broukhis) */ 00092 BARCODE_MSI, /* MSI (by Leonid A. Broukhis) */ 00093 BARCODE_PLS, /* Plessey (by Leonid A. Broukhis) */ 00094 BARCODE_93, /* code 93 (by Nathan D. Holmes) */ 00095 }; 00096 00097 #define BARCODE_DEFAULT_MARGIN 10 00098 00099 #ifdef __cplusplus 00100 extern "C" { 00101 #endif 00102 /* 00103 * Create and destroy barcode structures 00104 */ 00105 extern struct Barcode_Item *Barcode_Create( char * text ); 00106 extern int Barcode_Delete( struct Barcode_Item * bc ); 00107 00108 /* 00109 * Encode and print 00110 */ 00111 extern int Barcode_Encode( struct Barcode_Item * bc, int flags ); 00112 extern int Barcode_Print( struct Barcode_Item * bc, QString * f, int flags ); 00113 00114 /* 00115 * Choose the position 00116 */ 00117 extern int Barcode_Position( struct Barcode_Item * bc, int wid, int hei, 00118 int xoff, int yoff, double scalef ); 00119 00120 /* 00121 * Do it all in one step 00122 */ 00123 extern int Barcode_Encode_and_Print( char * text, QString * f, int wid, int hei, 00124 int xoff, int yoff, int flags ); 00125 00126 00127 /* 00128 * Return current version (integer and string) 00129 */ 00130 extern int Barcode_Version( char * versionname ); 00131 00132 #ifdef __cplusplus 00133 } 00134 #endif 00135 00136 #endif /* _BARCODE_H_ */