Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/zxing-cpp/core/src/ZXingC.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 /* | |
| 2 * Copyright 2023 siiky | |
| 3 * Copyright 2023 Axel Waggershauser | |
| 4 */ | |
| 5 // SPDX-License-Identifier: Apache-2.0 | |
| 6 | |
| 7 #ifndef _ZXING_C_H | |
| 8 #define _ZXING_C_H | |
| 9 | |
| 10 #include <stdbool.h> | |
| 11 #include <stdint.h> | |
| 12 | |
| 13 #ifdef __cplusplus | |
| 14 | |
| 15 #include "ZXingCpp.h" | |
| 16 | |
| 17 typedef ZXing::Barcode ZXing_Barcode; | |
| 18 typedef ZXing::Barcodes ZXing_Barcodes; | |
| 19 typedef ZXing::ImageView ZXing_ImageView; | |
| 20 typedef ZXing::Image ZXing_Image; | |
| 21 typedef ZXing::ReaderOptions ZXing_ReaderOptions; | |
| 22 | |
| 23 #ifdef ZXING_EXPERIMENTAL_API | |
| 24 typedef ZXing::CreatorOptions ZXing_CreatorOptions; | |
| 25 typedef ZXing::WriterOptions ZXing_WriterOptions; | |
| 26 #endif | |
| 27 | |
| 28 extern "C" | |
| 29 { | |
| 30 #else | |
| 31 | |
| 32 typedef struct ZXing_Barcode ZXing_Barcode; | |
| 33 typedef struct ZXing_Barcodes ZXing_Barcodes; | |
| 34 typedef struct ZXing_ImageView ZXing_ImageView; | |
| 35 typedef struct ZXing_Image ZXing_Image; | |
| 36 typedef struct ZXing_ReaderOptions ZXing_ReaderOptions; | |
| 37 typedef struct ZXing_CreatorOptions ZXing_CreatorOptions; | |
| 38 typedef struct ZXing_WriterOptions ZXing_WriterOptions; | |
| 39 | |
| 40 #endif | |
| 41 | |
| 42 /* | |
| 43 * ZXing/ImageView.h | |
| 44 */ | |
| 45 | |
| 46 typedef enum { | |
| 47 ZXing_ImageFormat_None = 0, | |
| 48 ZXing_ImageFormat_Lum = 0x01000000, | |
| 49 ZXing_ImageFormat_LumA = 0x02000000, | |
| 50 ZXing_ImageFormat_RGB = 0x03000102, | |
| 51 ZXing_ImageFormat_BGR = 0x03020100, | |
| 52 ZXing_ImageFormat_RGBA = 0x04000102, | |
| 53 ZXing_ImageFormat_ARGB = 0x04010203, | |
| 54 ZXing_ImageFormat_BGRA = 0x04020100, | |
| 55 ZXing_ImageFormat_ABGR = 0x04030201, | |
| 56 } ZXing_ImageFormat; | |
| 57 | |
| 58 ZXing_ImageView* ZXing_ImageView_new(const uint8_t* data, int width, int height, ZXing_ImageFormat format, int rowStride, | |
| 59 int pixStride); | |
| 60 ZXing_ImageView* ZXing_ImageView_new_checked(const uint8_t* data, int size, int width, int height, ZXing_ImageFormat format, | |
| 61 int rowStride, int pixStride); | |
| 62 void ZXing_ImageView_delete(ZXing_ImageView* iv); | |
| 63 | |
| 64 void ZXing_ImageView_crop(ZXing_ImageView* iv, int left, int top, int width, int height); | |
| 65 void ZXing_ImageView_rotate(ZXing_ImageView* iv, int degree); | |
| 66 | |
| 67 void ZXing_Image_delete(ZXing_Image* img); | |
| 68 | |
| 69 const uint8_t* ZXing_Image_data(const ZXing_Image* img); | |
| 70 int ZXing_Image_width(const ZXing_Image* img); | |
| 71 int ZXing_Image_height(const ZXing_Image* img); | |
| 72 ZXing_ImageFormat ZXing_Image_format(const ZXing_Image* img); | |
| 73 | |
| 74 /* | |
| 75 * ZXing/BarcodeFormat.h | |
| 76 */ | |
| 77 | |
| 78 typedef enum | |
| 79 { | |
| 80 ZXing_BarcodeFormat_None = 0, | |
| 81 ZXing_BarcodeFormat_Aztec = (1 << 0), | |
| 82 ZXing_BarcodeFormat_Codabar = (1 << 1), | |
| 83 ZXing_BarcodeFormat_Code39 = (1 << 2), | |
| 84 ZXing_BarcodeFormat_Code93 = (1 << 3), | |
| 85 ZXing_BarcodeFormat_Code128 = (1 << 4), | |
| 86 ZXing_BarcodeFormat_DataBar = (1 << 5), | |
| 87 ZXing_BarcodeFormat_DataBarExpanded = (1 << 6), | |
| 88 ZXing_BarcodeFormat_DataMatrix = (1 << 7), | |
| 89 ZXing_BarcodeFormat_EAN8 = (1 << 8), | |
| 90 ZXing_BarcodeFormat_EAN13 = (1 << 9), | |
| 91 ZXing_BarcodeFormat_ITF = (1 << 10), | |
| 92 ZXing_BarcodeFormat_MaxiCode = (1 << 11), | |
| 93 ZXing_BarcodeFormat_PDF417 = (1 << 12), | |
| 94 ZXing_BarcodeFormat_QRCode = (1 << 13), | |
| 95 ZXing_BarcodeFormat_UPCA = (1 << 14), | |
| 96 ZXing_BarcodeFormat_UPCE = (1 << 15), | |
| 97 ZXing_BarcodeFormat_MicroQRCode = (1 << 16), | |
| 98 ZXing_BarcodeFormat_RMQRCode = (1 << 17), | |
| 99 ZXing_BarcodeFormat_DXFilmEdge = (1 << 18), | |
| 100 ZXing_BarcodeFormat_DataBarLimited = (1 << 19), | |
| 101 | |
| 102 ZXing_BarcodeFormat_LinearCodes = ZXing_BarcodeFormat_Codabar | ZXing_BarcodeFormat_Code39 | ZXing_BarcodeFormat_Code93 | |
| 103 | ZXing_BarcodeFormat_Code128 | ZXing_BarcodeFormat_EAN8 | ZXing_BarcodeFormat_EAN13 | |
| 104 | ZXing_BarcodeFormat_ITF | ZXing_BarcodeFormat_DataBar | ZXing_BarcodeFormat_DataBarExpanded | |
| 105 | ZXing_BarcodeFormat_DataBarLimited | ZXing_BarcodeFormat_DXFilmEdge | ZXing_BarcodeFormat_UPCA | |
| 106 | ZXing_BarcodeFormat_UPCE, | |
| 107 ZXing_BarcodeFormat_MatrixCodes = ZXing_BarcodeFormat_Aztec | ZXing_BarcodeFormat_DataMatrix | ZXing_BarcodeFormat_MaxiCode | |
| 108 | ZXing_BarcodeFormat_PDF417 | ZXing_BarcodeFormat_QRCode | ZXing_BarcodeFormat_MicroQRCode | |
| 109 | ZXing_BarcodeFormat_RMQRCode, | |
| 110 ZXing_BarcodeFormat_Any = ZXing_BarcodeFormat_LinearCodes | ZXing_BarcodeFormat_MatrixCodes, | |
| 111 | |
| 112 ZXing_BarcodeFormat_Invalid = 0xFFFFFFFFu /* return value when BarcodeFormatsFromString() throws */ | |
| 113 } ZXing_BarcodeFormat; | |
| 114 | |
| 115 typedef ZXing_BarcodeFormat ZXing_BarcodeFormats; | |
| 116 | |
| 117 ZXing_BarcodeFormats ZXing_BarcodeFormatsFromString(const char* str); | |
| 118 ZXing_BarcodeFormat ZXing_BarcodeFormatFromString(const char* str); | |
| 119 char* ZXing_BarcodeFormatToString(ZXing_BarcodeFormat format); | |
| 120 | |
| 121 /* | |
| 122 * ZXing/ZXingCpp.h | |
| 123 */ | |
| 124 | |
| 125 #ifdef ZXING_EXPERIMENTAL_API | |
| 126 | |
| 127 typedef enum { | |
| 128 ZXing_Operation_Create, | |
| 129 ZXing_Operation_Read, | |
| 130 ZXing_Operation_CreateAndRead, | |
| 131 ZXing_Operation_CreateOrRead, | |
| 132 } ZXing_Operation; | |
| 133 | |
| 134 ZXing_BarcodeFormats ZXing_SupportedBarcodeFormats(ZXing_Operation op); | |
| 135 | |
| 136 #endif | |
| 137 | |
| 138 /* | |
| 139 * ZXing/Barcode.h | |
| 140 */ | |
| 141 | |
| 142 typedef enum | |
| 143 { | |
| 144 ZXing_ContentType_Text, | |
| 145 ZXing_ContentType_Binary, | |
| 146 ZXing_ContentType_Mixed, | |
| 147 ZXing_ContentType_GS1, | |
| 148 ZXing_ContentType_ISO15434, | |
| 149 ZXing_ContentType_UnknownECI | |
| 150 } ZXing_ContentType; | |
| 151 | |
| 152 typedef enum | |
| 153 { | |
| 154 ZXing_ErrorType_None, | |
| 155 ZXing_ErrorType_Format, | |
| 156 ZXing_ErrorType_Checksum, | |
| 157 ZXing_ErrorType_Unsupported | |
| 158 } ZXing_ErrorType; | |
| 159 | |
| 160 char* ZXing_ContentTypeToString(ZXing_ContentType type); | |
| 161 | |
| 162 typedef struct ZXing_PointI | |
| 163 { | |
| 164 int x, y; | |
| 165 } ZXing_PointI; | |
| 166 | |
| 167 typedef struct ZXing_Position | |
| 168 { | |
| 169 ZXing_PointI topLeft, topRight, bottomRight, bottomLeft; | |
| 170 } ZXing_Position; | |
| 171 | |
| 172 char* ZXing_PositionToString(ZXing_Position position); | |
| 173 | |
| 174 bool ZXing_Barcode_isValid(const ZXing_Barcode* barcode); | |
| 175 ZXing_ErrorType ZXing_Barcode_errorType(const ZXing_Barcode* barcode); | |
| 176 char* ZXing_Barcode_errorMsg(const ZXing_Barcode* barcode); | |
| 177 ZXing_BarcodeFormat ZXing_Barcode_format(const ZXing_Barcode* barcode); | |
| 178 ZXing_ContentType ZXing_Barcode_contentType(const ZXing_Barcode* barcode); | |
| 179 uint8_t* ZXing_Barcode_bytes(const ZXing_Barcode* barcode, int* len); | |
| 180 uint8_t* ZXing_Barcode_bytesECI(const ZXing_Barcode* barcode, int* len); | |
| 181 char* ZXing_Barcode_text(const ZXing_Barcode* barcode); | |
| 182 char* ZXing_Barcode_ecLevel(const ZXing_Barcode* barcode); | |
| 183 char* ZXing_Barcode_symbologyIdentifier(const ZXing_Barcode* barcode); | |
| 184 ZXing_Position ZXing_Barcode_position(const ZXing_Barcode* barcode); | |
| 185 int ZXing_Barcode_orientation(const ZXing_Barcode* barcode); | |
| 186 bool ZXing_Barcode_hasECI(const ZXing_Barcode* barcode); | |
| 187 bool ZXing_Barcode_isInverted(const ZXing_Barcode* barcode); | |
| 188 bool ZXing_Barcode_isMirrored(const ZXing_Barcode* barcode); | |
| 189 int ZXing_Barcode_lineCount(const ZXing_Barcode* barcode); | |
| 190 | |
| 191 void ZXing_Barcode_delete(ZXing_Barcode* barcode); | |
| 192 void ZXing_Barcodes_delete(ZXing_Barcodes* barcodes); | |
| 193 | |
| 194 int ZXing_Barcodes_size(const ZXing_Barcodes* barcodes); | |
| 195 const ZXing_Barcode* ZXing_Barcodes_at(const ZXing_Barcodes* barcodes, int i); | |
| 196 ZXing_Barcode* ZXing_Barcodes_move(ZXing_Barcodes* barcodes, int i); | |
| 197 | |
| 198 /* | |
| 199 * ZXing/ReaderOptions.h | |
| 200 */ | |
| 201 | |
| 202 typedef enum | |
| 203 { | |
| 204 ZXing_Binarizer_LocalAverage, | |
| 205 ZXing_Binarizer_GlobalHistogram, | |
| 206 ZXing_Binarizer_FixedThreshold, | |
| 207 ZXing_Binarizer_BoolCast, | |
| 208 } ZXing_Binarizer; | |
| 209 | |
| 210 typedef enum | |
| 211 { | |
| 212 ZXing_EanAddOnSymbol_Ignore, | |
| 213 ZXing_EanAddOnSymbol_Read, | |
| 214 ZXing_EanAddOnSymbol_Require, | |
| 215 } ZXing_EanAddOnSymbol; | |
| 216 | |
| 217 typedef enum | |
| 218 { | |
| 219 ZXing_TextMode_Plain, | |
| 220 ZXing_TextMode_ECI, | |
| 221 ZXing_TextMode_HRI, | |
| 222 ZXing_TextMode_Hex, | |
| 223 ZXing_TextMode_Escaped, | |
| 224 } ZXing_TextMode; | |
| 225 | |
| 226 ZXing_ReaderOptions* ZXing_ReaderOptions_new(); | |
| 227 void ZXing_ReaderOptions_delete(ZXing_ReaderOptions* opts); | |
| 228 | |
| 229 void ZXing_ReaderOptions_setTryHarder(ZXing_ReaderOptions* opts, bool tryHarder); | |
| 230 void ZXing_ReaderOptions_setTryRotate(ZXing_ReaderOptions* opts, bool tryRotate); | |
| 231 void ZXing_ReaderOptions_setTryInvert(ZXing_ReaderOptions* opts, bool tryInvert); | |
| 232 void ZXing_ReaderOptions_setTryDownscale(ZXing_ReaderOptions* opts, bool tryDownscale); | |
| 233 void ZXing_ReaderOptions_setIsPure(ZXing_ReaderOptions* opts, bool isPure); | |
| 234 void ZXing_ReaderOptions_setReturnErrors(ZXing_ReaderOptions* opts, bool returnErrors); | |
| 235 void ZXing_ReaderOptions_setFormats(ZXing_ReaderOptions* opts, ZXing_BarcodeFormats formats); | |
| 236 void ZXing_ReaderOptions_setBinarizer(ZXing_ReaderOptions* opts, ZXing_Binarizer binarizer); | |
| 237 void ZXing_ReaderOptions_setEanAddOnSymbol(ZXing_ReaderOptions* opts, ZXing_EanAddOnSymbol eanAddOnSymbol); | |
| 238 void ZXing_ReaderOptions_setTextMode(ZXing_ReaderOptions* opts, ZXing_TextMode textMode); | |
| 239 void ZXing_ReaderOptions_setMinLineCount(ZXing_ReaderOptions* opts, int n); | |
| 240 void ZXing_ReaderOptions_setMaxNumberOfSymbols(ZXing_ReaderOptions* opts, int n); | |
| 241 | |
| 242 bool ZXing_ReaderOptions_getTryHarder(const ZXing_ReaderOptions* opts); | |
| 243 bool ZXing_ReaderOptions_getTryRotate(const ZXing_ReaderOptions* opts); | |
| 244 bool ZXing_ReaderOptions_getTryInvert(const ZXing_ReaderOptions* opts); | |
| 245 bool ZXing_ReaderOptions_getTryDownscale(const ZXing_ReaderOptions* opts); | |
| 246 bool ZXing_ReaderOptions_getIsPure(const ZXing_ReaderOptions* opts); | |
| 247 bool ZXing_ReaderOptions_getReturnErrors(const ZXing_ReaderOptions* opts); | |
| 248 ZXing_BarcodeFormats ZXing_ReaderOptions_getFormats(const ZXing_ReaderOptions* opts); | |
| 249 ZXing_Binarizer ZXing_ReaderOptions_getBinarizer(const ZXing_ReaderOptions* opts); | |
| 250 ZXing_EanAddOnSymbol ZXing_ReaderOptions_getEanAddOnSymbol(const ZXing_ReaderOptions* opts); | |
| 251 ZXing_TextMode ZXing_ReaderOptions_getTextMode(const ZXing_ReaderOptions* opts); | |
| 252 int ZXing_ReaderOptions_getMinLineCount(const ZXing_ReaderOptions* opts); | |
| 253 int ZXing_ReaderOptions_getMaxNumberOfSymbols(const ZXing_ReaderOptions* opts); | |
| 254 | |
| 255 /* | |
| 256 * ZXing/ReadBarcode.h | |
| 257 */ | |
| 258 | |
| 259 /** Note: opts is optional, i.e. it can be NULL, which will imply default settings. */ | |
| 260 ZXing_Barcodes* ZXing_ReadBarcodes(const ZXing_ImageView* iv, const ZXing_ReaderOptions* opts); | |
| 261 | |
| 262 #ifdef ZXING_EXPERIMENTAL_API | |
| 263 | |
| 264 /* | |
| 265 * ZXing/WriteBarcode.h | |
| 266 */ | |
| 267 | |
| 268 ZXing_CreatorOptions* ZXing_CreatorOptions_new(ZXing_BarcodeFormat format); | |
| 269 void ZXing_CreatorOptions_delete(ZXing_CreatorOptions* opts); | |
| 270 | |
| 271 void ZXing_CreatorOptions_setFormat(ZXing_CreatorOptions* opts, ZXing_BarcodeFormat format); | |
| 272 ZXing_BarcodeFormat ZXing_CreatorOptions_getFormat(const ZXing_CreatorOptions* opts); | |
| 273 | |
| 274 void ZXing_CreatorOptions_setReaderInit(ZXing_CreatorOptions* opts, bool readerInit); | |
| 275 bool ZXing_CreatorOptions_getReaderInit(const ZXing_CreatorOptions* opts); | |
| 276 | |
| 277 void ZXing_CreatorOptions_setForceSquareDataMatrix(ZXing_CreatorOptions* opts, bool forceSquareDataMatrix); | |
| 278 bool ZXing_CreatorOptions_getForceSquareDataMatrix(const ZXing_CreatorOptions* opts); | |
| 279 | |
| 280 void ZXing_CreatorOptions_setEcLevel(ZXing_CreatorOptions* opts, const char* ecLevel); | |
| 281 char* ZXing_CreatorOptions_getEcLevel(const ZXing_CreatorOptions* opts); | |
| 282 | |
| 283 | |
| 284 ZXing_WriterOptions* ZXing_WriterOptions_new(); | |
| 285 void ZXing_WriterOptions_delete(ZXing_WriterOptions* opts); | |
| 286 | |
| 287 void ZXing_WriterOptions_setScale(ZXing_WriterOptions* opts, int scale); | |
| 288 int ZXing_WriterOptions_getScale(const ZXing_WriterOptions* opts); | |
| 289 | |
| 290 void ZXing_WriterOptions_setSizeHint(ZXing_WriterOptions* opts, int sizeHint); | |
| 291 int ZXing_WriterOptions_getSizeHint(const ZXing_WriterOptions* opts); | |
| 292 | |
| 293 void ZXing_WriterOptions_setRotate(ZXing_WriterOptions* opts, int rotate); | |
| 294 int ZXing_WriterOptions_getRotate(const ZXing_WriterOptions* opts); | |
| 295 | |
| 296 void ZXing_WriterOptions_setWithHRT(ZXing_WriterOptions* opts, bool withHRT); | |
| 297 bool ZXing_WriterOptions_getWithHRT(const ZXing_WriterOptions* opts); | |
| 298 | |
| 299 void ZXing_WriterOptions_setWithQuietZones(ZXing_WriterOptions* opts, bool withQuietZones); | |
| 300 bool ZXing_WriterOptions_getWithQuietZones(const ZXing_WriterOptions* opts); | |
| 301 | |
| 302 | |
| 303 ZXing_Barcode* ZXing_CreateBarcodeFromText(const char* data, int size, const ZXing_CreatorOptions* opts); | |
| 304 ZXing_Barcode* ZXing_CreateBarcodeFromBytes(const void* data, int size, const ZXing_CreatorOptions* opts); | |
| 305 | |
| 306 /** Note: opts is optional, i.e. it can be NULL, which will imply default settings. */ | |
| 307 char* ZXing_WriteBarcodeToSVG(const ZXing_Barcode* barcode, const ZXing_WriterOptions* opts); | |
| 308 ZXing_Image* ZXing_WriteBarcodeToImage(const ZXing_Barcode* barcode, const ZXing_WriterOptions* opts); | |
| 309 | |
| 310 #endif /* ZXING_EXPERIMENTAL_API */ | |
| 311 | |
| 312 /* ZXing_LastErrorMsg() returns NULL in case there is no last error and a copy of the string otherwise. */ | |
| 313 char* ZXing_LastErrorMsg(); | |
| 314 | |
| 315 const char* ZXing_Version(); | |
| 316 | |
| 317 void ZXing_free(void* ptr); | |
| 318 | |
| 319 #ifdef __cplusplus | |
| 320 } | |
| 321 #endif | |
| 322 | |
| 323 #endif /* _ZXING_C_H */ |
