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,68 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Nu-book Inc.
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#include "MCBitMatrixParser.h"
|
|
8
|
+
|
|
9
|
+
#include "BitMatrix.h"
|
|
10
|
+
#include "ByteArray.h"
|
|
11
|
+
|
|
12
|
+
#include <array>
|
|
13
|
+
|
|
14
|
+
namespace ZXing::MaxiCode {
|
|
15
|
+
|
|
16
|
+
static const std::array<std::array<int, BitMatrixParser::MATRIX_WIDTH>, BitMatrixParser::MATRIX_HEIGHT> BITNR = {
|
|
17
|
+
121,120,127,126,133,132,139,138,145,144,151,150,157,156,163,162,169,168,175,174,181,180,187,186,193,192,199,198, -2, -2,
|
|
18
|
+
123,122,129,128,135,134,141,140,147,146,153,152,159,158,165,164,171,170,177,176,183,182,189,188,195,194,201,200,816, -3,
|
|
19
|
+
125,124,131,130,137,136,143,142,149,148,155,154,161,160,167,166,173,172,179,178,185,184,191,190,197,196,203,202,818,817,
|
|
20
|
+
283,282,277,276,271,270,265,264,259,258,253,252,247,246,241,240,235,234,229,228,223,222,217,216,211,210,205,204,819, -3,
|
|
21
|
+
285,284,279,278,273,272,267,266,261,260,255,254,249,248,243,242,237,236,231,230,225,224,219,218,213,212,207,206,821,820,
|
|
22
|
+
287,286,281,280,275,274,269,268,263,262,257,256,251,250,245,244,239,238,233,232,227,226,221,220,215,214,209,208,822, -3,
|
|
23
|
+
289,288,295,294,301,300,307,306,313,312,319,318,325,324,331,330,337,336,343,342,349,348,355,354,361,360,367,366,824,823,
|
|
24
|
+
291,290,297,296,303,302,309,308,315,314,321,320,327,326,333,332,339,338,345,344,351,350,357,356,363,362,369,368,825, -3,
|
|
25
|
+
293,292,299,298,305,304,311,310,317,316,323,322,329,328,335,334,341,340,347,346,353,352,359,358,365,364,371,370,827,826,
|
|
26
|
+
409,408,403,402,397,396,391,390, 79, 78, -2, -2, 13, 12, 37, 36, 2, -1, 44, 43,109,108,385,384,379,378,373,372,828, -3,
|
|
27
|
+
411,410,405,404,399,398,393,392, 81, 80, 40, -2, 15, 14, 39, 38, 3, -1, -1, 45,111,110,387,386,381,380,375,374,830,829,
|
|
28
|
+
413,412,407,406,401,400,395,394, 83, 82, 41, -3, -3, -3, -3, -3, 5, 4, 47, 46,113,112,389,388,383,382,377,376,831, -3,
|
|
29
|
+
415,414,421,420,427,426,103,102, 55, 54, 16, -3, -3, -3, -3, -3, -3, -3, 20, 19, 85, 84,433,432,439,438,445,444,833,832,
|
|
30
|
+
417,416,423,422,429,428,105,104, 57, 56, -3, -3, -3, -3, -3, -3, -3, -3, 22, 21, 87, 86,435,434,441,440,447,446,834, -3,
|
|
31
|
+
419,418,425,424,431,430,107,106, 59, 58, -3, -3, -3, -3, -3, -3, -3, -3, -3, 23, 89, 88,437,436,443,442,449,448,836,835,
|
|
32
|
+
481,480,475,474,469,468, 48, -2, 30, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, 0, 53, 52,463,462,457,456,451,450,837, -3,
|
|
33
|
+
483,482,477,476,471,470, 49, -1, -2, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -2, -1,465,464,459,458,453,452,839,838,
|
|
34
|
+
485,484,479,478,473,472, 51, 50, 31, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, 1, -2, 42,467,466,461,460,455,454,840, -3,
|
|
35
|
+
487,486,493,492,499,498, 97, 96, 61, 60, -3, -3, -3, -3, -3, -3, -3, -3, -3, 26, 91, 90,505,504,511,510,517,516,842,841,
|
|
36
|
+
489,488,495,494,501,500, 99, 98, 63, 62, -3, -3, -3, -3, -3, -3, -3, -3, 28, 27, 93, 92,507,506,513,512,519,518,843, -3,
|
|
37
|
+
491,490,497,496,503,502,101,100, 65, 64, 17, -3, -3, -3, -3, -3, -3, -3, 18, 29, 95, 94,509,508,515,514,521,520,845,844,
|
|
38
|
+
559,558,553,552,547,546,541,540, 73, 72, 32, -3, -3, -3, -3, -3, -3, 10, 67, 66,115,114,535,534,529,528,523,522,846, -3,
|
|
39
|
+
561,560,555,554,549,548,543,542, 75, 74, -2, -1, 7, 6, 35, 34, 11, -2, 69, 68,117,116,537,536,531,530,525,524,848,847,
|
|
40
|
+
563,562,557,556,551,550,545,544, 77, 76, -2, 33, 9, 8, 25, 24, -1, -2, 71, 70,119,118,539,538,533,532,527,526,849, -3,
|
|
41
|
+
565,564,571,570,577,576,583,582,589,588,595,594,601,600,607,606,613,612,619,618,625,624,631,630,637,636,643,642,851,850,
|
|
42
|
+
567,566,573,572,579,578,585,584,591,590,597,596,603,602,609,608,615,614,621,620,627,626,633,632,639,638,645,644,852, -3,
|
|
43
|
+
569,568,575,574,581,580,587,586,593,592,599,598,605,604,611,610,617,616,623,622,629,628,635,634,641,640,647,646,854,853,
|
|
44
|
+
727,726,721,720,715,714,709,708,703,702,697,696,691,690,685,684,679,678,673,672,667,666,661,660,655,654,649,648,855, -3,
|
|
45
|
+
729,728,723,722,717,716,711,710,705,704,699,698,693,692,687,686,681,680,675,674,669,668,663,662,657,656,651,650,857,856,
|
|
46
|
+
731,730,725,724,719,718,713,712,707,706,701,700,695,694,689,688,683,682,677,676,671,670,665,664,659,658,653,652,858, -3,
|
|
47
|
+
733,732,739,738,745,744,751,750,757,756,763,762,769,768,775,774,781,780,787,786,793,792,799,798,805,804,811,810,860,859,
|
|
48
|
+
735,734,741,740,747,746,753,752,759,758,765,764,771,770,777,776,783,782,789,788,795,794,801,800,807,806,813,812,861, -3,
|
|
49
|
+
737,736,743,742,749,748,755,754,761,760,767,766,773,772,779,778,785,784,791,790,797,796,803,802,809,808,815,814,863,862,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
ByteArray BitMatrixParser::ReadCodewords(const BitMatrix& image)
|
|
53
|
+
{
|
|
54
|
+
ByteArray result(144);
|
|
55
|
+
int height = image.height();
|
|
56
|
+
int width = image.width();
|
|
57
|
+
for (int y = 0; y < height; y++) {
|
|
58
|
+
for (int x = 0; x < width; x++) {
|
|
59
|
+
int bit = BITNR[y][x];
|
|
60
|
+
if (bit >= 0 && image.get(x, y)) {
|
|
61
|
+
result[bit / 6] |= static_cast<uint8_t>(1 << (5 - (bit % 6)));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
} // namespace ZXing::MaxiCode
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
namespace ZXing {
|
|
10
|
+
|
|
11
|
+
class ByteArray;
|
|
12
|
+
class BitMatrix;
|
|
13
|
+
|
|
14
|
+
namespace MaxiCode {
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @author mike32767
|
|
18
|
+
* @author Manuel Kasten
|
|
19
|
+
*/
|
|
20
|
+
class BitMatrixParser
|
|
21
|
+
{
|
|
22
|
+
public:
|
|
23
|
+
static ByteArray ReadCodewords(const BitMatrix& image);
|
|
24
|
+
|
|
25
|
+
static const int MATRIX_WIDTH = 30;
|
|
26
|
+
static const int MATRIX_HEIGHT = 33;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
} // MaxiCode
|
|
30
|
+
} // ZXing
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Nu-book Inc.
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#include "MCDecoder.h"
|
|
8
|
+
|
|
9
|
+
#include "ByteArray.h"
|
|
10
|
+
#include "CharacterSet.h"
|
|
11
|
+
#include "DecoderResult.h"
|
|
12
|
+
#include "MCBitMatrixParser.h"
|
|
13
|
+
#include "ReedSolomon.h"
|
|
14
|
+
#include "ZXTestSupport.h"
|
|
15
|
+
|
|
16
|
+
#include <algorithm>
|
|
17
|
+
#include <array>
|
|
18
|
+
#include <cstdint>
|
|
19
|
+
#include <string>
|
|
20
|
+
#include <utility>
|
|
21
|
+
#include <vector>
|
|
22
|
+
|
|
23
|
+
namespace ZXing::MaxiCode {
|
|
24
|
+
|
|
25
|
+
static const int ALL = 0;
|
|
26
|
+
static const int EVEN = 1;
|
|
27
|
+
static const int ODD = 2;
|
|
28
|
+
|
|
29
|
+
static bool CorrectErrors(ByteArray& codewordBytes, int start, int dataCodewords, int ecCodewords, int mode)
|
|
30
|
+
{
|
|
31
|
+
int codewords = dataCodewords + ecCodewords;
|
|
32
|
+
|
|
33
|
+
// in EVEN or ODD mode only half the codewords
|
|
34
|
+
int divisor = mode == ALL ? 1 : 2;
|
|
35
|
+
|
|
36
|
+
// First read into an array of ints
|
|
37
|
+
std::vector<int> codewordsInts(codewords / divisor, 0);
|
|
38
|
+
for (int i = 0; i < codewords; i++) {
|
|
39
|
+
if ((mode == ALL) || (i % 2 == (mode - 1)))
|
|
40
|
+
codewordsInts[i / divisor] = codewordBytes[i + start];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (!ReedSolomonDecode(RSField::MaxiCode, codewordsInts, ecCodewords / divisor))
|
|
44
|
+
return false;
|
|
45
|
+
|
|
46
|
+
// Copy back into array of bytes -- only need to worry about the bytes that were data
|
|
47
|
+
// We don't care about errors in the error-correction codewords
|
|
48
|
+
for (int i = 0; i < dataCodewords; i++) {
|
|
49
|
+
if ((mode == ALL) || (i % 2 == (mode - 1)))
|
|
50
|
+
codewordBytes[i + start] = narrow_cast<uint8_t>(codewordsInts[i / divisor]);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* <p>MaxiCodes can encode text or structured information as bits in one of several modes,
|
|
58
|
+
* with multiple character sets in one code. This class decodes the bits back into text.</p>
|
|
59
|
+
*
|
|
60
|
+
* @author mike32767
|
|
61
|
+
* @author Manuel Kasten
|
|
62
|
+
*/
|
|
63
|
+
namespace DecodedBitStreamParser {
|
|
64
|
+
|
|
65
|
+
static const short SHI0 = 0x100;
|
|
66
|
+
static const short SHI1 = 0x101;
|
|
67
|
+
static const short SHI2 = 0x102;
|
|
68
|
+
static const short SHI3 = 0x103;
|
|
69
|
+
static const short SHI4 = 0x104;
|
|
70
|
+
static const short TWSA = 0x105; // two shift A
|
|
71
|
+
static const short TRSA = 0x106; // three shift A
|
|
72
|
+
static const short LCHA = 0x107; // latch A
|
|
73
|
+
static const short LCHB = 0x108; // latch B
|
|
74
|
+
static const short LOCK = 0x109;
|
|
75
|
+
static const short ECI = 0x10A;
|
|
76
|
+
static const short NS = 0x10B;
|
|
77
|
+
static const short PAD = 0x10C;
|
|
78
|
+
|
|
79
|
+
static const char FS = 0x1C;
|
|
80
|
+
static const char GS = 0x1D;
|
|
81
|
+
static const char RS = 0x1E;
|
|
82
|
+
|
|
83
|
+
// clang-format off
|
|
84
|
+
const static std::array<short, 0x40> CHARSETS[] = {
|
|
85
|
+
{ // set 0 (A)
|
|
86
|
+
'\r', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
|
|
87
|
+
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ECI, FS, GS, RS, NS,
|
|
88
|
+
' ', PAD, '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/',
|
|
89
|
+
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', SHI1, SHI2, SHI3, SHI4, LCHB,
|
|
90
|
+
},
|
|
91
|
+
{ // set 1 (B)
|
|
92
|
+
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
|
|
93
|
+
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', ECI, FS, GS, RS, NS,
|
|
94
|
+
'{', PAD, '}', '~', 0x7F, ';', '<', '=', '>', '?', '[', '\\', ']', '^', '_', ' ',
|
|
95
|
+
',', '.', '/', ':', '@', '!', '|', PAD, TWSA, TRSA, PAD, SHI0, SHI2, SHI3, SHI4, LCHA,
|
|
96
|
+
},
|
|
97
|
+
{ // set 2 (C)
|
|
98
|
+
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
|
99
|
+
0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, ECI, FS, GS, RS, NS, // Note that in original code in Java, NS is not there, which seems to be a bug
|
|
100
|
+
0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0xAA, 0xAC, 0xB1, 0xB2, 0xB3, 0xB5, 0xB9, 0xBA, 0xBC, 0xBD, 0xBE,
|
|
101
|
+
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, LCHA, 0x20, LOCK, SHI3, SHI4, LCHB,
|
|
102
|
+
},
|
|
103
|
+
{ // set 3 (D)
|
|
104
|
+
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
|
|
105
|
+
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, ECI, FS, GS, RS, NS,
|
|
106
|
+
0xFB, 0xFC, 0xFD, 0xFE, 0xFF, 0xA1, 0xA8, 0xAB, 0xAF, 0xB0, 0xB4, 0xB7, 0xB8, 0xBB, 0xBF, 0x8A,
|
|
107
|
+
0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, LCHA, 0x20, SHI2, LOCK, SHI4, LCHB,
|
|
108
|
+
},
|
|
109
|
+
{ // set 4 (E)
|
|
110
|
+
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
|
111
|
+
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, ECI, PAD, PAD, 0x1B, NS,
|
|
112
|
+
FS, GS, RS, 0x1F, 0x9F, 0xA0, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA9, 0xAD, 0xAE, 0xB6,
|
|
113
|
+
0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, LCHA, 0x20, SHI2, SHI3, LOCK, LCHB,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
// clang-format on
|
|
117
|
+
|
|
118
|
+
static int GetBit(int bit, const ByteArray& bytes)
|
|
119
|
+
{
|
|
120
|
+
bit--;
|
|
121
|
+
return (bytes[bit / 6] & (1 << (5 - (bit % 6)))) == 0 ? 0 : 1;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
static unsigned int GetInt(const ByteArray& bytes, const ByteArray& x)
|
|
125
|
+
{
|
|
126
|
+
int len = Size(x);
|
|
127
|
+
unsigned int val = 0;
|
|
128
|
+
for (int i = 0; i < len; i++)
|
|
129
|
+
val += GetBit(x[i], bytes) << (len - i - 1);
|
|
130
|
+
|
|
131
|
+
return val;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
static unsigned int GetPostCode2Length(const ByteArray& bytes)
|
|
135
|
+
{
|
|
136
|
+
return std::min(GetInt(bytes, {39, 40, 41, 42, 31, 32}), 9U);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
static std::string GetPostCode2(const ByteArray& bytes)
|
|
140
|
+
{
|
|
141
|
+
unsigned int val = GetInt(bytes,
|
|
142
|
+
{33, 34, 35, 36, 25, 26, 27, 28, 29, 30, 19, 20, 21, 22, 23, 24, 13, 14, 15, 16, 17, 18, 7, 8, 9, 10, 11, 12, 1, 2});
|
|
143
|
+
unsigned int len = GetPostCode2Length(bytes);
|
|
144
|
+
// Pad or truncate to length
|
|
145
|
+
char buf[11]; // 30 bits 0x3FFFFFFF == 1073741823 (10 digits)
|
|
146
|
+
snprintf(buf, sizeof(buf), "%0*d", len, val);
|
|
147
|
+
buf[len] = '\0';
|
|
148
|
+
return buf;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
static std::string GetPostCode3(const ByteArray& bytes)
|
|
152
|
+
{
|
|
153
|
+
return {
|
|
154
|
+
(char) CHARSETS[0].at(GetInt(bytes, { 39, 40, 41, 42, 31, 32 })),
|
|
155
|
+
(char) CHARSETS[0].at(GetInt(bytes, { 33, 34, 35, 36, 25, 26 })),
|
|
156
|
+
(char) CHARSETS[0].at(GetInt(bytes, { 27, 28, 29, 30, 19, 20 })),
|
|
157
|
+
(char) CHARSETS[0].at(GetInt(bytes, { 21, 22, 23, 24, 13, 14 })),
|
|
158
|
+
(char) CHARSETS[0].at(GetInt(bytes, { 15, 16, 17, 18, 7, 8 })),
|
|
159
|
+
(char) CHARSETS[0].at(GetInt(bytes, { 9, 10, 11, 12, 1, 2 })),
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
static unsigned int GetCountry(const ByteArray& bytes)
|
|
164
|
+
{
|
|
165
|
+
return std::min(GetInt(bytes, {53, 54, 43, 44, 45, 46, 47, 48, 37, 38}), 999U);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
static unsigned int GetServiceClass(const ByteArray& bytes)
|
|
169
|
+
{
|
|
170
|
+
return std::min(GetInt(bytes, {55, 56, 57, 58, 59, 60, 49, 50, 51, 52}), 999U);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* See ISO/IEC 16023:2000 Section 4.6 Table 3
|
|
175
|
+
*/
|
|
176
|
+
static ZXing::ECI ParseECIValue(const ByteArray& bytes, int& i)
|
|
177
|
+
{
|
|
178
|
+
int firstByte = bytes[++i];
|
|
179
|
+
if ((firstByte & 0x20) == 0)
|
|
180
|
+
return ZXing::ECI(firstByte);
|
|
181
|
+
|
|
182
|
+
int secondByte = bytes[++i];
|
|
183
|
+
if ((firstByte & 0x10) == 0)
|
|
184
|
+
return ZXing::ECI(((firstByte & 0x0F) << 6) | secondByte);
|
|
185
|
+
|
|
186
|
+
int thirdByte = bytes[++i];
|
|
187
|
+
if ((firstByte & 0x08) == 0)
|
|
188
|
+
return ZXing::ECI(((firstByte & 0x07) << 12) | (secondByte << 6) | thirdByte);
|
|
189
|
+
|
|
190
|
+
int fourthByte = bytes[++i];
|
|
191
|
+
return ZXing::ECI(((firstByte & 0x03) << 18) | (secondByte << 12) | (thirdByte << 6) | fourthByte);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* See ISO/IEC 16023:2000 Section 4.9.1 Table 5
|
|
196
|
+
*/
|
|
197
|
+
static void ParseStructuredAppend(const ByteArray& bytes, int& i, StructuredAppendInfo& sai)
|
|
198
|
+
{
|
|
199
|
+
int byte = bytes[++i];
|
|
200
|
+
sai.index = (byte >> 3) & 0x07;
|
|
201
|
+
sai.count = (byte & 0x07) + 1;
|
|
202
|
+
if (sai.count == 1 || sai.count <= sai.index) // If info doesn't make sense
|
|
203
|
+
sai.count = 0; // Choose to mark count as unknown
|
|
204
|
+
// No id
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
static void GetMessage(const ByteArray& bytes, int start, int len, Content& result, StructuredAppendInfo& sai)
|
|
208
|
+
{
|
|
209
|
+
int shift = -1;
|
|
210
|
+
int set = 0;
|
|
211
|
+
int lastset = 0;
|
|
212
|
+
|
|
213
|
+
for (int i = start; i < start + len; i++) {
|
|
214
|
+
int c = CHARSETS[set].at(bytes[i]);
|
|
215
|
+
switch (c) {
|
|
216
|
+
case LCHA:
|
|
217
|
+
set = 0;
|
|
218
|
+
shift = -1;
|
|
219
|
+
break;
|
|
220
|
+
case LCHB:
|
|
221
|
+
set = 1;
|
|
222
|
+
shift = -1;
|
|
223
|
+
break;
|
|
224
|
+
case SHI0:
|
|
225
|
+
case SHI1:
|
|
226
|
+
case SHI2:
|
|
227
|
+
case SHI3:
|
|
228
|
+
case SHI4:
|
|
229
|
+
lastset = set;
|
|
230
|
+
set = c - SHI0;
|
|
231
|
+
shift = 1;
|
|
232
|
+
break;
|
|
233
|
+
case TWSA:
|
|
234
|
+
lastset = set;
|
|
235
|
+
set = 0;
|
|
236
|
+
shift = 2;
|
|
237
|
+
break;
|
|
238
|
+
case TRSA:
|
|
239
|
+
lastset = set;
|
|
240
|
+
set = 0;
|
|
241
|
+
shift = 3;
|
|
242
|
+
break;
|
|
243
|
+
case NS:
|
|
244
|
+
result.append(
|
|
245
|
+
ToString((bytes[i + 1] << 24) + (bytes[i + 2] << 18) + (bytes[i + 3] << 12) + (bytes[i + 4] << 6) + bytes[i + 5], 9));
|
|
246
|
+
i += 5;
|
|
247
|
+
break;
|
|
248
|
+
case LOCK: shift = -1; break;
|
|
249
|
+
case ECI: result.switchEncoding(ParseECIValue(bytes, i)); break;
|
|
250
|
+
case PAD:
|
|
251
|
+
if (i == start)
|
|
252
|
+
ParseStructuredAppend(bytes, i, sai);
|
|
253
|
+
shift = -1;
|
|
254
|
+
break;
|
|
255
|
+
default: result.push_back(c);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (shift-- == 0)
|
|
259
|
+
set = lastset;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
ZXING_EXPORT_TEST_ONLY
|
|
264
|
+
DecoderResult Decode(ByteArray&& bytes, const int mode)
|
|
265
|
+
{
|
|
266
|
+
Content result;
|
|
267
|
+
result.symbology = {'U', (mode == 2 || mode == 3) ? '1' : '0', 2}; // TODO: No identifier defined for mode 6?
|
|
268
|
+
result.defaultCharset = CharacterSet::ISO8859_1;
|
|
269
|
+
StructuredAppendInfo sai;
|
|
270
|
+
|
|
271
|
+
switch (mode) {
|
|
272
|
+
case 2:
|
|
273
|
+
case 3: {
|
|
274
|
+
auto postcode = mode == 2 ? GetPostCode2(bytes) : GetPostCode3(bytes);
|
|
275
|
+
auto country = ToString(GetCountry(bytes), 3);
|
|
276
|
+
auto service = ToString(GetServiceClass(bytes), 3);
|
|
277
|
+
GetMessage(bytes, 10, 84, result, sai);
|
|
278
|
+
result.insert(result.bytes.asString().starts_with("[)>\u001E01\u001D") ? 9 : 0, // "[)>" + RS + "01" + GS
|
|
279
|
+
postcode + GS + country + GS + service + GS);
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
case 4:
|
|
283
|
+
case 6: GetMessage(bytes, 1, 93, result, sai); break;
|
|
284
|
+
case 5: GetMessage(bytes, 1, 77, result, sai); break;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
return DecoderResult(std::move(result))
|
|
288
|
+
.setEcLevel(std::to_string(mode))
|
|
289
|
+
.setStructuredAppend(sai)
|
|
290
|
+
.setReaderInit(mode == 6);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
} // DecodedBitStreamParser
|
|
294
|
+
|
|
295
|
+
DecoderResult Decode(const BitMatrix& bits)
|
|
296
|
+
{
|
|
297
|
+
ByteArray codewords = BitMatrixParser::ReadCodewords(bits);
|
|
298
|
+
|
|
299
|
+
if (!CorrectErrors(codewords, 0, 10, 10, ALL))
|
|
300
|
+
return ChecksumError();
|
|
301
|
+
|
|
302
|
+
int mode = codewords[0] & 0x0F;
|
|
303
|
+
ByteArray datawords;
|
|
304
|
+
switch (mode) {
|
|
305
|
+
case 2: // Structured Carrier Message (numeric postcode)
|
|
306
|
+
case 3: // Structured Carrier Message (alphanumeric postcode)
|
|
307
|
+
case 4: // Standard Symbol
|
|
308
|
+
case 6: // Reader Programming
|
|
309
|
+
if (CorrectErrors(codewords, 20, 84, 40, EVEN) && CorrectErrors(codewords, 20, 84, 40, ODD))
|
|
310
|
+
datawords.resize(94, 0);
|
|
311
|
+
else
|
|
312
|
+
return ChecksumError();
|
|
313
|
+
break;
|
|
314
|
+
case 5: // Full ECC
|
|
315
|
+
if (CorrectErrors(codewords, 20, 68, 56, EVEN) && CorrectErrors(codewords, 20, 68, 56, ODD))
|
|
316
|
+
datawords.resize(78, 0);
|
|
317
|
+
else
|
|
318
|
+
return ChecksumError();
|
|
319
|
+
break;
|
|
320
|
+
default: return FormatError("Invalid mode");
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
std::copy_n(codewords.begin(), 10, datawords.begin());
|
|
324
|
+
std::copy_n(codewords.begin() + 20, datawords.size() - 10, datawords.begin() + 10);
|
|
325
|
+
|
|
326
|
+
return DecodedBitStreamParser::Decode(std::move(datawords), mode);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
} // namespace ZXing::MaxiCode
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
namespace ZXing {
|
|
10
|
+
|
|
11
|
+
class DecoderResult;
|
|
12
|
+
class BitMatrix;
|
|
13
|
+
|
|
14
|
+
namespace MaxiCode {
|
|
15
|
+
|
|
16
|
+
DecoderResult Decode(const BitMatrix& bits);
|
|
17
|
+
|
|
18
|
+
} // MaxiCode
|
|
19
|
+
} // ZXing
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Nu-book Inc.
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#include "MCReader.h"
|
|
8
|
+
|
|
9
|
+
#include "BinaryBitmap.h"
|
|
10
|
+
#include "BitMatrix.h"
|
|
11
|
+
#include "DecoderResult.h"
|
|
12
|
+
#include "DetectorResult.h"
|
|
13
|
+
#include "MCBitMatrixParser.h"
|
|
14
|
+
#include "MCDecoder.h"
|
|
15
|
+
#include "BarcodeData.h"
|
|
16
|
+
|
|
17
|
+
namespace ZXing::MaxiCode {
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* This method detects a code in a "pure" image -- that is, pure monochrome image
|
|
21
|
+
* which contains only an unrotated, unskewed, image of a code, with some white border
|
|
22
|
+
* around it. This is a specialized method that works exceptionally fast in this special
|
|
23
|
+
* case.
|
|
24
|
+
*/
|
|
25
|
+
static DetectorResult ExtractPureBits(const BitMatrix& image)
|
|
26
|
+
{
|
|
27
|
+
int left, top, width, height;
|
|
28
|
+
if (!image.findBoundingBox(left, top, width, height, BitMatrixParser::MATRIX_WIDTH))
|
|
29
|
+
return {};
|
|
30
|
+
|
|
31
|
+
// Now just read off the bits
|
|
32
|
+
BitMatrix bits(BitMatrixParser::MATRIX_WIDTH, BitMatrixParser::MATRIX_HEIGHT);
|
|
33
|
+
for (int y = 0; y < BitMatrixParser::MATRIX_HEIGHT; y++) {
|
|
34
|
+
int iy = top + (y * height + height / 2) / BitMatrixParser::MATRIX_HEIGHT;
|
|
35
|
+
for (int x = 0; x < BitMatrixParser::MATRIX_WIDTH; x++) {
|
|
36
|
+
int ix = left + (x * width + width / 2 + (y & 0x01) * width / 2) / BitMatrixParser::MATRIX_WIDTH;
|
|
37
|
+
if (image.get(ix, iy)) {
|
|
38
|
+
bits.set(x, y);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return {std::move(bits), Rectangle<PointI>(left, top, width, height)};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
BarcodesData Reader::read(const BinaryBitmap& image, [[maybe_unused]] int maxSymbols) const
|
|
47
|
+
{
|
|
48
|
+
auto binImg = image.getBitMatrix();
|
|
49
|
+
if (binImg == nullptr)
|
|
50
|
+
return {};
|
|
51
|
+
|
|
52
|
+
//TODO: this only works with effectively 'pure' barcodes. Needs proper detector.
|
|
53
|
+
auto detRes = ExtractPureBits(*binImg);
|
|
54
|
+
if (!detRes.isValid())
|
|
55
|
+
return {};
|
|
56
|
+
|
|
57
|
+
DecoderResult decRes = Decode(detRes.bits());
|
|
58
|
+
// TODO: before we can meaningfully return a ChecksumError result, we need to check the center for the presence of the finder pattern
|
|
59
|
+
if (!decRes.isValid())
|
|
60
|
+
return {};
|
|
61
|
+
|
|
62
|
+
return ToVector(MatrixBarcode(std::move(decRes), std::move(detRes), BarcodeFormat::MaxiCode));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
} // namespace ZXing::MaxiCode
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
namespace ZXing::MaxiCode {
|
|
12
|
+
|
|
13
|
+
class Reader : public ZXing::Reader
|
|
14
|
+
{
|
|
15
|
+
public:
|
|
16
|
+
using ZXing::Reader::Reader;
|
|
17
|
+
|
|
18
|
+
BarcodesData read(const BinaryBitmap& image, int maxSymbols) const override;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
} // namespace ZXing::MaxiCode
|
|
@@ -0,0 +1,102 @@
|
|
|
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 "ODCodabarReader.h"
|
|
9
|
+
|
|
10
|
+
#include "ReaderOptions.h"
|
|
11
|
+
#include "BarcodeData.h"
|
|
12
|
+
#include "SymbologyIdentifier.h"
|
|
13
|
+
#include "ZXAlgorithms.h"
|
|
14
|
+
|
|
15
|
+
#include <string>
|
|
16
|
+
#include <memory>
|
|
17
|
+
|
|
18
|
+
namespace ZXing::OneD {
|
|
19
|
+
|
|
20
|
+
static constexpr char ALPHABET[] = "0123456789-$:/.+ABCD";
|
|
21
|
+
|
|
22
|
+
// These represent the encodings of characters, as patterns of wide and narrow bars. The 7 least-significant bits of
|
|
23
|
+
// each int correspond to the pattern of wide and narrow, with 1s representing wide and 0s representing narrow.
|
|
24
|
+
static constexpr int CHARACTER_ENCODINGS[] = {
|
|
25
|
+
0x03, 0x06, 0x09, 0x60, 0x12, 0x42, 0x21, 0x24, 0x30, 0x48, // 0-9
|
|
26
|
+
0x0c, 0x18, 0x45, 0x51, 0x54, 0x15, 0x1A, 0x29, 0x0B, 0x0E, // -$:/.+ABCD
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
static_assert(Size(ALPHABET) == Size(CHARACTER_ENCODINGS), "table size mismatch");
|
|
30
|
+
|
|
31
|
+
// some industries use a checksum standard but this is not part of the original codabar standard
|
|
32
|
+
// for more information see : http://www.mecsw.com/specs/codabar.html
|
|
33
|
+
|
|
34
|
+
// each character has 4 bars and 3 spaces
|
|
35
|
+
constexpr int CHAR_LEN = 7;
|
|
36
|
+
// quiet zone is half the width of a character symbol
|
|
37
|
+
constexpr float QUIET_ZONE_SCALE = 0.5f;
|
|
38
|
+
|
|
39
|
+
// official start and stop symbols are "ABCD"
|
|
40
|
+
// some codabar generator allow the codabar string to be closed by every
|
|
41
|
+
// character. This will cause lots of false positives!
|
|
42
|
+
|
|
43
|
+
bool IsLeftGuard(const PatternView& view, int spaceInPixel)
|
|
44
|
+
{
|
|
45
|
+
#if 0
|
|
46
|
+
return spaceInPixel > view.sum() * QUIET_ZONE_SCALE &&
|
|
47
|
+
Contains({0x1A, 0x29, 0x0B, 0x0E}, RowReader::NarrowWideBitPattern(view));
|
|
48
|
+
#else
|
|
49
|
+
// "ABCD" all start with a narrow bar and have a wide space in the middle and either on 1st or 3rd position.
|
|
50
|
+
// The following check is not completely specific but very fast and the final check happens in isStartOrStopSymbol().
|
|
51
|
+
// Gain over the old check is a 10% - 15% reduction of the total runtime for a Codabar search on Lum input data.
|
|
52
|
+
return spaceInPixel > view[0] * 4 && view[0] < view[3] && view[1] + view[5] > view[3]
|
|
53
|
+
&& spaceInPixel > view.sum() * QUIET_ZONE_SCALE;
|
|
54
|
+
#endif
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
BarcodeData CodabarReader::decodePattern(int rowNumber, PatternView& next, std::unique_ptr<DecodingState>&) const
|
|
58
|
+
{
|
|
59
|
+
// minimal number of characters that must be present (including start, stop and checksum characters)
|
|
60
|
+
// absolute minimum would be 2 (meaning 0 'content'). everything below 4 produces too many false
|
|
61
|
+
// positives.
|
|
62
|
+
const int minCharCount = 4;
|
|
63
|
+
auto isStartOrStopSymbol = [](char c) { return 'A' <= c && c <= 'D'; };
|
|
64
|
+
|
|
65
|
+
next = FindLeftGuard<CHAR_LEN>(next, minCharCount * CHAR_LEN, IsLeftGuard);
|
|
66
|
+
if (!next.isValid())
|
|
67
|
+
return {};
|
|
68
|
+
|
|
69
|
+
int xStart = next.pixelsInFront();
|
|
70
|
+
int maxInterCharacterSpace = next.sum() / 2; // spec actually says 1 narrow space, width/2 is about 4
|
|
71
|
+
|
|
72
|
+
std::string txt;
|
|
73
|
+
txt.reserve(20);
|
|
74
|
+
txt += DecodeNarrowWidePattern(next, CHARACTER_ENCODINGS, ALPHABET); // read off the start pattern
|
|
75
|
+
|
|
76
|
+
if (!isStartOrStopSymbol(txt.back()))
|
|
77
|
+
return {};
|
|
78
|
+
|
|
79
|
+
do {
|
|
80
|
+
// check remaining input width and inter-character space
|
|
81
|
+
if (!next.skipSymbol() || !next.skipSingle(maxInterCharacterSpace))
|
|
82
|
+
return {};
|
|
83
|
+
|
|
84
|
+
txt += DecodeNarrowWidePattern(next, CHARACTER_ENCODINGS, ALPHABET);
|
|
85
|
+
if (txt.back() == 0)
|
|
86
|
+
return {};
|
|
87
|
+
} while (!isStartOrStopSymbol(txt.back()));
|
|
88
|
+
|
|
89
|
+
// next now points to the last decoded symbol
|
|
90
|
+
// check txt length and whitespace after the last char. See also FindStartPattern.
|
|
91
|
+
if (Size(txt) < minCharCount || !next.hasQuietZoneAfter(QUIET_ZONE_SCALE))
|
|
92
|
+
return {};
|
|
93
|
+
|
|
94
|
+
// symbology identifier ISO/IEC 15424:2008 4.4.9
|
|
95
|
+
// if checksum processing were implemented and checksum present and stripped then modifier would be 4
|
|
96
|
+
SymbologyIdentifier symbologyIdentifier = {'F', '0'};
|
|
97
|
+
|
|
98
|
+
int xStop = next.pixelsTillEnd();
|
|
99
|
+
return LinearBarcode(BarcodeFormat::Codabar, txt, rowNumber, xStart, xStop, symbologyIdentifier);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
} // namespace ZXing::OneD
|
|
@@ -0,0 +1,21 @@
|
|
|
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 "ODRowReader.h"
|
|
10
|
+
|
|
11
|
+
namespace ZXing::OneD {
|
|
12
|
+
|
|
13
|
+
class CodabarReader : public RowReader
|
|
14
|
+
{
|
|
15
|
+
public:
|
|
16
|
+
using RowReader::RowReader;
|
|
17
|
+
|
|
18
|
+
BarcodeData decodePattern(int rowNumber, PatternView& next, std::unique_ptr<DecodingState>& state) const override;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
} // namespace ZXing::OneD
|