react-native-nitro-zxing 0.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -0
- package/VisionCameraZxing.podspec +48 -0
- package/android/CMakeLists.txt +43 -0
- package/android/build.gradle +150 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/cpp/cpp-adapter.cpp +7 -0
- package/android/src/main/java/com/margelo/nitro/camera/zxing/VisionCameraZxingPackage.kt +21 -0
- package/cpp/BarcodeValueTypeClassifier.cpp +70 -0
- package/cpp/BarcodeValueTypeClassifier.hpp +14 -0
- package/cpp/FrameImageView.cpp +75 -0
- package/cpp/FrameImageView.hpp +34 -0
- package/cpp/HybridBarcode.cpp +59 -0
- package/cpp/HybridBarcode.hpp +26 -0
- package/cpp/HybridBarcodeScanner.cpp +121 -0
- package/cpp/HybridBarcodeScanner.hpp +26 -0
- package/cpp/HybridBarcodeScannerFactory.cpp +11 -0
- package/cpp/HybridBarcodeScannerFactory.hpp +14 -0
- package/cpp/ImageDownscaler.cpp +34 -0
- package/cpp/ImageDownscaler.hpp +21 -0
- package/cpp/ZXingDecoder.cpp +189 -0
- package/cpp/ZXingDecoder.hpp +72 -0
- package/cpp/zxing-core/LICENSE +202 -0
- package/cpp/zxing-core/README.md +156 -0
- package/cpp/zxing-core/core/CMakeLists.txt +784 -0
- package/cpp/zxing-core/core/Version.h.in +28 -0
- package/cpp/zxing-core/core/ZXingConfig.cmake.in +9 -0
- package/cpp/zxing-core/core/src/Barcode.cpp +255 -0
- package/cpp/zxing-core/core/src/Barcode.h +191 -0
- package/cpp/zxing-core/core/src/BarcodeData.h +100 -0
- package/cpp/zxing-core/core/src/BarcodeFormat.cpp +286 -0
- package/cpp/zxing-core/core/src/BarcodeFormat.h +272 -0
- package/cpp/zxing-core/core/src/BinaryBitmap.cpp +111 -0
- package/cpp/zxing-core/core/src/BinaryBitmap.h +66 -0
- package/cpp/zxing-core/core/src/BitArray.cpp +38 -0
- package/cpp/zxing-core/core/src/BitArray.h +181 -0
- package/cpp/zxing-core/core/src/BitMatrix.cpp +175 -0
- package/cpp/zxing-core/core/src/BitMatrix.h +199 -0
- package/cpp/zxing-core/core/src/BitMatrixCursor.h +253 -0
- package/cpp/zxing-core/core/src/BitMatrixIO.cpp +101 -0
- package/cpp/zxing-core/core/src/BitMatrixIO.h +21 -0
- package/cpp/zxing-core/core/src/BitSource.cpp +77 -0
- package/cpp/zxing-core/core/src/BitSource.h +72 -0
- package/cpp/zxing-core/core/src/ByteArray.h +42 -0
- package/cpp/zxing-core/core/src/CharacterSet.cpp +78 -0
- package/cpp/zxing-core/core/src/CharacterSet.h +58 -0
- package/cpp/zxing-core/core/src/ConcentricFinder.cpp +312 -0
- package/cpp/zxing-core/core/src/ConcentricFinder.h +156 -0
- package/cpp/zxing-core/core/src/Content.cpp +471 -0
- package/cpp/zxing-core/core/src/Content.h +82 -0
- package/cpp/zxing-core/core/src/ContentType.h +19 -0
- package/cpp/zxing-core/core/src/CreateBarcode.cpp +490 -0
- package/cpp/zxing-core/core/src/CreateBarcode.h +132 -0
- package/cpp/zxing-core/core/src/DecoderResult.h +92 -0
- package/cpp/zxing-core/core/src/DetectorResult.h +44 -0
- package/cpp/zxing-core/core/src/ECI.cpp +81 -0
- package/cpp/zxing-core/core/src/ECI.h +78 -0
- package/cpp/zxing-core/core/src/Error.cpp +29 -0
- package/cpp/zxing-core/core/src/Error.h +79 -0
- package/cpp/zxing-core/core/src/Flags.h +165 -0
- package/cpp/zxing-core/core/src/GTIN.cpp +253 -0
- package/cpp/zxing-core/core/src/GTIN.h +58 -0
- package/cpp/zxing-core/core/src/GlobalHistogramBinarizer.cpp +197 -0
- package/cpp/zxing-core/core/src/GlobalHistogramBinarizer.h +34 -0
- package/cpp/zxing-core/core/src/GridSampler.cpp +124 -0
- package/cpp/zxing-core/core/src/GridSampler.h +59 -0
- package/cpp/zxing-core/core/src/HRI.cpp +343 -0
- package/cpp/zxing-core/core/src/HRI.h +16 -0
- package/cpp/zxing-core/core/src/HybridBinarizer.cpp +315 -0
- package/cpp/zxing-core/core/src/HybridBinarizer.h +40 -0
- package/cpp/zxing-core/core/src/ImageView.h +168 -0
- package/cpp/zxing-core/core/src/JSON.cpp +154 -0
- package/cpp/zxing-core/core/src/JSON.h +66 -0
- package/cpp/zxing-core/core/src/LocalGrid.cpp +242 -0
- package/cpp/zxing-core/core/src/LocalGrid.h +91 -0
- package/cpp/zxing-core/core/src/LogMatrix.h +105 -0
- package/cpp/zxing-core/core/src/Matrix.h +125 -0
- package/cpp/zxing-core/core/src/MultiFormatReader.cpp +107 -0
- package/cpp/zxing-core/core/src/MultiFormatReader.h +34 -0
- package/cpp/zxing-core/core/src/MultiFormatWriter.cpp +111 -0
- package/cpp/zxing-core/core/src/MultiFormatWriter.h +62 -0
- package/cpp/zxing-core/core/src/Pattern.h +472 -0
- package/cpp/zxing-core/core/src/PerspectiveTransform.cpp +81 -0
- package/cpp/zxing-core/core/src/PerspectiveTransform.h +47 -0
- package/cpp/zxing-core/core/src/Point.h +185 -0
- package/cpp/zxing-core/core/src/Quadrilateral.h +215 -0
- package/cpp/zxing-core/core/src/Range.h +112 -0
- package/cpp/zxing-core/core/src/ReadBarcode.cpp +335 -0
- package/cpp/zxing-core/core/src/ReadBarcode.h +33 -0
- package/cpp/zxing-core/core/src/Reader.h +32 -0
- package/cpp/zxing-core/core/src/ReaderOptions.h +210 -0
- package/cpp/zxing-core/core/src/ReedSolomon.cpp +100 -0
- package/cpp/zxing-core/core/src/ReedSolomon.h +66 -0
- package/cpp/zxing-core/core/src/RegressionLine.h +161 -0
- package/cpp/zxing-core/core/src/ResultPoint.cpp +20 -0
- package/cpp/zxing-core/core/src/ResultPoint.h +35 -0
- package/cpp/zxing-core/core/src/StdGenerator.h +121 -0
- package/cpp/zxing-core/core/src/StdPrint.h +38 -0
- package/cpp/zxing-core/core/src/StdScope.h +55 -0
- package/cpp/zxing-core/core/src/StructuredAppend.h +19 -0
- package/cpp/zxing-core/core/src/SymbologyIdentifier.h +29 -0
- package/cpp/zxing-core/core/src/TextDecoder.cpp +59 -0
- package/cpp/zxing-core/core/src/TextDecoder.h +23 -0
- package/cpp/zxing-core/core/src/TextEncoder.cpp +75 -0
- package/cpp/zxing-core/core/src/TextEncoder.h +31 -0
- package/cpp/zxing-core/core/src/ThresholdBinarizer.h +58 -0
- package/cpp/zxing-core/core/src/TritMatrix.h +29 -0
- package/cpp/zxing-core/core/src/Utf.cpp +276 -0
- package/cpp/zxing-core/core/src/Utf.h +26 -0
- package/cpp/zxing-core/core/src/WhiteRectDetector.cpp +276 -0
- package/cpp/zxing-core/core/src/WhiteRectDetector.h +36 -0
- package/cpp/zxing-core/core/src/WriteBarcode.cpp +213 -0
- package/cpp/zxing-core/core/src/WriteBarcode.h +72 -0
- package/cpp/zxing-core/core/src/ZXAlgorithms.h +353 -0
- package/cpp/zxing-core/core/src/ZXConfig.h +17 -0
- package/cpp/zxing-core/core/src/ZXTestSupport.h +9 -0
- package/cpp/zxing-core/core/src/ZXVersion.h +14 -0
- package/cpp/zxing-core/core/src/ZXingC.cpp +460 -0
- package/cpp/zxing-core/core/src/ZXingC.h +296 -0
- package/cpp/zxing-core/core/src/ZXingCpp.cpp +18 -0
- package/cpp/zxing-core/core/src/ZXingCpp.h +76 -0
- package/cpp/zxing-core/core/src/ZXingQt.h +606 -0
- package/cpp/zxing-core/core/src/aztec/AZDecoder.cpp +376 -0
- package/cpp/zxing-core/core/src/aztec/AZDecoder.h +20 -0
- package/cpp/zxing-core/core/src/aztec/AZDetector.cpp +508 -0
- package/cpp/zxing-core/core/src/aztec/AZDetector.h +25 -0
- package/cpp/zxing-core/core/src/aztec/AZDetectorResult.h +51 -0
- package/cpp/zxing-core/core/src/aztec/AZEncoder.cpp +318 -0
- package/cpp/zxing-core/core/src/aztec/AZEncoder.h +44 -0
- package/cpp/zxing-core/core/src/aztec/AZEncodingState.h +40 -0
- package/cpp/zxing-core/core/src/aztec/AZHighLevelEncoder.cpp +377 -0
- package/cpp/zxing-core/core/src/aztec/AZHighLevelEncoder.h +36 -0
- package/cpp/zxing-core/core/src/aztec/AZReader.cpp +45 -0
- package/cpp/zxing-core/core/src/aztec/AZReader.h +21 -0
- package/cpp/zxing-core/core/src/aztec/AZToken.cpp +44 -0
- package/cpp/zxing-core/core/src/aztec/AZToken.h +39 -0
- package/cpp/zxing-core/core/src/aztec/AZWriter.cpp +38 -0
- package/cpp/zxing-core/core/src/aztec/AZWriter.h +55 -0
- package/cpp/zxing-core/core/src/datamatrix/DMBitLayout.cpp +194 -0
- package/cpp/zxing-core/core/src/datamatrix/DMBitLayout.h +21 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDataBlock.cpp +63 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDataBlock.h +41 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDecoder.cpp +457 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDecoder.h +19 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDetector.cpp +1230 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDetector.h +23 -0
- package/cpp/zxing-core/core/src/datamatrix/DMECEncoder.cpp +137 -0
- package/cpp/zxing-core/core/src/datamatrix/DMECEncoder.h +26 -0
- package/cpp/zxing-core/core/src/datamatrix/DMEncoderContext.h +128 -0
- package/cpp/zxing-core/core/src/datamatrix/DMHighLevelEncoder.cpp +919 -0
- package/cpp/zxing-core/core/src/datamatrix/DMHighLevelEncoder.h +29 -0
- package/cpp/zxing-core/core/src/datamatrix/DMReader.cpp +40 -0
- package/cpp/zxing-core/core/src/datamatrix/DMReader.h +21 -0
- package/cpp/zxing-core/core/src/datamatrix/DMSymbolInfo.cpp +141 -0
- package/cpp/zxing-core/core/src/datamatrix/DMSymbolInfo.h +78 -0
- package/cpp/zxing-core/core/src/datamatrix/DMSymbolShape.h +17 -0
- package/cpp/zxing-core/core/src/datamatrix/DMVersion.cpp +82 -0
- package/cpp/zxing-core/core/src/datamatrix/DMVersion.h +76 -0
- package/cpp/zxing-core/core/src/datamatrix/DMWriter.cpp +114 -0
- package/cpp/zxing-core/core/src/datamatrix/DMWriter.h +62 -0
- package/cpp/zxing-core/core/src/librscpp/README.md +65 -0
- package/cpp/zxing-core/core/src/librscpp/decode.h +258 -0
- package/cpp/zxing-core/core/src/librscpp/encode.h +124 -0
- package/cpp/zxing-core/core/src/librscpp/field.h +158 -0
- package/cpp/zxing-core/core/src/librscpp/poly.h +194 -0
- package/cpp/zxing-core/core/src/libzint/2of5inter.c +1 -0
- package/cpp/zxing-core/core/src/libzint/2of5inter_based.c +1 -0
- package/cpp/zxing-core/core/src/libzint/aztec.c +1 -0
- package/cpp/zxing-core/core/src/libzint/aztec.h +1 -0
- package/cpp/zxing-core/core/src/libzint/big5.h +1 -0
- package/cpp/zxing-core/core/src/libzint/codabar.c +1 -0
- package/cpp/zxing-core/core/src/libzint/code.c +1 -0
- package/cpp/zxing-core/core/src/libzint/code128.c +1 -0
- package/cpp/zxing-core/core/src/libzint/code128.h +1 -0
- package/cpp/zxing-core/core/src/libzint/common.c +1 -0
- package/cpp/zxing-core/core/src/libzint/common.h +1 -0
- package/cpp/zxing-core/core/src/libzint/dmatrix.c +1 -0
- package/cpp/zxing-core/core/src/libzint/dmatrix.h +1 -0
- package/cpp/zxing-core/core/src/libzint/dxfilmedge.c +1 -0
- package/cpp/zxing-core/core/src/libzint/eci.c +1 -0
- package/cpp/zxing-core/core/src/libzint/eci.h +1 -0
- package/cpp/zxing-core/core/src/libzint/eci_sb.h +1 -0
- package/cpp/zxing-core/core/src/libzint/filemem.c +1 -0
- package/cpp/zxing-core/core/src/libzint/filemem.h +1 -0
- package/cpp/zxing-core/core/src/libzint/fonts/normal_woff2.h +1 -0
- package/cpp/zxing-core/core/src/libzint/fonts/upcean_woff2.h +1 -0
- package/cpp/zxing-core/core/src/libzint/gb18030.h +1 -0
- package/cpp/zxing-core/core/src/libzint/gb2312.h +1 -0
- package/cpp/zxing-core/core/src/libzint/gbk.h +1 -0
- package/cpp/zxing-core/core/src/libzint/general_field.c +1 -0
- package/cpp/zxing-core/core/src/libzint/general_field.h +1 -0
- package/cpp/zxing-core/core/src/libzint/gs1.c +1 -0
- package/cpp/zxing-core/core/src/libzint/gs1.h +1 -0
- package/cpp/zxing-core/core/src/libzint/gs1_lint.h +1 -0
- package/cpp/zxing-core/core/src/libzint/iso3166.h +1 -0
- package/cpp/zxing-core/core/src/libzint/iso4217.h +1 -0
- package/cpp/zxing-core/core/src/libzint/ksx1001.h +1 -0
- package/cpp/zxing-core/core/src/libzint/large.c +1 -0
- package/cpp/zxing-core/core/src/libzint/large.h +1 -0
- package/cpp/zxing-core/core/src/libzint/library.c +1 -0
- package/cpp/zxing-core/core/src/libzint/maxicode.c +1 -0
- package/cpp/zxing-core/core/src/libzint/maxicode.h +1 -0
- package/cpp/zxing-core/core/src/libzint/medical.c +1 -0
- package/cpp/zxing-core/core/src/libzint/output.c +1 -0
- package/cpp/zxing-core/core/src/libzint/output.h +1 -0
- package/cpp/zxing-core/core/src/libzint/pdf417.c +1 -0
- package/cpp/zxing-core/core/src/libzint/pdf417.h +1 -0
- package/cpp/zxing-core/core/src/libzint/pdf417_tabs.h +1 -0
- package/cpp/zxing-core/core/src/libzint/qr.c +1 -0
- package/cpp/zxing-core/core/src/libzint/qr.h +1 -0
- package/cpp/zxing-core/core/src/libzint/raster.c +1 -0
- package/cpp/zxing-core/core/src/libzint/raster_font.h +1 -0
- package/cpp/zxing-core/core/src/libzint/reedsol.c +1 -0
- package/cpp/zxing-core/core/src/libzint/reedsol.h +1 -0
- package/cpp/zxing-core/core/src/libzint/reedsol_logs.h +1 -0
- package/cpp/zxing-core/core/src/libzint/rss.c +1 -0
- package/cpp/zxing-core/core/src/libzint/rss.h +1 -0
- package/cpp/zxing-core/core/src/libzint/sjis.h +1 -0
- package/cpp/zxing-core/core/src/libzint/stubs.c +137 -0
- package/cpp/zxing-core/core/src/libzint/svg.c +1 -0
- package/cpp/zxing-core/core/src/libzint/telepen.c +1 -0
- package/cpp/zxing-core/core/src/libzint/upcean.c +1 -0
- package/cpp/zxing-core/core/src/libzint/vector.c +1 -0
- package/cpp/zxing-core/core/src/libzint/zfiletypes.h +1 -0
- package/cpp/zxing-core/core/src/libzint/zint.h +1 -0
- package/cpp/zxing-core/core/src/libzint/zintconfig.h +1 -0
- package/cpp/zxing-core/core/src/libzueci/README.md +11 -0
- package/cpp/zxing-core/core/src/libzueci/zueci.c +1718 -0
- package/cpp/zxing-core/core/src/libzueci/zueci.h +179 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_big5.h +3884 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_common.h +31 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_gb18030.h +264 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_gb2312.h +2381 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_gbk.h +4047 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_ksx1001.h +2932 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_sb.h +1112 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_sjis.h +2286 -0
- package/cpp/zxing-core/core/src/maxicode/MCBitMatrixParser.cpp +68 -0
- package/cpp/zxing-core/core/src/maxicode/MCBitMatrixParser.h +30 -0
- package/cpp/zxing-core/core/src/maxicode/MCDecoder.cpp +329 -0
- package/cpp/zxing-core/core/src/maxicode/MCDecoder.h +19 -0
- package/cpp/zxing-core/core/src/maxicode/MCReader.cpp +65 -0
- package/cpp/zxing-core/core/src/maxicode/MCReader.h +21 -0
- package/cpp/zxing-core/core/src/oned/ODCodabarReader.cpp +102 -0
- package/cpp/zxing-core/core/src/oned/ODCodabarReader.h +21 -0
- package/cpp/zxing-core/core/src/oned/ODCodabarWriter.cpp +136 -0
- package/cpp/zxing-core/core/src/oned/ODCodabarWriter.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODCode128Patterns.h +130 -0
- package/cpp/zxing-core/core/src/oned/ODCode128Reader.cpp +236 -0
- package/cpp/zxing-core/core/src/oned/ODCode128Reader.h +21 -0
- package/cpp/zxing-core/core/src/oned/ODCode128Writer.cpp +261 -0
- package/cpp/zxing-core/core/src/oned/ODCode128Writer.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODCode39Reader.cpp +213 -0
- package/cpp/zxing-core/core/src/oned/ODCode39Reader.h +26 -0
- package/cpp/zxing-core/core/src/oned/ODCode39Writer.cpp +176 -0
- package/cpp/zxing-core/core/src/oned/ODCode39Writer.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODCode93Patterns.h +80 -0
- package/cpp/zxing-core/core/src/oned/ODCode93Reader.cpp +112 -0
- package/cpp/zxing-core/core/src/oned/ODCode93Reader.h +21 -0
- package/cpp/zxing-core/core/src/oned/ODCode93Writer.cpp +192 -0
- package/cpp/zxing-core/core/src/oned/ODCode93Writer.h +32 -0
- package/cpp/zxing-core/core/src/oned/ODDXFilmEdgeReader.cpp +246 -0
- package/cpp/zxing-core/core/src/oned/ODDXFilmEdgeReader.h +26 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarCommon.cpp +172 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarCommon.h +204 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarExpandedBitDecoder.cpp +253 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarExpandedBitDecoder.h +19 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarExpandedReader.cpp +383 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarExpandedReader.h +25 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarLimitedReader.cpp +163 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarLimitedReader.h +23 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarReader.cpp +240 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarReader.h +25 -0
- package/cpp/zxing-core/core/src/oned/ODEAN13Writer.cpp +62 -0
- package/cpp/zxing-core/core/src/oned/ODEAN13Writer.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODEAN8Writer.cpp +51 -0
- package/cpp/zxing-core/core/src/oned/ODEAN8Writer.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODITFReader.cpp +97 -0
- package/cpp/zxing-core/core/src/oned/ODITFReader.h +33 -0
- package/cpp/zxing-core/core/src/oned/ODITFWriter.cpp +78 -0
- package/cpp/zxing-core/core/src/oned/ODITFWriter.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODMultiUPCEANReader.cpp +323 -0
- package/cpp/zxing-core/core/src/oned/ODMultiUPCEANReader.h +32 -0
- package/cpp/zxing-core/core/src/oned/ODReader.cpp +259 -0
- package/cpp/zxing-core/core/src/oned/ODReader.h +35 -0
- package/cpp/zxing-core/core/src/oned/ODRowReader.h +222 -0
- package/cpp/zxing-core/core/src/oned/ODTelepenReader.cpp +199 -0
- package/cpp/zxing-core/core/src/oned/ODTelepenReader.h +25 -0
- package/cpp/zxing-core/core/src/oned/ODUPCAWriter.cpp +33 -0
- package/cpp/zxing-core/core/src/oned/ODUPCAWriter.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODUPCEANCommon.cpp +80 -0
- package/cpp/zxing-core/core/src/oned/ODUPCEANCommon.h +129 -0
- package/cpp/zxing-core/core/src/oned/ODUPCEWriter.cpp +56 -0
- package/cpp/zxing-core/core/src/oned/ODUPCEWriter.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODWriterHelper.cpp +39 -0
- package/cpp/zxing-core/core/src/oned/ODWriterHelper.h +48 -0
- package/cpp/zxing-core/core/src/pdf417/MicroPDFReader.cpp +796 -0
- package/cpp/zxing-core/core/src/pdf417/MicroPDFReader.h +23 -0
- package/cpp/zxing-core/core/src/pdf417/PDF417.cpp +85 -0
- package/cpp/zxing-core/core/src/pdf417/PDF417.h +81 -0
- package/cpp/zxing-core/core/src/pdf417/PDFBarcodeMetadata.h +53 -0
- package/cpp/zxing-core/core/src/pdf417/PDFBarcodeValue.cpp +48 -0
- package/cpp/zxing-core/core/src/pdf417/PDFBarcodeValue.h +38 -0
- package/cpp/zxing-core/core/src/pdf417/PDFBoundingBox.cpp +116 -0
- package/cpp/zxing-core/core/src/pdf417/PDFBoundingBox.h +75 -0
- package/cpp/zxing-core/core/src/pdf417/PDFCodeword.h +71 -0
- package/cpp/zxing-core/core/src/pdf417/PDFCodewordDecoder.cpp +588 -0
- package/cpp/zxing-core/core/src/pdf417/PDFCodewordDecoder.h +41 -0
- package/cpp/zxing-core/core/src/pdf417/PDFCompaction.h +20 -0
- package/cpp/zxing-core/core/src/pdf417/PDFCustomData.h +32 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDecoder.cpp +725 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDecoder.h +20 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetectionResult.cpp +247 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetectionResult.h +74 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetectionResultColumn.cpp +321 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetectionResultColumn.h +83 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetector.cpp +371 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetector.h +45 -0
- package/cpp/zxing-core/core/src/pdf417/PDFEncoder.cpp +570 -0
- package/cpp/zxing-core/core/src/pdf417/PDFEncoder.h +182 -0
- package/cpp/zxing-core/core/src/pdf417/PDFHighLevelEncoder.cpp +570 -0
- package/cpp/zxing-core/core/src/pdf417/PDFHighLevelEncoder.h +32 -0
- package/cpp/zxing-core/core/src/pdf417/PDFReader.cpp +333 -0
- package/cpp/zxing-core/core/src/pdf417/PDFReader.h +28 -0
- package/cpp/zxing-core/core/src/pdf417/PDFScanningDecoder.cpp +559 -0
- package/cpp/zxing-core/core/src/pdf417/PDFScanningDecoder.h +41 -0
- package/cpp/zxing-core/core/src/pdf417/PDFWriter.cpp +170 -0
- package/cpp/zxing-core/core/src/pdf417/PDFWriter.h +74 -0
- package/cpp/zxing-core/core/src/pdf417/ZXBigInteger.cpp +623 -0
- package/cpp/zxing-core/core/src/pdf417/ZXBigInteger.h +81 -0
- package/cpp/zxing-core/core/src/pdf417/ZXNullable.h +105 -0
- package/cpp/zxing-core/core/src/qrcode/QRBitMatrixParser.cpp +294 -0
- package/cpp/zxing-core/core/src/qrcode/QRBitMatrixParser.h +41 -0
- package/cpp/zxing-core/core/src/qrcode/QRCodecMode.cpp +95 -0
- package/cpp/zxing-core/core/src/qrcode/QRCodecMode.h +59 -0
- package/cpp/zxing-core/core/src/qrcode/QRDataBlock.cpp +93 -0
- package/cpp/zxing-core/core/src/qrcode/QRDataBlock.h +52 -0
- package/cpp/zxing-core/core/src/qrcode/QRDataMask.h +50 -0
- package/cpp/zxing-core/core/src/qrcode/QRDecoder.cpp +359 -0
- package/cpp/zxing-core/core/src/qrcode/QRDecoder.h +19 -0
- package/cpp/zxing-core/core/src/qrcode/QRDetector.cpp +920 -0
- package/cpp/zxing-core/core/src/qrcode/QRDetector.h +45 -0
- package/cpp/zxing-core/core/src/qrcode/QRECB.h +52 -0
- package/cpp/zxing-core/core/src/qrcode/QREncodeResult.h +33 -0
- package/cpp/zxing-core/core/src/qrcode/QREncoder.cpp +568 -0
- package/cpp/zxing-core/core/src/qrcode/QREncoder.h +21 -0
- package/cpp/zxing-core/core/src/qrcode/QRErrorCorrectionLevel.cpp +51 -0
- package/cpp/zxing-core/core/src/qrcode/QRErrorCorrectionLevel.h +39 -0
- package/cpp/zxing-core/core/src/qrcode/QRFormatInformation.cpp +160 -0
- package/cpp/zxing-core/core/src/qrcode/QRFormatInformation.h +61 -0
- package/cpp/zxing-core/core/src/qrcode/QRMaskUtil.cpp +156 -0
- package/cpp/zxing-core/core/src/qrcode/QRMaskUtil.h +15 -0
- package/cpp/zxing-core/core/src/qrcode/QRMatrixUtil.cpp +318 -0
- package/cpp/zxing-core/core/src/qrcode/QRMatrixUtil.h +25 -0
- package/cpp/zxing-core/core/src/qrcode/QRReader.cpp +149 -0
- package/cpp/zxing-core/core/src/qrcode/QRReader.h +21 -0
- package/cpp/zxing-core/core/src/qrcode/QRVersion.cpp +754 -0
- package/cpp/zxing-core/core/src/qrcode/QRVersion.h +127 -0
- package/cpp/zxing-core/core/src/qrcode/QRWriter.cpp +51 -0
- package/cpp/zxing-core/core/src/qrcode/QRWriter.h +74 -0
- package/cpp/zxing-core/core/version.rc.in +34 -0
- package/cpp/zxing-core/core/zxing.pc.in +8 -0
- package/cpp/zxing-core/wrappers/ios/README.md +25 -0
- package/cpp/zxing-core/wrappers/ios/Sources/Wrapper/Version.h +29 -0
- package/cpp/zxing-core/zxing-cpp.podspec +45 -0
- package/lib/factory.d.ts +10 -0
- package/lib/factory.js +12 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +9 -0
- package/lib/specs/Barcode.nitro.d.ts +63 -0
- package/lib/specs/Barcode.nitro.js +1 -0
- package/lib/specs/BarcodeFormat.d.ts +11 -0
- package/lib/specs/BarcodeFormat.js +1 -0
- package/lib/specs/BarcodeScanner.nitro.d.ts +89 -0
- package/lib/specs/BarcodeScanner.nitro.js +1 -0
- package/lib/specs/BarcodeScannerFactory.nitro.d.ts +26 -0
- package/lib/specs/BarcodeScannerFactory.nitro.js +1 -0
- package/lib/specs/BarcodeValueType.d.ts +9 -0
- package/lib/specs/BarcodeValueType.js +1 -0
- package/lib/specs/Point.d.ts +14 -0
- package/lib/specs/Point.js +1 -0
- package/lib/specs/Rect.d.ts +22 -0
- package/lib/specs/Rect.js +1 -0
- package/lib/useBarcodeScanner.d.ts +23 -0
- package/lib/useBarcodeScanner.js +25 -0
- package/nitro.json +20 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/VisionCameraZxing+autolinking.cmake +83 -0
- package/nitrogen/generated/android/VisionCameraZxing+autolinking.gradle +27 -0
- package/nitrogen/generated/android/VisionCameraZxingOnLoad.cpp +49 -0
- package/nitrogen/generated/android/VisionCameraZxingOnLoad.hpp +34 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/zxing/VisionCameraZxingOnLoad.kt +35 -0
- package/nitrogen/generated/ios/VisionCameraZxing+autolinking.rb +62 -0
- package/nitrogen/generated/ios/VisionCameraZxing-Swift-Cxx-Bridge.cpp +17 -0
- package/nitrogen/generated/ios/VisionCameraZxing-Swift-Cxx-Bridge.hpp +27 -0
- package/nitrogen/generated/ios/VisionCameraZxing-Swift-Cxx-Umbrella.hpp +38 -0
- package/nitrogen/generated/ios/VisionCameraZxingAutolinking.mm +35 -0
- package/nitrogen/generated/ios/VisionCameraZxingAutolinking.swift +16 -0
- package/nitrogen/generated/shared/c++/BarcodeFormat.hpp +124 -0
- package/nitrogen/generated/shared/c++/BarcodeScannerOptions.hpp +85 -0
- package/nitrogen/generated/shared/c++/BarcodeValueType.hpp +120 -0
- package/nitrogen/generated/shared/c++/HybridBarcodeScannerSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridBarcodeScannerSpec.hpp +74 -0
- package/nitrogen/generated/shared/c++/HybridBarcodeSpec.cpp +27 -0
- package/nitrogen/generated/shared/c++/HybridBarcodeSpec.hpp +82 -0
- package/nitrogen/generated/shared/c++/HybridZXingBarcodeScannerFactorySpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridZXingBarcodeScannerFactorySpec.hpp +67 -0
- package/nitrogen/generated/shared/c++/Point.hpp +87 -0
- package/nitrogen/generated/shared/c++/Rect.hpp +95 -0
- package/nitrogen/generated/shared/c++/TargetBarcodeFormat.hpp +124 -0
- package/package.json +108 -0
- package/react-native.config.js +16 -0
- package/src/factory.ts +26 -0
- package/src/index.ts +9 -0
- package/src/specs/Barcode.nitro.ts +70 -0
- package/src/specs/BarcodeFormat.ts +31 -0
- package/src/specs/BarcodeScanner.nitro.ts +91 -0
- package/src/specs/BarcodeScannerFactory.nitro.ts +27 -0
- package/src/specs/BarcodeValueType.ts +25 -0
- package/src/specs/Point.ts +14 -0
- package/src/specs/Rect.ts +22 -0
- package/src/useBarcodeScanner.ts +36 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2019 Nu-book Inc.
|
|
3
|
+
* Copyright 2023 Axel Waggershauser
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#pragma once
|
|
8
|
+
|
|
9
|
+
#cmakedefine ZXING_READERS
|
|
10
|
+
#cmakedefine ZXING_WRITERS
|
|
11
|
+
|
|
12
|
+
#cmakedefine01 ZXING_ENABLE_1D
|
|
13
|
+
#cmakedefine01 ZXING_ENABLE_AZTEC
|
|
14
|
+
#cmakedefine01 ZXING_ENABLE_DATAMATRIX
|
|
15
|
+
#cmakedefine01 ZXING_ENABLE_MAXICODE
|
|
16
|
+
#cmakedefine01 ZXING_ENABLE_PDF417
|
|
17
|
+
#cmakedefine01 ZXING_ENABLE_QRCODE
|
|
18
|
+
|
|
19
|
+
#cmakedefine ZXING_EXPERIMENTAL_API
|
|
20
|
+
#cmakedefine ZXING_USE_ZINT
|
|
21
|
+
|
|
22
|
+
// Version numbering
|
|
23
|
+
#define ZXING_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
|
|
24
|
+
#define ZXING_VERSION_MINOR @PROJECT_VERSION_MINOR@
|
|
25
|
+
#define ZXING_VERSION_PATCH @PROJECT_VERSION_PATCH@
|
|
26
|
+
#define ZXING_VERSION_SUFFIX "@ZXING_VERSION_SUFFIX@"
|
|
27
|
+
|
|
28
|
+
#define ZXING_VERSION_STR "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@@ZXING_VERSION_SUFFIX@"
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
@PACKAGE_INIT@
|
|
2
|
+
include("${CMAKE_CURRENT_LIST_DIR}/ZXingTargets.cmake")
|
|
3
|
+
|
|
4
|
+
# this does not work: add_library(ZXing::Core ALIAS ZXing::ZXing)
|
|
5
|
+
# this is a workaround available since 3.11 :
|
|
6
|
+
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.11 AND NOT TARGET ZXing::Core)
|
|
7
|
+
add_library(ZXing::Core INTERFACE IMPORTED)
|
|
8
|
+
target_link_libraries(ZXing::Core INTERFACE ZXing::ZXing)
|
|
9
|
+
endif()
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Nu-book Inc.
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#include "Barcode.h"
|
|
8
|
+
|
|
9
|
+
#include "BarcodeData.h"
|
|
10
|
+
#include "JSON.h"
|
|
11
|
+
#include "ZXAlgorithms.h"
|
|
12
|
+
|
|
13
|
+
#include "BitMatrix.h"
|
|
14
|
+
|
|
15
|
+
#include <cmath>
|
|
16
|
+
#include <list>
|
|
17
|
+
#include <map>
|
|
18
|
+
#include <numbers>
|
|
19
|
+
#include <utility>
|
|
20
|
+
|
|
21
|
+
#ifdef ZXING_USE_ZINT
|
|
22
|
+
#include <zint.h>
|
|
23
|
+
void zint_symbol_deleter::operator()(zint_symbol* p) const noexcept
|
|
24
|
+
{
|
|
25
|
+
ZBarcode_Delete(p);
|
|
26
|
+
}
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
namespace ZXing {
|
|
30
|
+
|
|
31
|
+
Barcode::Barcode() : d(std::make_shared<Data>()) {}
|
|
32
|
+
|
|
33
|
+
Barcode::Barcode(Data&& data) : d(std::make_shared<Data>(std::move(data))) {}
|
|
34
|
+
|
|
35
|
+
bool Barcode::isValid() const
|
|
36
|
+
{
|
|
37
|
+
return d->isValid();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const Error& Barcode::error() const
|
|
41
|
+
{
|
|
42
|
+
return d->error;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
BarcodeFormat Barcode::format() const
|
|
46
|
+
{
|
|
47
|
+
return d->format;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const Position& Barcode::position() const
|
|
51
|
+
{
|
|
52
|
+
return d->position;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const std::vector<uint8_t>& Barcode::bytes() const
|
|
56
|
+
{
|
|
57
|
+
return d->content.bytes;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
std::vector<uint8_t> Barcode::bytesECI() const
|
|
61
|
+
{
|
|
62
|
+
return d->content.bytesECI();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
std::string Barcode::text(TextMode mode) const
|
|
66
|
+
{
|
|
67
|
+
return d->content.text(mode);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
std::string Barcode::text() const
|
|
71
|
+
{
|
|
72
|
+
return text(d->defaultTextMode);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
ContentType Barcode::contentType() const
|
|
76
|
+
{
|
|
77
|
+
return d->content.type();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
bool Barcode::hasECI() const
|
|
81
|
+
{
|
|
82
|
+
return d->content.hasECI;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
int Barcode::orientation() const
|
|
86
|
+
{
|
|
87
|
+
return narrow_cast<int>(std::lround(d->position.orientation() * 180 / std::numbers::pi));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
bool Barcode::isMirrored() const
|
|
91
|
+
{
|
|
92
|
+
return d->isMirrored;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
bool Barcode::isInverted() const
|
|
96
|
+
{
|
|
97
|
+
return d->isInverted;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
std::string Barcode::symbologyIdentifier() const
|
|
101
|
+
{
|
|
102
|
+
return d->content.symbology.toString();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
int Barcode::sequenceSize() const
|
|
106
|
+
{
|
|
107
|
+
return d->sai.count;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
int Barcode::sequenceIndex() const
|
|
111
|
+
{
|
|
112
|
+
return d->sai.index;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
std::string Barcode::sequenceId() const
|
|
116
|
+
{
|
|
117
|
+
return d->sai.id;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
int Barcode::lineCount() const
|
|
121
|
+
{
|
|
122
|
+
return d->lineCount;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
Barcode& Barcode::setReaderOptions(const ReaderOptions& opts)
|
|
126
|
+
{
|
|
127
|
+
if (opts.characterSet() != CharacterSet::Unknown)
|
|
128
|
+
d->content.defaultCharset = opts.characterSet();
|
|
129
|
+
d->defaultTextMode = opts.textMode();
|
|
130
|
+
return *this;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
ImageView Barcode::symbol() const
|
|
134
|
+
{
|
|
135
|
+
return !d->symbol.empty() ? ImageView{d->symbol.row(0).begin(), d->symbol.width(), d->symbol.height(), ImageFormat::Lum}
|
|
136
|
+
: ImageView{};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
#if defined(ZXING_USE_ZINT) && defined(ZXING_EXPERIMENTAL_API)
|
|
140
|
+
zint_symbol* Barcode::zint() const
|
|
141
|
+
{
|
|
142
|
+
return d->zint.get();
|
|
143
|
+
}
|
|
144
|
+
#endif
|
|
145
|
+
|
|
146
|
+
std::string Barcode::extra(std::string_view key) const
|
|
147
|
+
{
|
|
148
|
+
if (key == "ALL") {
|
|
149
|
+
if (format() == BarcodeFormat::None)
|
|
150
|
+
return {};
|
|
151
|
+
auto res =
|
|
152
|
+
StrCat("{", JsonProp("Text", text(TextMode::Plain)), JsonProp("HRI", text(TextMode::HRI)),
|
|
153
|
+
JsonProp("TextECI", text(TextMode::ECI)), JsonProp("Bytes", text(TextMode::Hex)),
|
|
154
|
+
JsonProp("Identifier", symbologyIdentifier()), JsonProp("Format", Name(format())),
|
|
155
|
+
JsonProp("Symbology", Name(Symbology(format()))), JsonProp("ContentType", isValid() ? ToString(contentType()) : ""),
|
|
156
|
+
JsonProp("Position", ToString(position())), JsonProp("HasECI", hasECI()), JsonProp("IsMirrored", isMirrored()),
|
|
157
|
+
JsonProp("IsInverted", isInverted()), d->extra, JsonProp("Error", ToString(error())));
|
|
158
|
+
res.back() = '}';
|
|
159
|
+
return res;
|
|
160
|
+
}
|
|
161
|
+
return d->extra.empty() ? ""
|
|
162
|
+
: key.empty() ? StrCat("{", std::string_view(d->extra).substr(0, d->extra.size() - 1), "}") // remove trailing ','
|
|
163
|
+
: JsonGet<std::string>(d->extra, key).value_or(""); // make sure JsonUnescape() is called
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
bool Barcode::operator==(const Barcode& o) const
|
|
167
|
+
{
|
|
168
|
+
return *d == *o.d;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
bool BarcodeData::operator==(const BarcodeData& o) const
|
|
172
|
+
{
|
|
173
|
+
if (format != o.format)
|
|
174
|
+
return false;
|
|
175
|
+
|
|
176
|
+
// handle MatrixCodes first
|
|
177
|
+
if (!(format & BarcodeFormat::AllLinear)) {
|
|
178
|
+
if (content.bytes != o.content.bytes)
|
|
179
|
+
return false;
|
|
180
|
+
|
|
181
|
+
// At this point both are valid with the same content or both are in error.
|
|
182
|
+
// Treat them as equal if their positions are about the same (center of one is inside the other).
|
|
183
|
+
return IsInside(Center(o.position), position);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (content.bytes != o.content.bytes || error != o.error || orientation() != o.orientation())
|
|
187
|
+
return false;
|
|
188
|
+
|
|
189
|
+
if (lineCount > 1 && o.lineCount > 1)
|
|
190
|
+
return HaveIntersectingBoundingBoxes(o.position, position);
|
|
191
|
+
|
|
192
|
+
// the following code is only meant for this or other lineCount == 1
|
|
193
|
+
assert(lineCount == 1 || o.lineCount == 1);
|
|
194
|
+
|
|
195
|
+
// sl == single line, ml = multi line
|
|
196
|
+
const auto& sl = lineCount == 1 ? *this : o;
|
|
197
|
+
const auto& ml = lineCount == 1 ? o : *this;
|
|
198
|
+
|
|
199
|
+
// If one line is less than half the length of the other away from the
|
|
200
|
+
// latter, we consider it to belong to the same symbol.
|
|
201
|
+
// Additionally, both need to have roughly the same length (see #367).
|
|
202
|
+
auto dTop = maxAbsComponent(ml.position.topLeft() - sl.position.topLeft());
|
|
203
|
+
auto dBot = maxAbsComponent(ml.position.bottomLeft() - sl.position.topLeft());
|
|
204
|
+
auto slLength = maxAbsComponent(sl.position.topLeft() - sl.position.bottomRight());
|
|
205
|
+
bool isHorizontal = sl.position.topLeft().y == sl.position.bottomRight().y;
|
|
206
|
+
// Measure the multi line length in the same direction as the single line one (not diagonally)
|
|
207
|
+
// to make sure overly tall symbols don't get segmented (see #769).
|
|
208
|
+
auto mlLength = isHorizontal ? std::abs(ml.position.topLeft().x - ml.position.bottomRight().x)
|
|
209
|
+
: std::abs(ml.position.topLeft().y - ml.position.bottomRight().y);
|
|
210
|
+
|
|
211
|
+
return std::min(dTop, dBot) < slLength / 2 && std::abs(slLength - mlLength) < slLength / 5;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
Barcode MergeStructuredAppendSequence(const Barcodes& barcodes)
|
|
215
|
+
{
|
|
216
|
+
if (barcodes.empty())
|
|
217
|
+
return {};
|
|
218
|
+
|
|
219
|
+
std::list<Barcode> allBarcodes(barcodes.begin(), barcodes.end());
|
|
220
|
+
allBarcodes.sort([](const Barcode& r1, const Barcode& r2) { return r1.sequenceIndex() < r2.sequenceIndex(); });
|
|
221
|
+
|
|
222
|
+
Barcode res = allBarcodes.front();
|
|
223
|
+
for (auto i = std::next(allBarcodes.begin()); i != allBarcodes.end(); ++i)
|
|
224
|
+
res.d->content.append(i->d->content);
|
|
225
|
+
|
|
226
|
+
res.d->position = {};
|
|
227
|
+
res.d->sai.index = -1;
|
|
228
|
+
|
|
229
|
+
if (allBarcodes.back().sequenceSize() != Size(allBarcodes) ||
|
|
230
|
+
!std::all_of(allBarcodes.begin(), allBarcodes.end(),
|
|
231
|
+
[&](Barcode& it) { return it.sequenceId() == allBarcodes.front().sequenceId(); }))
|
|
232
|
+
res.d->error = FormatError("sequenceIDs not matching during structured append sequence merging");
|
|
233
|
+
|
|
234
|
+
return res;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
Barcodes MergeStructuredAppendSequences(const Barcodes& barcodes)
|
|
238
|
+
{
|
|
239
|
+
std::map<std::string, Barcodes> sas;
|
|
240
|
+
for (auto& barcode : barcodes) {
|
|
241
|
+
if (barcode.isPartOfSequence())
|
|
242
|
+
sas[barcode.sequenceId()].push_back(barcode);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
Barcodes res;
|
|
246
|
+
for (auto& [id, seq] : sas) {
|
|
247
|
+
auto barcode = MergeStructuredAppendSequence(seq);
|
|
248
|
+
if (barcode.isValid())
|
|
249
|
+
res.push_back(std::move(barcode));
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return res;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
} // namespace ZXing
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Nu-book Inc.
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
* Copyright 2020 Axel Waggershauser
|
|
5
|
+
*/
|
|
6
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "BarcodeFormat.h"
|
|
11
|
+
#include "ContentType.h"
|
|
12
|
+
#include "Error.h"
|
|
13
|
+
#include "ImageView.h"
|
|
14
|
+
#include "Quadrilateral.h"
|
|
15
|
+
#include "ReaderOptions.h" // for TextMode
|
|
16
|
+
#include "Version.h" // ZXING_... macros
|
|
17
|
+
|
|
18
|
+
#include <memory>
|
|
19
|
+
#include <string>
|
|
20
|
+
#include <vector>
|
|
21
|
+
|
|
22
|
+
#ifdef ZXING_USE_ZINT
|
|
23
|
+
extern "C" struct zint_symbol;
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace ZXing {
|
|
27
|
+
|
|
28
|
+
class CreatorOptions;
|
|
29
|
+
class ReaderOptions;
|
|
30
|
+
class WriterOptions;
|
|
31
|
+
class Barcode;
|
|
32
|
+
struct BarcodeData;
|
|
33
|
+
|
|
34
|
+
using Position = QuadrilateralI;
|
|
35
|
+
using Barcodes = std::vector<Barcode>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @brief String keys for the extra() metadata of Barcode. The values depend on the symbology and may not be present for all barcodes.
|
|
39
|
+
*/
|
|
40
|
+
namespace BarcodeExtra {
|
|
41
|
+
#define ZX_EXTRA(NAME) static constexpr auto NAME = #NAME
|
|
42
|
+
ZX_EXTRA(DataMask); ///< QRCodes
|
|
43
|
+
ZX_EXTRA(Version); ///< QRCodes, DataMatrix, MaxiCode (e.g. "12x12" for DataMatrix)
|
|
44
|
+
ZX_EXTRA(EanAddOn); ///< The EAN/UPC add-on content if detected
|
|
45
|
+
ZX_EXTRA(ECLevel); ///< Error correction level (e.g. "L", "M", "Q", "H" for QRCode)
|
|
46
|
+
ZX_EXTRA(UEC); ///< Unused error correction margin in the range [0, 1]
|
|
47
|
+
ZX_EXTRA(UPCE); ///< The original (non-normalized) UPC-E code if UPC-E is detected
|
|
48
|
+
ZX_EXTRA(ReaderInit);
|
|
49
|
+
#undef ZX_EXTRA
|
|
50
|
+
} // namespace BarcodeExtra
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @brief The Barcode class encapsulates a decoded or created barcode symbol.
|
|
54
|
+
*
|
|
55
|
+
* Barcode represents a decoded or created barcode symbol, providing access to its content, format,
|
|
56
|
+
* position, and other metadata. It serves as the primary interface for working with barcodes in the library.
|
|
57
|
+
*
|
|
58
|
+
* Barcode objects are obtained from the ReadBarcodes function when scanning an image, or from the
|
|
59
|
+
* CreateBarcodeFrom... functions when generating a new barcode. To convert a Barcode to an image or SVG,
|
|
60
|
+
* use the WriteBarcodeTo... functions.
|
|
61
|
+
*
|
|
62
|
+
* @see ReadBarcodes, CreateBarcodeFromText, CreateBarcodeFromBytes, WriteBarcodeToImage, WriteBarcodeToSVG
|
|
63
|
+
*/
|
|
64
|
+
class Barcode
|
|
65
|
+
{
|
|
66
|
+
using Data = BarcodeData;
|
|
67
|
+
|
|
68
|
+
std::shared_ptr<Data> d;
|
|
69
|
+
|
|
70
|
+
Barcode& setReaderOptions(const ReaderOptions& opts);
|
|
71
|
+
|
|
72
|
+
friend Barcode MergeStructuredAppendSequence(const Barcodes&);
|
|
73
|
+
friend Barcodes ReadBarcodes(const ImageView&, const ReaderOptions&);
|
|
74
|
+
friend Barcode CreateBarcode(const void*, int, int, const CreatorOptions&);
|
|
75
|
+
friend Image WriteBarcodeToImage(const Barcode&, const WriterOptions&);
|
|
76
|
+
friend std::string WriteBarcodeToSVG(const Barcode&, const WriterOptions&);
|
|
77
|
+
|
|
78
|
+
public:
|
|
79
|
+
Barcode();
|
|
80
|
+
Barcode(Barcode::Data&& data);
|
|
81
|
+
|
|
82
|
+
/// Returns whether the barcode is valid, i.e. it contains a successfully decoded or created symbol.
|
|
83
|
+
bool isValid() const;
|
|
84
|
+
|
|
85
|
+
/// Returns the error associated with the barcode, if any.
|
|
86
|
+
const Error& error() const;
|
|
87
|
+
|
|
88
|
+
/// Returns the BarcodeFormat of the barcode.
|
|
89
|
+
BarcodeFormat format() const;
|
|
90
|
+
|
|
91
|
+
/// Returns the symbology of the barcode format (e.g. EAN/UPC for EAN13, EAN8, UPCA, etc.).
|
|
92
|
+
BarcodeFormat symbology() const { return Symbology(format()); }
|
|
93
|
+
|
|
94
|
+
/// Returns the raw / standard content without any modifications like character set conversions.
|
|
95
|
+
const std::vector<uint8_t>& bytes() const;
|
|
96
|
+
|
|
97
|
+
/// Returns the raw / standard content following the ECI protocol.
|
|
98
|
+
std::vector<uint8_t> bytesECI() const;
|
|
99
|
+
|
|
100
|
+
/// Returns the bytes() content rendered to unicode/utf8 text according to specified TextMode.
|
|
101
|
+
std::string text(TextMode mode) const;
|
|
102
|
+
|
|
103
|
+
/// Returns the bytes() content rendered to unicode/utf8 text according to the TextMode set in the ReaderOptions.
|
|
104
|
+
std::string text() const;
|
|
105
|
+
|
|
106
|
+
/// Returns the content type, giving a hint to the type of content found (Text/Binary/GS1/etc.).
|
|
107
|
+
ContentType contentType() const;
|
|
108
|
+
|
|
109
|
+
/// Returns whether or not an ECI tag was found.
|
|
110
|
+
bool hasECI() const;
|
|
111
|
+
|
|
112
|
+
/// Returns the position of the barcode in the image as a quadrilateral of 4 points (topLeft, topRight, bottomRight,
|
|
113
|
+
/// bottomLeft).
|
|
114
|
+
const Position& position() const;
|
|
115
|
+
|
|
116
|
+
/// Returns the orientation of the barcode in degrees, see also Position::orientation()
|
|
117
|
+
int orientation() const;
|
|
118
|
+
|
|
119
|
+
/// Returns whether the symbol is mirrored (currently only supported by QRCode and DataMatrix).
|
|
120
|
+
bool isMirrored() const;
|
|
121
|
+
/// Returns whether the symbol is inverted / has reversed reflectance (see ReaderOptions::tryInvert).
|
|
122
|
+
bool isInverted() const;
|
|
123
|
+
|
|
124
|
+
/// Returns the symbology identifier "]cm" where "c" is symbology code character, "m" the modifier.
|
|
125
|
+
std::string symbologyIdentifier() const;
|
|
126
|
+
|
|
127
|
+
/// @brief Returns the number of symbols in a structured append sequence.
|
|
128
|
+
///
|
|
129
|
+
/// If this is not part of a structured append sequence, the returned value is -1.
|
|
130
|
+
/// If it is a structured append symbol but the total number of symbols is unknown, the
|
|
131
|
+
/// returned value is 0 (see PDF417 if optional "Segment Count" not given).
|
|
132
|
+
int sequenceSize() const;
|
|
133
|
+
|
|
134
|
+
/// Returns the 0-based index of this symbol in a structured append sequence.
|
|
135
|
+
int sequenceIndex() const;
|
|
136
|
+
|
|
137
|
+
/// @brief Returns the sequenceId to check if a set of symbols belongs to the same structured append sequence.
|
|
138
|
+
///
|
|
139
|
+
/// If the symbology does not support this feature, the returned value is empty (see MaxiCode).
|
|
140
|
+
/// For QR Code, this is the parity integer converted to a string.
|
|
141
|
+
/// For PDF417 and DataMatrix, this is the "fileId".
|
|
142
|
+
std::string sequenceId() const;
|
|
143
|
+
|
|
144
|
+
/// Returns whether this symbol is the last in a structured append sequence.
|
|
145
|
+
bool isLastInSequence() const { return sequenceSize() == sequenceIndex() + 1; }
|
|
146
|
+
|
|
147
|
+
/// Returns whether this symbol is part of a structured append sequence.
|
|
148
|
+
bool isPartOfSequence() const { return sequenceSize() > -1 && sequenceIndex() > -1; }
|
|
149
|
+
|
|
150
|
+
/// Returns how many lines have been detected with this code (applies only to linear symbologies).
|
|
151
|
+
int lineCount() const;
|
|
152
|
+
|
|
153
|
+
/// Returns the bit matrix of the symbol as an ImageView.
|
|
154
|
+
ImageView symbol() const;
|
|
155
|
+
|
|
156
|
+
/// @brief Retrieve supplementary metadata associated with this barcode.
|
|
157
|
+
///
|
|
158
|
+
/// Returns a string containing additional and symbology specific information. In form of a JSON object
|
|
159
|
+
/// serialization. The optional parameter @p key can be used to retrieve a specific item only.
|
|
160
|
+
/// Key values are case insensitive. See BarcodeExtra namespace for valid keys.
|
|
161
|
+
/// If the key is not found or there is no info available, an empty string is returned.
|
|
162
|
+
std::string extra(std::string_view key = "") const;
|
|
163
|
+
|
|
164
|
+
/// @cond DEPRECATED
|
|
165
|
+
/// Returns the error correction level of the symbol (empty string if not applicable).
|
|
166
|
+
// [[deprecated ("use extra(BarcodeExtra::ECLevel) instead")]]
|
|
167
|
+
std::string ecLevel() const { return extra(BarcodeExtra::ECLevel); }
|
|
168
|
+
|
|
169
|
+
/// Returns whether the symbol is a Reader Initialisation/Programming symbol.
|
|
170
|
+
// [[deprecated ("use extra(BarcodeExtra::ReaderInit) instead")]]
|
|
171
|
+
bool readerInit() const { return !extra(BarcodeExtra::ReaderInit).empty(); }
|
|
172
|
+
|
|
173
|
+
/// Returns the version QRCode / DataMatrix / Aztec version or size.
|
|
174
|
+
// [[deprecated ("use extra(BarcodeExtra::Version) instead")]]
|
|
175
|
+
std::string version() const { return extra(BarcodeExtra::Version); }
|
|
176
|
+
/// @endcond
|
|
177
|
+
|
|
178
|
+
#if defined(ZXING_USE_ZINT) && defined(ZXING_EXPERIMENTAL_API)
|
|
179
|
+
zint_symbol* zint() const;
|
|
180
|
+
#endif
|
|
181
|
+
|
|
182
|
+
bool operator==(const Barcode& o) const;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
/// Merge a list of Barcodes from one Structured Append sequence to a single barcode.
|
|
186
|
+
Barcode MergeStructuredAppendSequence(const Barcodes& barcodes);
|
|
187
|
+
|
|
188
|
+
/// Automatically merge all Structured Append sequences found in the given list of barcodes.
|
|
189
|
+
Barcodes MergeStructuredAppendSequences(const Barcodes& barcodes);
|
|
190
|
+
|
|
191
|
+
} // ZXing
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Axel Waggershauser
|
|
3
|
+
*/
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
#pragma once
|
|
7
|
+
|
|
8
|
+
#include "Barcode.h"
|
|
9
|
+
#include "BitMatrix.h"
|
|
10
|
+
#include "Content.h"
|
|
11
|
+
#include "DecoderResult.h"
|
|
12
|
+
#include "DetectorResult.h"
|
|
13
|
+
#include "Error.h"
|
|
14
|
+
#include "Quadrilateral.h"
|
|
15
|
+
#include "ReaderOptions.h"
|
|
16
|
+
#include "StructuredAppend.h"
|
|
17
|
+
|
|
18
|
+
#include <memory>
|
|
19
|
+
#include <mutex>
|
|
20
|
+
#include <numbers>
|
|
21
|
+
#include <string>
|
|
22
|
+
#include <vector>
|
|
23
|
+
|
|
24
|
+
#ifdef ZXING_USE_ZINT
|
|
25
|
+
extern "C" struct zint_symbol;
|
|
26
|
+
struct zint_symbol_deleter
|
|
27
|
+
{
|
|
28
|
+
void operator()(zint_symbol* p) const noexcept;
|
|
29
|
+
};
|
|
30
|
+
using unique_zint_symbol = std::unique_ptr<zint_symbol, zint_symbol_deleter>;
|
|
31
|
+
#else
|
|
32
|
+
struct zint_symbol {};
|
|
33
|
+
using unique_zint_symbol = std::unique_ptr<zint_symbol>;
|
|
34
|
+
#endif
|
|
35
|
+
|
|
36
|
+
namespace ZXing {
|
|
37
|
+
|
|
38
|
+
struct BarcodeData
|
|
39
|
+
{
|
|
40
|
+
Content content;
|
|
41
|
+
Error error = {};
|
|
42
|
+
Position position = {};
|
|
43
|
+
BarcodeFormat format = BarcodeFormat::None;
|
|
44
|
+
std::string extra = {};
|
|
45
|
+
StructuredAppendInfo sai = {};
|
|
46
|
+
BitMatrix symbol = {};
|
|
47
|
+
#ifdef ZXING_USE_ZINT
|
|
48
|
+
unique_zint_symbol zint = {};
|
|
49
|
+
mutable std::unique_ptr<std::mutex> zintMutex = {};
|
|
50
|
+
#endif
|
|
51
|
+
TextMode defaultTextMode = TextMode::HRI;
|
|
52
|
+
int lineCount = 0;
|
|
53
|
+
bool isMirrored = false;
|
|
54
|
+
bool isInverted = false;
|
|
55
|
+
|
|
56
|
+
bool operator==(const BarcodeData& other) const;
|
|
57
|
+
|
|
58
|
+
inline bool isValid() const { return format != BarcodeFormat::None && !content.bytes.empty() && !error; }
|
|
59
|
+
|
|
60
|
+
inline int orientation() const { return narrow_cast<int>(std::lround(position.orientation() * 180 / std::numbers::pi)); }
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
using BarcodesData = std::vector<BarcodeData>;
|
|
64
|
+
|
|
65
|
+
inline BarcodeData LinearBarcode(BarcodeFormat format, const std::string& text, int y, int xStart, int xStop, SymbologyIdentifier si,
|
|
66
|
+
Error error = {}, std::string extra = {})
|
|
67
|
+
{
|
|
68
|
+
return {.content = Content(ByteArray(text), si, CharacterSet::ISO8859_1),
|
|
69
|
+
.error = std::move(error),
|
|
70
|
+
.position = Line(y, xStart, xStop),
|
|
71
|
+
.format = format,
|
|
72
|
+
.extra = std::move(extra)};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
inline BarcodeData MatrixBarcode(DecoderResult&& decodeResult, DetectorResult&& detectorResult, BarcodeFormat format)
|
|
76
|
+
{
|
|
77
|
+
auto extra = std::move(decodeResult).json();
|
|
78
|
+
if (JsonFind(extra, BarcodeExtra::Version).empty() && decodeResult.versionNumber())
|
|
79
|
+
extra += JsonProp(BarcodeExtra::Version, std::to_string(decodeResult.versionNumber()));
|
|
80
|
+
if (JsonFind(extra, BarcodeExtra::ECLevel).empty() && !decodeResult.ecLevel().empty())
|
|
81
|
+
extra += JsonProp(BarcodeExtra::ECLevel, decodeResult.ecLevel());
|
|
82
|
+
|
|
83
|
+
extra += JsonProp(BarcodeExtra::ReaderInit, decodeResult.readerInit());
|
|
84
|
+
|
|
85
|
+
// the BitMatrix stores 'black'/foreground as 0xFF and 'white'/background as 0, but we
|
|
86
|
+
// want the ImageView returned by symbol() to be a standard luminance image (black == 0)
|
|
87
|
+
std::move(detectorResult).bits().flipAll();
|
|
88
|
+
|
|
89
|
+
return {.content = std::move(decodeResult).content(),
|
|
90
|
+
.error = std::move(decodeResult).error(),
|
|
91
|
+
.position = std::move(detectorResult).position(),
|
|
92
|
+
.format = format,
|
|
93
|
+
.extra = std::move(extra),
|
|
94
|
+
.sai = std::move(decodeResult).structuredAppend(),
|
|
95
|
+
.symbol = std::move(detectorResult).bits(),
|
|
96
|
+
.lineCount = decodeResult.lineCount(),
|
|
97
|
+
.isMirrored = decodeResult.isMirrored()};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
} // namespace ZXing
|