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,333 @@
|
|
|
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
|
+
#include "PDFReader.h"
|
|
9
|
+
|
|
10
|
+
#include "BarcodeData.h"
|
|
11
|
+
#include "BinaryBitmap.h"
|
|
12
|
+
#include "BitArray.h"
|
|
13
|
+
#include "BitMatrixCursor.h"
|
|
14
|
+
#include "DecoderResult.h"
|
|
15
|
+
#include "DetectorResult.h"
|
|
16
|
+
#include "PDFCodewordDecoder.h"
|
|
17
|
+
#include "PDFCustomData.h"
|
|
18
|
+
#include "PDFDetector.h"
|
|
19
|
+
#include "PDFScanningDecoder.h"
|
|
20
|
+
#include "Pattern.h"
|
|
21
|
+
#include "ReaderOptions.h"
|
|
22
|
+
|
|
23
|
+
#include <algorithm>
|
|
24
|
+
#include <cstdlib>
|
|
25
|
+
#include <limits>
|
|
26
|
+
#include <utility>
|
|
27
|
+
#include <vector>
|
|
28
|
+
|
|
29
|
+
#ifdef PRINT_DEBUG
|
|
30
|
+
#include "BitMatrixIO.h"
|
|
31
|
+
#include <cstdio>
|
|
32
|
+
#endif
|
|
33
|
+
|
|
34
|
+
namespace ZXing {
|
|
35
|
+
namespace Pdf417 {
|
|
36
|
+
|
|
37
|
+
static const int MODULES_IN_STOP_PATTERN = 18;
|
|
38
|
+
|
|
39
|
+
static int GetMinWidth(const Nullable<ResultPoint>& p1, const Nullable<ResultPoint>& p2)
|
|
40
|
+
{
|
|
41
|
+
if (p1 == nullptr || p2 == nullptr) {
|
|
42
|
+
// the division prevents an integer overflow (see below). 120 million is still sufficiently large.
|
|
43
|
+
return std::numeric_limits<int>::max() / CodewordDecoder::MODULES_IN_CODEWORD;
|
|
44
|
+
}
|
|
45
|
+
return std::abs(static_cast<int>(p1.value().x()) - static_cast<int>(p2.value().x()));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static int GetMinCodewordWidth(const std::array<Nullable<ResultPoint>, 8>& p)
|
|
49
|
+
{
|
|
50
|
+
return std::min(std::min(GetMinWidth(p[0], p[4]), GetMinWidth(p[6], p[2]) * CodewordDecoder::MODULES_IN_CODEWORD / MODULES_IN_STOP_PATTERN),
|
|
51
|
+
std::min(GetMinWidth(p[1], p[5]), GetMinWidth(p[7], p[3]) * CodewordDecoder::MODULES_IN_CODEWORD / MODULES_IN_STOP_PATTERN));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static int GetMaxWidth(const Nullable<ResultPoint>& p1, const Nullable<ResultPoint>& p2)
|
|
55
|
+
{
|
|
56
|
+
if (p1 == nullptr || p2 == nullptr) {
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
|
59
|
+
return std::abs(static_cast<int>(p1.value().x()) - static_cast<int>(p2.value().x()));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
static int GetMaxCodewordWidth(const std::array<Nullable<ResultPoint>, 8>& p)
|
|
63
|
+
{
|
|
64
|
+
return std::max(std::max(GetMaxWidth(p[0], p[4]), GetMaxWidth(p[6], p[2]) * CodewordDecoder::MODULES_IN_CODEWORD / MODULES_IN_STOP_PATTERN),
|
|
65
|
+
std::max(GetMaxWidth(p[1], p[5]), GetMaxWidth(p[7], p[3]) * CodewordDecoder::MODULES_IN_CODEWORD / MODULES_IN_STOP_PATTERN));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static BarcodesData DoDecode(const BinaryBitmap& image, bool multiple, bool tryRotate, bool returnErrors)
|
|
69
|
+
{
|
|
70
|
+
Detector::Result detectorResult = Detector::Detect(image, multiple, tryRotate);
|
|
71
|
+
if (detectorResult.points.empty())
|
|
72
|
+
return {};
|
|
73
|
+
|
|
74
|
+
auto rotate = [res = detectorResult](PointI p) {
|
|
75
|
+
switch(res.rotation) {
|
|
76
|
+
case 90: return PointI(res.bits->height() - p.y - 1, p.x);
|
|
77
|
+
case 180: return PointI(res.bits->width() - p.x - 1, res.bits->height() - p.y - 1);
|
|
78
|
+
case 270: return PointI(p.y, res.bits->width() - p.x - 1);
|
|
79
|
+
}
|
|
80
|
+
return p;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
BarcodesData res;
|
|
84
|
+
for (const auto& points : detectorResult.points) {
|
|
85
|
+
DecoderResult decoderResult =
|
|
86
|
+
ScanningDecoder::Decode(*detectorResult.bits, points[4], points[5], points[6], points[7],
|
|
87
|
+
GetMinCodewordWidth(points), GetMaxCodewordWidth(points));
|
|
88
|
+
if (decoderResult.isValid(returnErrors)) {
|
|
89
|
+
auto customData = std::static_pointer_cast<PDF417CustomData>(decoderResult.customData());
|
|
90
|
+
auto point = [&](int i) {
|
|
91
|
+
if (points[i].hasValue() || i < 2 || !customData)
|
|
92
|
+
return rotate(PointI(points[i].value()));
|
|
93
|
+
else {
|
|
94
|
+
auto p = rotate(PointI(points[i - 2].value()) + PointI(customData->approxSymbolWidth, 0));
|
|
95
|
+
p.x = std::clamp(p.x, 0, image.width() - 1);
|
|
96
|
+
p.y = std::clamp(p.y, 0, image.height() - 1);
|
|
97
|
+
return p;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
if (customData) // might be nullptr if e.g. in case of a FormatError
|
|
101
|
+
decoderResult
|
|
102
|
+
.addExtra("Sender", customData->sender)
|
|
103
|
+
.addExtra("Addressee", customData->addressee)
|
|
104
|
+
.addExtra("FileId", customData->fileId)
|
|
105
|
+
.addExtra("FileName", customData->fileName)
|
|
106
|
+
.addExtra("FileSize", customData->fileSize, int64_t(-1))
|
|
107
|
+
.addExtra("Timestamp", customData->timestamp, int64_t(-1))
|
|
108
|
+
.addExtra("Checksum", customData->checksum, -1)
|
|
109
|
+
;
|
|
110
|
+
res.emplace_back(MatrixBarcode(std::move(decoderResult), DetectorResult{{}, {point(0), point(2), point(3), point(1)}},
|
|
111
|
+
BarcodeFormat::PDF417));
|
|
112
|
+
if (!multiple)
|
|
113
|
+
return res;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return res;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// new implementation (only for isPure use case atm.)
|
|
120
|
+
|
|
121
|
+
using Pattern417 = std::array<uint16_t, 8>;
|
|
122
|
+
|
|
123
|
+
struct CodeWord
|
|
124
|
+
{
|
|
125
|
+
int cluster = -1;
|
|
126
|
+
int code = -1;
|
|
127
|
+
operator bool() const noexcept { return code != -1; }
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
struct SymbolInfo
|
|
131
|
+
{
|
|
132
|
+
int width = 0, height = 0;
|
|
133
|
+
int nRows = 0, nCols = 0, firstRow = -1, lastRow = -1;
|
|
134
|
+
int ecLevel = -1;
|
|
135
|
+
int colWidth = 0;
|
|
136
|
+
float rowHeight = 0;
|
|
137
|
+
operator bool() const noexcept { return nRows >= 3 && nCols >= 1 && ecLevel != -1; }
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
template<typename POINT>
|
|
141
|
+
CodeWord ReadCodeWord(BitMatrixCursor<POINT>& cur, int expectedCluster = -1)
|
|
142
|
+
{
|
|
143
|
+
auto readCodeWord = [expectedCluster](auto& cur) -> CodeWord {
|
|
144
|
+
auto np = NormalizedPattern<8, 17>(cur.template readPattern<Pattern417>());
|
|
145
|
+
int cluster = (np[0] - np[2] + np[4] - np[6] + 9) % 9;
|
|
146
|
+
int code = expectedCluster == -1 || cluster == expectedCluster ? CodewordDecoder::GetCodeword(ToInt(np)) : -1;
|
|
147
|
+
|
|
148
|
+
return {cluster, code};
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
auto curBackup = cur;
|
|
152
|
+
auto cw = readCodeWord(cur);
|
|
153
|
+
if (!cw) {
|
|
154
|
+
for (auto offset : {curBackup.left(), curBackup.right()}) {
|
|
155
|
+
auto curAlt = curBackup.movedBy(offset);
|
|
156
|
+
if (!curAlt.isIn()) // curBackup might be the first or last image row
|
|
157
|
+
continue;
|
|
158
|
+
if (auto cwAlt = readCodeWord(curAlt)) {
|
|
159
|
+
cur = curAlt;
|
|
160
|
+
return cwAlt;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return cw;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
static int Row(CodeWord rowIndicator)
|
|
168
|
+
{
|
|
169
|
+
return (rowIndicator.code / 30) * 3 + rowIndicator.cluster / 3;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
constexpr FixedPattern<8, 17> START_PATTERN = { 8, 1, 1, 1, 1, 1, 1, 3 };
|
|
173
|
+
|
|
174
|
+
#ifndef PRINT_DEBUG
|
|
175
|
+
#define printf(...){}
|
|
176
|
+
#endif
|
|
177
|
+
|
|
178
|
+
template<typename POINT>
|
|
179
|
+
SymbolInfo ReadSymbolInfo(BitMatrixCursor<POINT> topCur, POINT rowSkip, int colWidth, int width, int height)
|
|
180
|
+
{
|
|
181
|
+
SymbolInfo res = {width, height};
|
|
182
|
+
res.colWidth = colWidth;
|
|
183
|
+
int clusterMask = 0;
|
|
184
|
+
int rows0 = 0, rows1 = 0; // Suppress GNUC -Wmaybe-uninitialized
|
|
185
|
+
|
|
186
|
+
topCur.p += .5f * rowSkip;
|
|
187
|
+
|
|
188
|
+
for (auto startCur = topCur; clusterMask != 0b111 && maxAbsComponent(topCur.p - startCur.p) < height / 2; startCur.p += rowSkip) {
|
|
189
|
+
auto cur = startCur;
|
|
190
|
+
if (!IsPattern(cur.template readPatternFromBlack<Pattern417>(1, colWidth + 2), START_PATTERN))
|
|
191
|
+
break;
|
|
192
|
+
auto cw = ReadCodeWord(cur);
|
|
193
|
+
#ifdef PRINT_DEBUG
|
|
194
|
+
printf("%3dx%3d:%2d: %4d.%d \n", int(cur.p.x), int(cur.p.y), Row(cw), cw.code, cw.cluster);
|
|
195
|
+
fflush(stdout);
|
|
196
|
+
#endif
|
|
197
|
+
if (!cw)
|
|
198
|
+
continue;
|
|
199
|
+
if (res.firstRow == -1)
|
|
200
|
+
res.firstRow = Row(cw);
|
|
201
|
+
switch (cw.cluster) {
|
|
202
|
+
case 0: rows0 = cw.code % 30; break;
|
|
203
|
+
case 3: rows1 = cw.code % 3, res.ecLevel = (cw.code % 30) / 3; break;
|
|
204
|
+
case 6: res.nCols = (cw.code % 30) + 1; break;
|
|
205
|
+
default: continue;
|
|
206
|
+
}
|
|
207
|
+
clusterMask |= (1 << cw.cluster / 3);
|
|
208
|
+
}
|
|
209
|
+
if ((clusterMask & 0b11) == 0b11)
|
|
210
|
+
res.nRows = 3 * rows0 + rows1 + 1;
|
|
211
|
+
return res;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
template<typename POINT>
|
|
215
|
+
SymbolInfo DetectSymbol(BitMatrixCursor<POINT> topCur, int width, int height)
|
|
216
|
+
{
|
|
217
|
+
auto pat = topCur.movedBy(height / 2 * topCur.right()).template readPatternFromBlack<Pattern417>(1, width / 3);
|
|
218
|
+
if (!IsPattern(pat, START_PATTERN))
|
|
219
|
+
return {};
|
|
220
|
+
int colWidth = Reduce(pat);
|
|
221
|
+
auto rowSkip = std::max(colWidth / 17.f, 1.f) * bresenhamDirection(topCur.right());
|
|
222
|
+
auto botCur = topCur.movedBy((height - 1) * topCur.right());
|
|
223
|
+
|
|
224
|
+
auto topSI = ReadSymbolInfo(topCur, rowSkip, colWidth, width, height);
|
|
225
|
+
auto botSI = ReadSymbolInfo(botCur, -rowSkip, colWidth, width, height);
|
|
226
|
+
|
|
227
|
+
SymbolInfo res = topSI;
|
|
228
|
+
res.lastRow = botSI.firstRow;
|
|
229
|
+
res.rowHeight = float(height) / (std::abs(res.lastRow - res.firstRow) + 1);
|
|
230
|
+
if (topSI.nCols != botSI.nCols)
|
|
231
|
+
// if there is something fishy with the number of cols (aliasing), guess them from the width
|
|
232
|
+
res.nCols = (width + res.colWidth / 2) / res.colWidth - 4;
|
|
233
|
+
|
|
234
|
+
return res;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
template<typename POINT>
|
|
238
|
+
std::vector<int> ReadCodeWords(BitMatrixCursor<POINT> topCur, SymbolInfo info)
|
|
239
|
+
{
|
|
240
|
+
printf("rows: %d, cols: %d, rowHeight: %.1f, colWidth: %d, firstRow: %d, lastRow: %d, ecLevel: %d\n", info.nRows,
|
|
241
|
+
info.nCols, info.rowHeight, info.colWidth, info.firstRow, info.lastRow, info.ecLevel);
|
|
242
|
+
auto print = [](CodeWord c [[maybe_unused]]) { printf("%4d.%d ", c.code, c.cluster); };
|
|
243
|
+
|
|
244
|
+
auto rowSkip = topCur.right();
|
|
245
|
+
if (info.firstRow > info.lastRow) {
|
|
246
|
+
topCur.p += (info.height - 1) * rowSkip;
|
|
247
|
+
rowSkip = -rowSkip;
|
|
248
|
+
std::swap(info.firstRow, info.lastRow);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
int maxColWidth = info.colWidth * 3 / 2;
|
|
252
|
+
std::vector<int> codeWords(info.nRows * info.nCols, -1);
|
|
253
|
+
for (int row = info.firstRow; row < std::min(info.nRows, info.lastRow + 1); ++row) {
|
|
254
|
+
int cluster = (row % 3) * 3;
|
|
255
|
+
auto cur = topCur.movedBy(int((row - info.firstRow + 0.5f) * info.rowHeight) * rowSkip);
|
|
256
|
+
// skip start pattern
|
|
257
|
+
cur.stepToEdge(8 + cur.isWhite(), maxColWidth);
|
|
258
|
+
// read off left row indicator column
|
|
259
|
+
auto cw [[maybe_unused]] = ReadCodeWord(cur, cluster);
|
|
260
|
+
printf("%3dx%3d:%2d: ", int(cur.p.x), int(cur.p.y), Row(cw));
|
|
261
|
+
print(cw);
|
|
262
|
+
|
|
263
|
+
for (int col = 0; col < info.nCols && cur.isIn(); ++col) {
|
|
264
|
+
auto cw = ReadCodeWord(cur, cluster);
|
|
265
|
+
codeWords[row * info.nCols + col] = cw.code;
|
|
266
|
+
print(cw);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
#ifdef PRINT_DEBUG
|
|
270
|
+
print(ReadCodeWord(cur));
|
|
271
|
+
printf("\n");
|
|
272
|
+
fflush(stdout);
|
|
273
|
+
#endif
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return codeWords;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
static BarcodeData DecodePure(const BinaryBitmap& image_)
|
|
280
|
+
{
|
|
281
|
+
auto pimage = image_.getBitMatrix();
|
|
282
|
+
if (!pimage)
|
|
283
|
+
return {};
|
|
284
|
+
auto& image = *pimage;
|
|
285
|
+
|
|
286
|
+
#ifdef PRINT_DEBUG
|
|
287
|
+
SaveAsPBM(image, "weg.pbm");
|
|
288
|
+
#endif
|
|
289
|
+
|
|
290
|
+
int left, top, width, height;
|
|
291
|
+
if (!image.findBoundingBox(left, top, width, height, 9) || (width < 3 * 17 && height < 3 * 17))
|
|
292
|
+
return {};
|
|
293
|
+
|
|
294
|
+
// counter intuitively, using a floating point cursor is about twice as fast an integer one (on an AVX architecture)
|
|
295
|
+
BitMatrixCursorF cur(image, centered(PointI{left, top}), PointF{1, 0});
|
|
296
|
+
SymbolInfo info;
|
|
297
|
+
|
|
298
|
+
// try all 4 orientations
|
|
299
|
+
for (int a = 0; a < 4; ++a) {
|
|
300
|
+
info = DetectSymbol(cur, width, height);
|
|
301
|
+
if (info)
|
|
302
|
+
break;
|
|
303
|
+
cur.step(width - 1);
|
|
304
|
+
cur.turnRight();
|
|
305
|
+
std::swap(width, height);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (!info)
|
|
309
|
+
return {};
|
|
310
|
+
|
|
311
|
+
auto codeWords = ReadCodeWords(cur, info);
|
|
312
|
+
|
|
313
|
+
auto res = DecodeCodewords(codeWords, NumECCodeWords(info.ecLevel));
|
|
314
|
+
|
|
315
|
+
return MatrixBarcode(std::move(res), {{}, Rectangle<PointI>(left, top, width, height)}, BarcodeFormat::PDF417);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
BarcodesData Reader::read(const BinaryBitmap& image, [[maybe_unused]] int maxSymbols) const
|
|
319
|
+
{
|
|
320
|
+
if (_opts.isPure()) {
|
|
321
|
+
auto res = DecodePure(image);
|
|
322
|
+
if (res.error != Error::Checksum)
|
|
323
|
+
return ToVector(std::move(res));
|
|
324
|
+
// This falls through and tries the non-pure code path if we have a checksum error. This approach is
|
|
325
|
+
// currently the best option to deal with 'aliased' input like e.g. 03-aliased.png
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// TODO: respect maxSymbols
|
|
329
|
+
return DoDecode(image, true, _opts.tryRotate(), _opts.returnErrors());
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
} // Pdf417
|
|
333
|
+
} // ZXing
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Nu-book Inc.
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#pragma once
|
|
8
|
+
|
|
9
|
+
#include "Reader.h"
|
|
10
|
+
|
|
11
|
+
#include <list>
|
|
12
|
+
|
|
13
|
+
namespace ZXing::Pdf417 {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* This implementation can detect and decode PDF417 codes in an image.
|
|
17
|
+
*
|
|
18
|
+
* @author Guenther Grau
|
|
19
|
+
*/
|
|
20
|
+
class Reader : public ZXing::Reader
|
|
21
|
+
{
|
|
22
|
+
public:
|
|
23
|
+
using ZXing::Reader::Reader;
|
|
24
|
+
|
|
25
|
+
BarcodesData read(const BinaryBitmap& image, int maxSymbols) const override;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
} // namespace ZXing::Pdf417
|