Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/zint/backend/zint.h @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 /* zint.h - definitions for libzint */ | |
| 2 /* | |
| 3 libzint - the open source barcode library | |
| 4 Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com> | |
| 5 | |
| 6 Redistribution and use in source and binary forms, with or without | |
| 7 modification, are permitted provided that the following conditions | |
| 8 are met: | |
| 9 | |
| 10 1. Redistributions of source code must retain the above copyright | |
| 11 notice, this list of conditions and the following disclaimer. | |
| 12 2. Redistributions in binary form must reproduce the above copyright | |
| 13 notice, this list of conditions and the following disclaimer in the | |
| 14 documentation and/or other materials provided with the distribution. | |
| 15 3. Neither the name of the project nor the names of its contributors | |
| 16 may be used to endorse or promote products derived from this software | |
| 17 without specific prior written permission. | |
| 18 | |
| 19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | |
| 20 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE | |
| 23 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 SUCH DAMAGE. | |
| 30 */ | |
| 31 /* SPDX-License-Identifier: BSD-3-Clause */ | |
| 32 | |
| 33 /* | |
| 34 * Version: 2.13.0.9 (dev) (see "zintconfig.h") | |
| 35 * | |
| 36 * For documentation, see "../docs/manual.txt" or "../docs/manual.html" or online at | |
| 37 * https://zint.org.uk/manual/ | |
| 38 */ | |
| 39 | |
| 40 #ifndef ZINT_H | |
| 41 #define ZINT_H | |
| 42 | |
| 43 #ifdef __cplusplus | |
| 44 extern "C" { | |
| 45 #endif /* __cplusplus */ | |
| 46 | |
| 47 /* Vector elements - see vector header `zint_vector` below */ | |
| 48 struct zint_vector_rect { | |
| 49 float x, y; /* Top left */ | |
| 50 float height, width; | |
| 51 int colour; /* -1 for foreground, 1-8 for Cyan, Blue, Magenta, Red, Yellow, Green, Black, White */ | |
| 52 struct zint_vector_rect *next; /* Pointer to next rectangle */ | |
| 53 }; | |
| 54 | |
| 55 struct zint_vector_hexagon { | |
| 56 float x, y; /* Centre */ | |
| 57 float diameter; /* Short (minimal) diameter (i.e. diameter of inscribed circle) */ | |
| 58 int rotation; /* 0, 90, 180, 270 degrees, where 0 has apex at top, i.e. short diameter is horizontal */ | |
| 59 struct zint_vector_hexagon *next; /* Pointer to next hexagon */ | |
| 60 }; | |
| 61 | |
| 62 struct zint_vector_string { | |
| 63 float x, y; /* x is relative to halign (i.e. centre, left, right), y is relative to baseline */ | |
| 64 float fsize; /* Font size */ | |
| 65 float width; /* Rendered width estimate */ | |
| 66 int length; /* Number of characters (bytes) */ | |
| 67 int rotation; /* 0, 90, 180, 270 degrees */ | |
| 68 int halign; /* Horizontal alignment: 0 for centre, 1 for left, 2 for right (end) */ | |
| 69 unsigned char *text; /* UTF-8, NUL-terminated */ | |
| 70 struct zint_vector_string *next; /* Pointer to next string */ | |
| 71 }; | |
| 72 | |
| 73 struct zint_vector_circle { | |
| 74 float x, y; /* Centre */ | |
| 75 float diameter; /* Circle diameter. Does not include width (if any) */ | |
| 76 float width; /* Width of circle perimeter (circumference). 0 for fill (disc) */ | |
| 77 int colour; /* Zero for draw with foreground colour (else draw with background colour (legacy)) */ | |
| 78 struct zint_vector_circle *next; /* Pointer to next circle */ | |
| 79 }; | |
| 80 | |
| 81 /* Vector header */ | |
| 82 struct zint_vector { | |
| 83 float width, height; /* Width, height of barcode image (including text, whitespace) */ | |
| 84 struct zint_vector_rect *rectangles; /* Pointer to first rectangle */ | |
| 85 struct zint_vector_hexagon *hexagons; /* Pointer to first hexagon */ | |
| 86 struct zint_vector_string *strings; /* Pointer to first string */ | |
| 87 struct zint_vector_circle *circles; /* Pointer to first circle */ | |
| 88 }; | |
| 89 | |
| 90 /* Structured Append info (see `symbol->structapp` below) - ignored unless `zint_structapp.count` is non-zero */ | |
| 91 struct zint_structapp { | |
| 92 int index; /* Position in Structured Append sequence, 1-based. Must be <= `count` */ | |
| 93 int count; /* Number of symbols in Structured Append sequence. Set >= 2 to add SA Info */ | |
| 94 char id[32]; /* Optional ID to distinguish sequence, ASCII, NUL-terminated unless max 32 long */ | |
| 95 }; | |
| 96 | |
| 97 /* Main symbol structure */ | |
| 98 struct zint_symbol { | |
| 99 int symbology; /* Symbol to use (see BARCODE_XXX below) */ | |
| 100 float height; /* Barcode height in X-dimensions (ignored for fixed-width barcodes) */ | |
| 101 float scale; /* Scale factor when printing barcode, i.e. adjusts X-dimension. Default 1 */ | |
| 102 int whitespace_width; /* Width in X-dimensions of whitespace to left & right of barcode */ | |
| 103 int whitespace_height; /* Height in X-dimensions of whitespace above & below the barcode */ | |
| 104 int border_width; /* Size of border in X-dimensions */ | |
| 105 int output_options; /* Various output parameters (bind, box etc, see below) */ | |
| 106 char fgcolour[16]; /* Foreground as hexadecimal RGB/RGBA or decimal "C,M,Y,K" string, NUL-terminated */ | |
| 107 char bgcolour[16]; /* Background as hexadecimal RGB/RGBA or decimal "C,M,Y,K" string, NUL-terminated */ | |
| 108 char *fgcolor; /* Pointer to fgcolour (alternate spelling) */ | |
| 109 char *bgcolor; /* Pointer to bgcolour (alternate spelling) */ | |
| 110 char outfile[256]; /* Name of file to output to, NUL-terminated. Default "out.png" ("out.gif" if no PNG) */ | |
| 111 char primary[128]; /* Primary message data (MaxiCode, Composite), NUL-terminated */ | |
| 112 int option_1; /* Symbol-specific options (see "../docs/manual.txt") */ | |
| 113 int option_2; /* Symbol-specific options */ | |
| 114 int option_3; /* Symbol-specific options */ | |
| 115 int show_hrt; /* Show (1) or hide (0) Human Readable Text (HRT). Default 1 */ | |
| 116 int input_mode; /* Encoding of input data (see DATA_MODE etc below). Default DATA_MODE */ | |
| 117 int eci; /* Extended Channel Interpretation. Default 0 (none) */ | |
| 118 float dpmm; /* Resolution of output in dots per mm (BMP/EMF/PCX/PNG/TIF only). Default 0 (none) */ | |
| 119 float dot_size; /* Size of dots used in BARCODE_DOTTY_MODE. Default 0.8 */ | |
| 120 float text_gap; /* Gap between barcode and text (HRT) in X-dimensions. Default 1 */ | |
| 121 float guard_descent; /* Height in X-dimensions that EAN/UPC guard bars descend. Default 5 */ | |
| 122 struct zint_structapp structapp; /* Structured Append info. Default structapp.count 0 (none) */ | |
| 123 int warn_level; /* Affects error/warning value returned by Zint API (see WARN_XXX below) */ | |
| 124 int debug; /* Debugging flags */ | |
| 125 unsigned char text[256]; /* Human Readable Text (HRT) (if any), UTF-8, NUL-terminated (output only) */ | |
| 126 int rows; /* Number of rows used by the symbol (output only) */ | |
| 127 int width; /* Width of the generated symbol (output only) */ | |
| 128 unsigned char encoded_data[200][144]; /* Encoded data (output only). Allows for rows of 1152 modules */ | |
| 129 float row_height[200]; /* Heights of rows (output only). Allows for 200 row DotCode */ | |
| 130 char errtxt[100]; /* Error message if an error or warning occurs, NUL-terminated (output only) */ | |
| 131 unsigned char *bitmap; /* Stored bitmap image (raster output only) */ | |
| 132 int bitmap_width; /* Width of bitmap image (raster output only) */ | |
| 133 int bitmap_height; /* Height of bitmap image (raster output only) */ | |
| 134 unsigned char *alphamap; /* Array of alpha values used (raster output only) */ | |
| 135 struct zint_vector *vector; /* Pointer to vector header (vector output only) */ | |
| 136 unsigned char *memfile; /* Pointer to in-memory file buffer if BARCODE_MEMORY_FILE (output only) */ | |
| 137 int memfile_size; /* Length of in-memory file buffer (output only) */ | |
| 138 }; | |
| 139 | |
| 140 /* Segment for use with `ZBarcode_Encode_Segs()` below */ | |
| 141 struct zint_seg { | |
| 142 unsigned char *source; /* Data to encode */ | |
| 143 int length; /* Length of `source`. If 0, `source` must be NUL-terminated */ | |
| 144 int eci; /* Extended Channel Interpretation */ | |
| 145 }; | |
| 146 | |
| 147 /* Symbologies (`symbol->symbology`) */ | |
| 148 /* Tbarcode 7 codes */ | |
| 149 #define BARCODE_CODE11 1 /* Code 11 */ | |
| 150 #define BARCODE_C25STANDARD 2 /* 2 of 5 Standard (Matrix) */ | |
| 151 #define BARCODE_C25MATRIX 2 /* Legacy */ | |
| 152 #define BARCODE_C25INTER 3 /* 2 of 5 Interleaved */ | |
| 153 #define BARCODE_C25IATA 4 /* 2 of 5 IATA */ | |
| 154 #define BARCODE_C25LOGIC 6 /* 2 of 5 Data Logic */ | |
| 155 #define BARCODE_C25IND 7 /* 2 of 5 Industrial */ | |
| 156 #define BARCODE_CODE39 8 /* Code 39 */ | |
| 157 #define BARCODE_EXCODE39 9 /* Extended Code 39 */ | |
| 158 #define BARCODE_EANX 13 /* EAN (European Article Number) */ | |
| 159 #define BARCODE_EANX_CHK 14 /* EAN + Check Digit */ | |
| 160 #define BARCODE_GS1_128 16 /* GS1-128 */ | |
| 161 #define BARCODE_EAN128 16 /* Legacy */ | |
| 162 #define BARCODE_CODABAR 18 /* Codabar */ | |
| 163 #define BARCODE_CODE128 20 /* Code 128 */ | |
| 164 #define BARCODE_DPLEIT 21 /* Deutsche Post Leitcode */ | |
| 165 #define BARCODE_DPIDENT 22 /* Deutsche Post Identcode */ | |
| 166 #define BARCODE_CODE16K 23 /* Code 16k */ | |
| 167 #define BARCODE_CODE49 24 /* Code 49 */ | |
| 168 #define BARCODE_CODE93 25 /* Code 93 */ | |
| 169 #define BARCODE_FLAT 28 /* Flattermarken */ | |
| 170 #define BARCODE_DBAR_OMN 29 /* GS1 DataBar Omnidirectional */ | |
| 171 #define BARCODE_RSS14 29 /* Legacy */ | |
| 172 #define BARCODE_DBAR_LTD 30 /* GS1 DataBar Limited */ | |
| 173 #define BARCODE_RSS_LTD 30 /* Legacy */ | |
| 174 #define BARCODE_DBAR_EXP 31 /* GS1 DataBar Expanded */ | |
| 175 #define BARCODE_RSS_EXP 31 /* Legacy */ | |
| 176 #define BARCODE_TELEPEN 32 /* Telepen Alpha */ | |
| 177 #define BARCODE_UPCA 34 /* UPC-A */ | |
| 178 #define BARCODE_UPCA_CHK 35 /* UPC-A + Check Digit */ | |
| 179 #define BARCODE_UPCE 37 /* UPC-E */ | |
| 180 #define BARCODE_UPCE_CHK 38 /* UPC-E + Check Digit */ | |
| 181 #define BARCODE_POSTNET 40 /* USPS (U.S. Postal Service) POSTNET */ | |
| 182 #define BARCODE_MSI_PLESSEY 47 /* MSI Plessey */ | |
| 183 #define BARCODE_FIM 49 /* Facing Identification Mark */ | |
| 184 #define BARCODE_LOGMARS 50 /* LOGMARS */ | |
| 185 #define BARCODE_PHARMA 51 /* Pharmacode One-Track */ | |
| 186 #define BARCODE_PZN 52 /* Pharmazentralnummer */ | |
| 187 #define BARCODE_PHARMA_TWO 53 /* Pharmacode Two-Track */ | |
| 188 #define BARCODE_CEPNET 54 /* Brazilian CEPNet Postal Code */ | |
| 189 #define BARCODE_PDF417 55 /* PDF417 */ | |
| 190 #define BARCODE_PDF417COMP 56 /* Compact PDF417 (Truncated PDF417) */ | |
| 191 #define BARCODE_PDF417TRUNC 56 /* Legacy */ | |
| 192 #define BARCODE_MAXICODE 57 /* MaxiCode */ | |
| 193 #define BARCODE_QRCODE 58 /* QR Code */ | |
| 194 #define BARCODE_CODE128AB 60 /* Code 128 (Suppress Code Set C) */ | |
| 195 #define BARCODE_CODE128B 60 /* Legacy */ | |
| 196 #define BARCODE_AUSPOST 63 /* Australia Post Standard Customer */ | |
| 197 #define BARCODE_AUSREPLY 66 /* Australia Post Reply Paid */ | |
| 198 #define BARCODE_AUSROUTE 67 /* Australia Post Routing */ | |
| 199 #define BARCODE_AUSREDIRECT 68 /* Australia Post Redirection */ | |
| 200 #define BARCODE_ISBNX 69 /* ISBN */ | |
| 201 #define BARCODE_RM4SCC 70 /* Royal Mail 4-State Customer Code */ | |
| 202 #define BARCODE_DATAMATRIX 71 /* Data Matrix (ECC200) */ | |
| 203 #define BARCODE_EAN14 72 /* EAN-14 */ | |
| 204 #define BARCODE_VIN 73 /* Vehicle Identification Number */ | |
| 205 #define BARCODE_CODABLOCKF 74 /* Codablock-F */ | |
| 206 #define BARCODE_NVE18 75 /* NVE-18 (SSCC-18) */ | |
| 207 #define BARCODE_JAPANPOST 76 /* Japanese Postal Code */ | |
| 208 #define BARCODE_KOREAPOST 77 /* Korea Post */ | |
| 209 #define BARCODE_DBAR_STK 79 /* GS1 DataBar Stacked */ | |
| 210 #define BARCODE_RSS14STACK 79 /* Legacy */ | |
| 211 #define BARCODE_DBAR_OMNSTK 80 /* GS1 DataBar Stacked Omnidirectional */ | |
| 212 #define BARCODE_RSS14STACK_OMNI 80 /* Legacy */ | |
| 213 #define BARCODE_DBAR_EXPSTK 81 /* GS1 DataBar Expanded Stacked */ | |
| 214 #define BARCODE_RSS_EXPSTACK 81 /* Legacy */ | |
| 215 #define BARCODE_PLANET 82 /* USPS PLANET */ | |
| 216 #define BARCODE_MICROPDF417 84 /* MicroPDF417 */ | |
| 217 #define BARCODE_USPS_IMAIL 85 /* USPS Intelligent Mail (OneCode) */ | |
| 218 #define BARCODE_ONECODE 85 /* Legacy */ | |
| 219 #define BARCODE_PLESSEY 86 /* UK Plessey */ | |
| 220 | |
| 221 /* Tbarcode 8 codes */ | |
| 222 #define BARCODE_TELEPEN_NUM 87 /* Telepen Numeric */ | |
| 223 #define BARCODE_ITF14 89 /* ITF-14 */ | |
| 224 #define BARCODE_KIX 90 /* Dutch Post KIX Code */ | |
| 225 #define BARCODE_AZTEC 92 /* Aztec Code */ | |
| 226 #define BARCODE_DAFT 93 /* DAFT Code */ | |
| 227 #define BARCODE_DPD 96 /* DPD Code */ | |
| 228 #define BARCODE_MICROQR 97 /* Micro QR Code */ | |
| 229 | |
| 230 /* Tbarcode 9 codes */ | |
| 231 #define BARCODE_HIBC_128 98 /* HIBC (Health Industry Barcode) Code 128 */ | |
| 232 #define BARCODE_HIBC_39 99 /* HIBC Code 39 */ | |
| 233 #define BARCODE_HIBC_DM 102 /* HIBC Data Matrix */ | |
| 234 #define BARCODE_HIBC_QR 104 /* HIBC QR Code */ | |
| 235 #define BARCODE_HIBC_PDF 106 /* HIBC PDF417 */ | |
| 236 #define BARCODE_HIBC_MICPDF 108 /* HIBC MicroPDF417 */ | |
| 237 #define BARCODE_HIBC_BLOCKF 110 /* HIBC Codablock-F */ | |
| 238 #define BARCODE_HIBC_AZTEC 112 /* HIBC Aztec Code */ | |
| 239 | |
| 240 /* Tbarcode 10 codes */ | |
| 241 #define BARCODE_DOTCODE 115 /* DotCode */ | |
| 242 #define BARCODE_HANXIN 116 /* Han Xin (Chinese Sensible) Code */ | |
| 243 | |
| 244 /* Tbarcode 11 codes */ | |
| 245 #define BARCODE_MAILMARK_2D 119 /* Royal Mail 2D Mailmark (CMDM) (Data Matrix) */ | |
| 246 #define BARCODE_UPU_S10 120 /* Universal Postal Union S10 */ | |
| 247 #define BARCODE_MAILMARK_4S 121 /* Royal Mail 4-State Mailmark */ | |
| 248 #define BARCODE_MAILMARK 121 /* Legacy */ | |
| 249 | |
| 250 /* Zint specific */ | |
| 251 #define BARCODE_AZRUNE 128 /* Aztec Runes */ | |
| 252 #define BARCODE_CODE32 129 /* Code 32 */ | |
| 253 #define BARCODE_EANX_CC 130 /* EAN Composite */ | |
| 254 #define BARCODE_GS1_128_CC 131 /* GS1-128 Composite */ | |
| 255 #define BARCODE_EAN128_CC 131 /* Legacy */ | |
| 256 #define BARCODE_DBAR_OMN_CC 132 /* GS1 DataBar Omnidirectional Composite */ | |
| 257 #define BARCODE_RSS14_CC 132 /* Legacy */ | |
| 258 #define BARCODE_DBAR_LTD_CC 133 /* GS1 DataBar Limited Composite */ | |
| 259 #define BARCODE_RSS_LTD_CC 133 /* Legacy */ | |
| 260 #define BARCODE_DBAR_EXP_CC 134 /* GS1 DataBar Expanded Composite */ | |
| 261 #define BARCODE_RSS_EXP_CC 134 /* Legacy */ | |
| 262 #define BARCODE_UPCA_CC 135 /* UPC-A Composite */ | |
| 263 #define BARCODE_UPCE_CC 136 /* UPC-E Composite */ | |
| 264 #define BARCODE_DBAR_STK_CC 137 /* GS1 DataBar Stacked Composite */ | |
| 265 #define BARCODE_RSS14STACK_CC 137 /* Legacy */ | |
| 266 #define BARCODE_DBAR_OMNSTK_CC 138 /* GS1 DataBar Stacked Omnidirectional Composite */ | |
| 267 #define BARCODE_RSS14_OMNI_CC 138 /* Legacy */ | |
| 268 #define BARCODE_DBAR_EXPSTK_CC 139 /* GS1 DataBar Expanded Stacked Composite */ | |
| 269 #define BARCODE_RSS_EXPSTACK_CC 139 /* Legacy */ | |
| 270 #define BARCODE_CHANNEL 140 /* Channel Code */ | |
| 271 #define BARCODE_CODEONE 141 /* Code One */ | |
| 272 #define BARCODE_GRIDMATRIX 142 /* Grid Matrix */ | |
| 273 #define BARCODE_UPNQR 143 /* UPNQR (Univerzalnega Plačilnega Naloga QR) */ | |
| 274 #define BARCODE_ULTRA 144 /* Ultracode */ | |
| 275 #define BARCODE_RMQR 145 /* Rectangular Micro QR Code (rMQR) */ | |
| 276 #define BARCODE_BC412 146 /* IBM BC412 (SEMI T1-95) */ | |
| 277 #define BARCODE_DXFILMEDGE 147 /* DX Film Edge Barcode on 35mm and APS films */ | |
| 278 #define BARCODE_LAST 147 /* Max barcode number marker, not barcode */ | |
| 279 | |
| 280 /* Output options (`symbol->output_options`) */ | |
| 281 #define BARCODE_BIND_TOP 0x00001 /* Boundary bar above the symbol only (not below), does not affect stacking */ | |
| 282 /* Note: value was once used by the legacy (never-used) BARCODE_NO_ASCII */ | |
| 283 #define BARCODE_BIND 0x00002 /* Boundary bars above & below the symbol and between stacked symbols */ | |
| 284 #define BARCODE_BOX 0x00004 /* Box around symbol */ | |
| 285 #define BARCODE_STDOUT 0x00008 /* Output to stdout */ | |
| 286 #define READER_INIT 0x00010 /* Reader Initialisation (Programming) */ | |
| 287 #define SMALL_TEXT 0x00020 /* Use smaller font */ | |
| 288 #define BOLD_TEXT 0x00040 /* Use bold font */ | |
| 289 #define CMYK_COLOUR 0x00080 /* CMYK colour space (Encapsulated PostScript and TIF) */ | |
| 290 #define BARCODE_DOTTY_MODE 0x00100 /* Plot a matrix symbol using dots rather than squares */ | |
| 291 #define GS1_GS_SEPARATOR 0x00200 /* Use GS instead of FNC1 as GS1 separator (Data Matrix) */ | |
| 292 #define OUT_BUFFER_INTERMEDIATE 0x00400 /* Return ASCII values in bitmap buffer (OUT_BUFFER only) */ | |
| 293 #define BARCODE_QUIET_ZONES 0x00800 /* Add compliant quiet zones (additional to any specified whitespace) */ | |
| 294 /* Note: CODE16K, CODE49, CODABLOCKF, ITF14, EAN/UPC have default quiet zones | |
| 295 */ | |
| 296 #define BARCODE_NO_QUIET_ZONES 0x01000 /* Disable quiet zones, notably those with defaults as listed above */ | |
| 297 #define COMPLIANT_HEIGHT 0x02000 /* Warn if height not compliant, or use standard height (if any) as default */ | |
| 298 #define EANUPC_GUARD_WHITESPACE 0x04000 /* Add quiet zone indicators ("<"/">") to HRT whitespace (EAN/UPC) */ | |
| 299 #define EMBED_VECTOR_FONT 0x08000 /* Embed font in vector output - currently only for SVG output */ | |
| 300 #define BARCODE_MEMORY_FILE 0x10000 /* Write output to in-memory buffer `memfile` instead of to `outfile` */ | |
| 301 | |
| 302 /* Input data types (`symbol->input_mode`) */ | |
| 303 #define DATA_MODE 0 /* Binary */ | |
| 304 #define UNICODE_MODE 1 /* UTF-8 */ | |
| 305 #define GS1_MODE 2 /* GS1 */ | |
| 306 /* The following may be OR-ed with above */ | |
| 307 #define ESCAPE_MODE 0x0008 /* Process escape sequences */ | |
| 308 #define GS1PARENS_MODE 0x0010 /* Process parentheses as GS1 AI delimiters (instead of square brackets) */ | |
| 309 #define GS1NOCHECK_MODE 0x0020 /* Do not check validity of GS1 data (except that printable ASCII only) */ | |
| 310 #define HEIGHTPERROW_MODE 0x0040 /* Interpret `height` as per-row rather than as overall height */ | |
| 311 #define FAST_MODE 0x0080 /* Use faster if less optimal encodation or other shortcuts if available */ | |
| 312 /* Note: affects DATAMATRIX, MICROPDF417, PDF417, QRCODE & UPNQR only */ | |
| 313 #define EXTRA_ESCAPE_MODE 0x0100 /* Process special symbology-specific escape sequences as well as others */ | |
| 314 /* Note: currently Code 128 only */ | |
| 315 | |
| 316 /* Data Matrix specific options (`symbol->option_3`) */ | |
| 317 #define DM_SQUARE 100 /* Only consider square versions on automatic symbol size selection */ | |
| 318 #define DM_DMRE 101 /* Consider DMRE versions on automatic symbol size selection */ | |
| 319 #define DM_ISO_144 128 /* Use ISO instead of "de facto" format for 144x144 (i.e. don't skew ECC) */ | |
| 320 | |
| 321 /* QR, Han Xin, Grid Matrix specific options (`symbol->option_3`) */ | |
| 322 #define ZINT_FULL_MULTIBYTE 200 /* Enable Kanji/Hanzi compression for Latin-1 & binary data */ | |
| 323 | |
| 324 /* Ultracode specific option (`symbol->option_3`) */ | |
| 325 #define ULTRA_COMPRESSION 128 /* Enable Ultracode compression (experimental) */ | |
| 326 | |
| 327 /* Warning and error conditions (API return values) */ | |
| 328 #define ZINT_WARN_HRT_TRUNCATED 1 /* Human Readable Text was truncated (max 199 bytes) */ | |
| 329 #define ZINT_WARN_INVALID_OPTION 2 /* Invalid option given but overridden by Zint */ | |
| 330 #define ZINT_WARN_USES_ECI 3 /* Automatic ECI inserted by Zint */ | |
| 331 #define ZINT_WARN_NONCOMPLIANT 4 /* Symbol created not compliant with standards */ | |
| 332 #define ZINT_ERROR 5 /* Warn/error marker, not returned */ | |
| 333 #define ZINT_ERROR_TOO_LONG 5 /* Input data wrong length */ | |
| 334 #define ZINT_ERROR_INVALID_DATA 6 /* Input data incorrect */ | |
| 335 #define ZINT_ERROR_INVALID_CHECK 7 /* Input check digit incorrect */ | |
| 336 #define ZINT_ERROR_INVALID_OPTION 8 /* Incorrect option given */ | |
| 337 #define ZINT_ERROR_ENCODING_PROBLEM 9 /* Internal error (should not happen) */ | |
| 338 #define ZINT_ERROR_FILE_ACCESS 10 /* Error opening output file */ | |
| 339 #define ZINT_ERROR_MEMORY 11 /* Memory allocation (malloc) failure */ | |
| 340 #define ZINT_ERROR_FILE_WRITE 12 /* Error writing to output file */ | |
| 341 #define ZINT_ERROR_USES_ECI 13 /* Error counterpart of warning if WARN_FAIL_ALL set (see below) */ | |
| 342 #define ZINT_ERROR_NONCOMPLIANT 14 /* Error counterpart of warning if WARN_FAIL_ALL set */ | |
| 343 #define ZINT_ERROR_HRT_TRUNCATED 15 /* Error counterpart of warning if WARN_FAIL_ALL set */ | |
| 344 | |
| 345 /* Warning level (`symbol->warn_level`) */ | |
| 346 #define WARN_DEFAULT 0 /* Default behaviour */ | |
| 347 #define WARN_FAIL_ALL 2 /* Treat warning as error */ | |
| 348 | |
| 349 /* Capability flags (ZBarcode_Cap() `cap_flag`) */ | |
| 350 #define ZINT_CAP_HRT 0x0001 /* Prints Human Readable Text? */ | |
| 351 #define ZINT_CAP_STACKABLE 0x0002 /* Is stackable? */ | |
| 352 #define ZINT_CAP_EANUPC 0x0004 /* Is EAN/UPC? */ | |
| 353 #define ZINT_CAP_EXTENDABLE 0x0004 /* Legacy */ | |
| 354 #define ZINT_CAP_COMPOSITE 0x0008 /* Can have composite data? */ | |
| 355 #define ZINT_CAP_ECI 0x0010 /* Supports Extended Channel Interpretations? */ | |
| 356 #define ZINT_CAP_GS1 0x0020 /* Supports GS1 data? */ | |
| 357 #define ZINT_CAP_DOTTY 0x0040 /* Can be output as dots? */ | |
| 358 #define ZINT_CAP_QUIET_ZONES 0x0080 /* Has default quiet zones? */ | |
| 359 #define ZINT_CAP_FIXED_RATIO 0x0100 /* Has fixed width-to-height (aspect) ratio? */ | |
| 360 #define ZINT_CAP_READER_INIT 0x0200 /* Supports Reader Initialisation? */ | |
| 361 #define ZINT_CAP_FULL_MULTIBYTE 0x0400 /* Supports full-multibyte option? */ | |
| 362 #define ZINT_CAP_MASK 0x0800 /* Is mask selectable? */ | |
| 363 #define ZINT_CAP_STRUCTAPP 0x1000 /* Supports Structured Append? */ | |
| 364 #define ZINT_CAP_COMPLIANT_HEIGHT 0x2000 /* Has compliant height? */ | |
| 365 | |
| 366 /* The largest amount of data that can be encoded is 4350 4-byte UTF-8 chars in Han Xin Code */ | |
| 367 #define ZINT_MAX_DATA_LEN 17400 | |
| 368 /* Maximum number of segments allowed for (`seg_count`) */ | |
| 369 #define ZINT_MAX_SEG_COUNT 256 | |
| 370 | |
| 371 /* Debug flags (`symbol->debug`) */ | |
| 372 #define ZINT_DEBUG_PRINT 0x0001 /* Print debug info (if any) to stdout */ | |
| 373 #define ZINT_DEBUG_TEST 0x0002 /* For internal test use only */ | |
| 374 | |
| 375 #ifdef _WIN32 | |
| 376 # if defined(DLL_EXPORT) || defined(PIC) || defined(_USRDLL) | |
| 377 # define ZINT_EXTERN __declspec(dllexport) | |
| 378 # elif defined(ZINT_DLL) | |
| 379 # define ZINT_EXTERN __declspec(dllimport) | |
| 380 # else | |
| 381 # define ZINT_EXTERN extern | |
| 382 # endif | |
| 383 #elif defined(__GNUC__) && __GNUC__ >= 4 | |
| 384 # define ZINT_EXTERN extern __attribute__((__visibility__("default"))) | |
| 385 #else | |
| 386 # define ZINT_EXTERN extern | |
| 387 #endif | |
| 388 | |
| 389 /* Create and initialize a symbol structure */ | |
| 390 ZINT_EXTERN struct zint_symbol *ZBarcode_Create(void); | |
| 391 | |
| 392 /* Free any output buffers that may have been created and initialize output fields */ | |
| 393 ZINT_EXTERN void ZBarcode_Clear(struct zint_symbol *symbol); | |
| 394 | |
| 395 /* Free any output buffers that may have been created and reset all fields to defaults */ | |
| 396 ZINT_EXTERN void ZBarcode_Reset(struct zint_symbol *symbol); | |
| 397 | |
| 398 /* Free a symbol structure, including any output buffers */ | |
| 399 ZINT_EXTERN void ZBarcode_Delete(struct zint_symbol *symbol); | |
| 400 | |
| 401 | |
| 402 /* Encode a barcode. If `length` is 0, `source` must be NUL-terminated */ | |
| 403 ZINT_EXTERN int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int length); | |
| 404 | |
| 405 /* Encode a barcode with multiple ECI segments */ | |
| 406 ZINT_EXTERN int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[], | |
| 407 const int seg_count); | |
| 408 | |
| 409 /* Encode a barcode using input data from file `filename` */ | |
| 410 ZINT_EXTERN int ZBarcode_Encode_File(struct zint_symbol *symbol, const char *filename); | |
| 411 | |
| 412 /* Output a previously encoded symbol to file `symbol->outfile` */ | |
| 413 ZINT_EXTERN int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle); | |
| 414 | |
| 415 | |
| 416 /* Encode and output a symbol to file `symbol->outfile` */ | |
| 417 ZINT_EXTERN int ZBarcode_Encode_and_Print(struct zint_symbol *symbol, const unsigned char *source, int length, | |
| 418 int rotate_angle); | |
| 419 | |
| 420 /* Encode a symbol with multiple ECI segments and output to file `symbol->outfile` */ | |
| 421 ZINT_EXTERN int ZBarcode_Encode_Segs_and_Print(struct zint_symbol *symbol, const struct zint_seg segs[], | |
| 422 const int seg_count, int rotate_angle); | |
| 423 | |
| 424 /* Encode a symbol using input data from file `filename` and output to file `symbol->outfile` */ | |
| 425 ZINT_EXTERN int ZBarcode_Encode_File_and_Print(struct zint_symbol *symbol, const char *filename, | |
| 426 int rotate_angle); | |
| 427 | |
| 428 | |
| 429 /* Output a previously encoded symbol to memory as raster (`symbol->bitmap`) */ | |
| 430 ZINT_EXTERN int ZBarcode_Buffer(struct zint_symbol *symbol, int rotate_angle); | |
| 431 | |
| 432 /* Encode and output a symbol to memory as raster (`symbol->bitmap`) */ | |
| 433 ZINT_EXTERN int ZBarcode_Encode_and_Buffer(struct zint_symbol *symbol, const unsigned char *source, int length, | |
| 434 int rotate_angle); | |
| 435 | |
| 436 /* Encode a symbol with multiple ECI segments and output to memory as raster (`symbol->bitmap`) */ | |
| 437 ZINT_EXTERN int ZBarcode_Encode_Segs_and_Buffer(struct zint_symbol *symbol, const struct zint_seg segs[], | |
| 438 const int seg_count, int rotate_angle); | |
| 439 | |
| 440 /* Encode a symbol using input data from file `filename` and output to memory as raster (`symbol->bitmap`) */ | |
| 441 ZINT_EXTERN int ZBarcode_Encode_File_and_Buffer(struct zint_symbol *symbol, const char *filename, | |
| 442 int rotate_angle); | |
| 443 | |
| 444 | |
| 445 /* Output a previously encoded symbol to memory as vector (`symbol->vector`) */ | |
| 446 ZINT_EXTERN int ZBarcode_Buffer_Vector(struct zint_symbol *symbol, int rotate_angle); | |
| 447 | |
| 448 /* Encode and output a symbol to memory as vector (`symbol->vector`) */ | |
| 449 ZINT_EXTERN int ZBarcode_Encode_and_Buffer_Vector(struct zint_symbol *symbol, const unsigned char *source, | |
| 450 int length, int rotate_angle); | |
| 451 | |
| 452 /* Encode a symbol with multiple ECI segments and output to memory as vector (`symbol->vector`) */ | |
| 453 ZINT_EXTERN int ZBarcode_Encode_Segs_and_Buffer_Vector(struct zint_symbol *symbol, const struct zint_seg segs[], | |
| 454 const int seg_count, int rotate_angle); | |
| 455 | |
| 456 /* Encode a symbol using input data from file `filename` and output to memory as vector (`symbol->vector`) */ | |
| 457 ZINT_EXTERN int ZBarcode_Encode_File_and_Buffer_Vector(struct zint_symbol *symbol, const char *filename, | |
| 458 int rotate_angle); | |
| 459 | |
| 460 | |
| 461 /* Is `symbol_id` a recognized symbology? */ | |
| 462 ZINT_EXTERN int ZBarcode_ValidID(int symbol_id); | |
| 463 | |
| 464 /* Copy BARCODE_XXX name of `symbol_id` into `name` buffer, NUL-terminated. | |
| 465 Returns 0 if valid, 1 if not valid */ | |
| 466 ZINT_EXTERN int ZBarcode_BarcodeName(int symbol_id, char name[32]); | |
| 467 | |
| 468 /* Return the capability flags for symbology `symbol_id` that match `cap_flag` */ | |
| 469 ZINT_EXTERN unsigned int ZBarcode_Cap(int symbol_id, unsigned int cap_flag); | |
| 470 | |
| 471 | |
| 472 /* Return default X-dimension in mm for symbology `symbol_id`. Returns 0 on error (invalid `symbol_id`) */ | |
| 473 ZINT_EXTERN float ZBarcode_Default_Xdim(int symbol_id); | |
| 474 | |
| 475 /* Return the scale to use for `symbol_id` for non-zero X-dimension `x_dim_mm` at `dpmm` dots per mm for | |
| 476 `filetype`. If `dpmm` zero defaults to 12. If `filetype` NULL/empty, defaults to "GIF". Returns 0 on error */ | |
| 477 ZINT_EXTERN float ZBarcode_Scale_From_XdimDp(int symbol_id, float x_dim_mm, float dpmm, const char *filetype); | |
| 478 | |
| 479 /* Reverse of `ZBarcode_Scale_From_XdimDp()` above to estimate the X-dimension or dpmm given non-zero `scale` and | |
| 480 non-zero `x_dim_mm_or_dpmm`. Return value bound to dpmm max not X-dimension max. Returns 0 on error */ | |
| 481 ZINT_EXTERN float ZBarcode_XdimDp_From_Scale(int symbol_id, float scale, float x_dim_mm_or_dpmm, | |
| 482 const char *filetype); | |
| 483 | |
| 484 | |
| 485 /* Whether Zint built without PNG support */ | |
| 486 ZINT_EXTERN int ZBarcode_NoPng(void); | |
| 487 | |
| 488 /* Return the version of Zint linked to */ | |
| 489 ZINT_EXTERN int ZBarcode_Version(void); | |
| 490 | |
| 491 #ifdef __cplusplus | |
| 492 } | |
| 493 #endif /* __cplusplus */ | |
| 494 | |
| 495 /* vim: set ts=4 sw=4 et : */ | |
| 496 #endif /* ZINT_H */ |
