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,276 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Nu-book Inc.
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#include "WhiteRectDetector.h"
|
|
8
|
+
|
|
9
|
+
#include "BitMatrix.h"
|
|
10
|
+
#include "BitMatrixCursor.h"
|
|
11
|
+
#include "ResultPoint.h"
|
|
12
|
+
|
|
13
|
+
namespace ZXing {
|
|
14
|
+
|
|
15
|
+
static const int INIT_SIZE = 10;
|
|
16
|
+
static const int CORR = 1;
|
|
17
|
+
|
|
18
|
+
bool DetectWhiteRect(const BitMatrix& image, ResultPoint& p0, ResultPoint& p1, ResultPoint& p2, ResultPoint& p3)
|
|
19
|
+
{
|
|
20
|
+
return DetectWhiteRect(image, INIT_SIZE, image.width() / 2, image.height() / 2, p0, p1, p2, p3);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Determines whether a segment contains a black point
|
|
25
|
+
*
|
|
26
|
+
* @param a min value of the scanned coordinate
|
|
27
|
+
* @param b max value of the scanned coordinate
|
|
28
|
+
* @param fixed value of fixed coordinate
|
|
29
|
+
* @param horizontal set to true if scan must be horizontal, false if vertical
|
|
30
|
+
* @return true if a black point has been found, else false.
|
|
31
|
+
*/
|
|
32
|
+
static bool ContainsBlackPoint(const BitMatrix& image, int a, int b, int fixed, bool horizontal) {
|
|
33
|
+
|
|
34
|
+
a = std::max(a, 0);
|
|
35
|
+
if (horizontal) {
|
|
36
|
+
if (fixed < 0 || fixed >= image.height())
|
|
37
|
+
return false;
|
|
38
|
+
b = std::min(b, image.width() - 1);
|
|
39
|
+
for (int x = a; x <= b; x++) {
|
|
40
|
+
if (image.get(x, fixed)) {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
if (fixed < 0 || fixed >= image.width())
|
|
47
|
+
return false;
|
|
48
|
+
b = std::min(b, image.height() - 1);
|
|
49
|
+
for (int y = a; y <= b; y++) {
|
|
50
|
+
if (image.get(fixed, y)) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
static bool GetBlackPointOnSegment(const BitMatrix& image, int aX, int aY, int bX, int bY, ResultPoint& result)
|
|
60
|
+
{
|
|
61
|
+
PointF a(aX, aY), b(bX, bY);
|
|
62
|
+
BitMatrixCursorF cur(image, a, b - a);
|
|
63
|
+
|
|
64
|
+
auto dist = std::lround(distance(a, b) / length(cur.d));
|
|
65
|
+
|
|
66
|
+
for (int i = 0; i < dist; i++) {
|
|
67
|
+
if (cur.isBlack()) {
|
|
68
|
+
result = cur.p;
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
cur.step();
|
|
72
|
+
}
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* recenters the points of a constant distance towards the center
|
|
78
|
+
*
|
|
79
|
+
* p0 to p3 describing the corners of the rectangular
|
|
80
|
+
* region. The first and last points are opposed on the diagonal, as
|
|
81
|
+
* are the second and third. The first point will be the topmost
|
|
82
|
+
* point and the last, the bottommost. The second point will be
|
|
83
|
+
* leftmost and the third, the rightmost
|
|
84
|
+
*
|
|
85
|
+
* @param y bottom most point
|
|
86
|
+
* @param z left most point
|
|
87
|
+
* @param x right most point
|
|
88
|
+
* @param t top most point
|
|
89
|
+
*/
|
|
90
|
+
static void CenterEdges(const ResultPoint& y, const ResultPoint& z, const ResultPoint& x, const ResultPoint& t, int width, ResultPoint& p0, ResultPoint& p1, ResultPoint& p2, ResultPoint& p3)
|
|
91
|
+
{
|
|
92
|
+
//
|
|
93
|
+
// t t
|
|
94
|
+
// z x
|
|
95
|
+
// x OR z
|
|
96
|
+
// y y
|
|
97
|
+
//
|
|
98
|
+
|
|
99
|
+
float yi = y.x();
|
|
100
|
+
float yj = y.y();
|
|
101
|
+
float zi = z.x();
|
|
102
|
+
float zj = z.y();
|
|
103
|
+
float xi = x.x();
|
|
104
|
+
float xj = x.y();
|
|
105
|
+
float ti = t.x();
|
|
106
|
+
float tj = t.y();
|
|
107
|
+
|
|
108
|
+
if (yi < width / 2.0f) {
|
|
109
|
+
p0 = ResultPoint(ti - CORR, tj + CORR);
|
|
110
|
+
p1 = ResultPoint(zi + CORR, zj + CORR);
|
|
111
|
+
p2 = ResultPoint(xi - CORR, xj - CORR);
|
|
112
|
+
p3 = ResultPoint(yi + CORR, yj - CORR);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
p0 = ResultPoint(ti + CORR, tj + CORR);
|
|
116
|
+
p1 = ResultPoint(zi + CORR, zj - CORR);
|
|
117
|
+
p2 = ResultPoint(xi - CORR, xj + CORR);
|
|
118
|
+
p3 = ResultPoint(yi - CORR, yj - CORR);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
bool DetectWhiteRect(const BitMatrix& image, int initSize, int x, int y, ResultPoint& p0, ResultPoint& p1,
|
|
123
|
+
ResultPoint& p2, ResultPoint& p3)
|
|
124
|
+
{
|
|
125
|
+
int height = image.height();
|
|
126
|
+
int width = image.width();
|
|
127
|
+
int halfsize = initSize / 2;
|
|
128
|
+
int left = x - halfsize;
|
|
129
|
+
int right = x + halfsize;
|
|
130
|
+
int up = y - halfsize;
|
|
131
|
+
int down = y + halfsize;
|
|
132
|
+
if (up < 0 || left < 0 || down >= height || right >= width) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
bool aBlackPointFoundOnBorder = true;
|
|
137
|
+
bool atLeastOneBlackPointFoundOnBorder = false;
|
|
138
|
+
|
|
139
|
+
bool atLeastOneBlackPointFoundOnRight = false;
|
|
140
|
+
bool atLeastOneBlackPointFoundOnBottom = false;
|
|
141
|
+
bool atLeastOneBlackPointFoundOnLeft = false;
|
|
142
|
+
bool atLeastOneBlackPointFoundOnTop = false;
|
|
143
|
+
|
|
144
|
+
while (aBlackPointFoundOnBorder) {
|
|
145
|
+
|
|
146
|
+
aBlackPointFoundOnBorder = false;
|
|
147
|
+
|
|
148
|
+
// .....
|
|
149
|
+
// . |
|
|
150
|
+
// .....
|
|
151
|
+
bool rightBorderNotWhite = true;
|
|
152
|
+
while ((rightBorderNotWhite || !atLeastOneBlackPointFoundOnRight) && right < width) {
|
|
153
|
+
rightBorderNotWhite = ContainsBlackPoint(image, up, down, right, false);
|
|
154
|
+
if (rightBorderNotWhite) {
|
|
155
|
+
right++;
|
|
156
|
+
aBlackPointFoundOnBorder = true;
|
|
157
|
+
atLeastOneBlackPointFoundOnRight = true;
|
|
158
|
+
}
|
|
159
|
+
else if (!atLeastOneBlackPointFoundOnRight) {
|
|
160
|
+
right++;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// .....
|
|
165
|
+
// . .
|
|
166
|
+
// .___.
|
|
167
|
+
bool bottomBorderNotWhite = true;
|
|
168
|
+
while ((bottomBorderNotWhite || !atLeastOneBlackPointFoundOnBottom) && down < height) {
|
|
169
|
+
bottomBorderNotWhite = ContainsBlackPoint(image, left, right, down, true);
|
|
170
|
+
if (bottomBorderNotWhite) {
|
|
171
|
+
down++;
|
|
172
|
+
aBlackPointFoundOnBorder = true;
|
|
173
|
+
atLeastOneBlackPointFoundOnBottom = true;
|
|
174
|
+
}
|
|
175
|
+
else if (!atLeastOneBlackPointFoundOnBottom) {
|
|
176
|
+
down++;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// .....
|
|
181
|
+
// | .
|
|
182
|
+
// .....
|
|
183
|
+
bool leftBorderNotWhite = true;
|
|
184
|
+
while ((leftBorderNotWhite || !atLeastOneBlackPointFoundOnLeft) && left >= 0) {
|
|
185
|
+
leftBorderNotWhite = ContainsBlackPoint(image, up, down, left, false);
|
|
186
|
+
if (leftBorderNotWhite) {
|
|
187
|
+
left--;
|
|
188
|
+
aBlackPointFoundOnBorder = true;
|
|
189
|
+
atLeastOneBlackPointFoundOnLeft = true;
|
|
190
|
+
}
|
|
191
|
+
else if (!atLeastOneBlackPointFoundOnLeft) {
|
|
192
|
+
left--;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// .___.
|
|
197
|
+
// . .
|
|
198
|
+
// .....
|
|
199
|
+
bool topBorderNotWhite = true;
|
|
200
|
+
while ((topBorderNotWhite || !atLeastOneBlackPointFoundOnTop) && up >= 0) {
|
|
201
|
+
topBorderNotWhite = ContainsBlackPoint(image, left, right, up, true);
|
|
202
|
+
if (topBorderNotWhite) {
|
|
203
|
+
up--;
|
|
204
|
+
aBlackPointFoundOnBorder = true;
|
|
205
|
+
atLeastOneBlackPointFoundOnTop = true;
|
|
206
|
+
}
|
|
207
|
+
else if (!atLeastOneBlackPointFoundOnTop) {
|
|
208
|
+
up--;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (aBlackPointFoundOnBorder) {
|
|
213
|
+
atLeastOneBlackPointFoundOnBorder = true;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (up < 0 || left < 0 || down >= height || right >= width)
|
|
219
|
+
return false;
|
|
220
|
+
|
|
221
|
+
if (atLeastOneBlackPointFoundOnBorder) {
|
|
222
|
+
|
|
223
|
+
int maxSize = right - left;
|
|
224
|
+
|
|
225
|
+
ResultPoint z;
|
|
226
|
+
bool found = false;
|
|
227
|
+
for (int i = 1; !found && i < maxSize; i++) {
|
|
228
|
+
found = GetBlackPointOnSegment(image, left, down - i, left + i, down, z);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (!found) {
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
ResultPoint t;
|
|
236
|
+
found = false;
|
|
237
|
+
//go down right
|
|
238
|
+
for (int i = 1; !found && i < maxSize; i++) {
|
|
239
|
+
found = GetBlackPointOnSegment(image, left, up + i, left + i, up, t);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (!found) {
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
ResultPoint x;
|
|
247
|
+
found = false;
|
|
248
|
+
//go down left
|
|
249
|
+
for (int i = 1; !found && i < maxSize; i++) {
|
|
250
|
+
found = GetBlackPointOnSegment(image, right, up + i, right - i, up, x);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (!found) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
ResultPoint y;
|
|
258
|
+
found = false;
|
|
259
|
+
//go up left
|
|
260
|
+
for (int i = 1; !found && i < maxSize; i++) {
|
|
261
|
+
found = GetBlackPointOnSegment(image, right, down - i, right - i, down, y);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (!found) {
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
CenterEdges(y, z, x, t, width, p0, p1, p2, p3);
|
|
269
|
+
return true;
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
return false;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
} // ZXing
|
|
@@ -0,0 +1,36 @@
|
|
|
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 BitMatrix;
|
|
12
|
+
class ResultPoint;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* <p>
|
|
16
|
+
* Detects a candidate barcode-like rectangular region within an image. It
|
|
17
|
+
* starts around the center of the image, increases the size of the candidate
|
|
18
|
+
* region until it finds a white rectangular region.
|
|
19
|
+
* </p>
|
|
20
|
+
*
|
|
21
|
+
* @param image barcode image to find a rectangle in
|
|
22
|
+
* @param initSize initial size of search area around center
|
|
23
|
+
* @param x x position of search center
|
|
24
|
+
* @param y y position of search center
|
|
25
|
+
* @return {@link ResultPoint}[] describing the corners of the rectangular
|
|
26
|
+
* region. The first and last points are opposed on the diagonal, as
|
|
27
|
+
* are the second and third. The first point will be the topmost
|
|
28
|
+
* point and the last, the bottommost. The second point will be
|
|
29
|
+
* leftmost and the third, the rightmost
|
|
30
|
+
* @return true iff white rect was found
|
|
31
|
+
*/
|
|
32
|
+
bool DetectWhiteRect(const BitMatrix& image, int initSize, int x, int y, ResultPoint& p0, ResultPoint& p1,
|
|
33
|
+
ResultPoint& p2, ResultPoint& p3);
|
|
34
|
+
bool DetectWhiteRect(const BitMatrix& image, ResultPoint& p0, ResultPoint& p1, ResultPoint& p2, ResultPoint& p3);
|
|
35
|
+
|
|
36
|
+
} // ZXing
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Axel Waggershauser
|
|
3
|
+
* Copyright 2025 gitlost
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#include "WriteBarcode.h"
|
|
8
|
+
|
|
9
|
+
#include "BarcodeData.h"
|
|
10
|
+
#include "BitMatrix.h"
|
|
11
|
+
#include "CreateBarcode.h"
|
|
12
|
+
#include "Version.h"
|
|
13
|
+
|
|
14
|
+
#include <sstream>
|
|
15
|
+
|
|
16
|
+
#ifdef ZXING_USE_ZINT
|
|
17
|
+
#include <zint.h>
|
|
18
|
+
#endif // ZXING_USE_ZINT
|
|
19
|
+
|
|
20
|
+
namespace ZXing {
|
|
21
|
+
|
|
22
|
+
struct WriterOptions::Data
|
|
23
|
+
{
|
|
24
|
+
int scale = 1;
|
|
25
|
+
int rotate = 0;
|
|
26
|
+
bool invert = false;
|
|
27
|
+
bool addHRT = false;
|
|
28
|
+
bool addQuietZones = true;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
#define ZX_PROPERTY(TYPE, NAME) \
|
|
32
|
+
TYPE WriterOptions::NAME() const noexcept { return d->NAME; } \
|
|
33
|
+
WriterOptions& WriterOptions::NAME(TYPE v)& { return d->NAME = std::move(v), *this; } \
|
|
34
|
+
WriterOptions&& WriterOptions::NAME(TYPE v)&& { return d->NAME = std::move(v), std::move(*this); }
|
|
35
|
+
|
|
36
|
+
ZX_PROPERTY(int, scale)
|
|
37
|
+
ZX_PROPERTY(int, rotate)
|
|
38
|
+
ZX_PROPERTY(bool, invert)
|
|
39
|
+
ZX_PROPERTY(bool, addHRT)
|
|
40
|
+
ZX_PROPERTY(bool, addQuietZones)
|
|
41
|
+
|
|
42
|
+
#undef ZX_PROPERTY
|
|
43
|
+
|
|
44
|
+
WriterOptions::WriterOptions() : d(std::make_unique<Data>()) {}
|
|
45
|
+
WriterOptions::~WriterOptions() = default;
|
|
46
|
+
WriterOptions::WriterOptions(WriterOptions&&) noexcept = default;
|
|
47
|
+
WriterOptions& WriterOptions::operator=(WriterOptions&&) noexcept = default;
|
|
48
|
+
|
|
49
|
+
#ifdef ZXING_USE_ZINT
|
|
50
|
+
|
|
51
|
+
struct SetCommonWriterOptions
|
|
52
|
+
{
|
|
53
|
+
zint_symbol* zint;
|
|
54
|
+
|
|
55
|
+
SetCommonWriterOptions(zint_symbol* zint, const WriterOptions& opts) : zint(zint)
|
|
56
|
+
{
|
|
57
|
+
zint->show_hrt = opts.addHRT();
|
|
58
|
+
|
|
59
|
+
zint->output_options &= ~(OUT_BUFFER_INTERMEDIATE | BARCODE_NO_QUIET_ZONES);
|
|
60
|
+
zint->output_options |= opts.addQuietZones() ? BARCODE_QUIET_ZONES : BARCODE_NO_QUIET_ZONES;
|
|
61
|
+
|
|
62
|
+
if (opts.scale() > 0)
|
|
63
|
+
zint->scale = opts.scale() / 2.f;
|
|
64
|
+
else if (opts.scale() < 0) {
|
|
65
|
+
int size = std::max(zint->width, zint->rows);
|
|
66
|
+
zint->scale = std::max(1, int(float(-opts.scale()) / size)) / 2.f;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (opts.invert()) {
|
|
70
|
+
strcpy(zint->bgcolour, "000000");
|
|
71
|
+
strcpy(zint->fgcolour, "ffffff");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// reset the defaults such that consecutive write calls don't influence each other
|
|
76
|
+
~SetCommonWriterOptions()
|
|
77
|
+
{
|
|
78
|
+
zint->scale = 0.5f;
|
|
79
|
+
strcpy(zint->fgcolour, "000000");
|
|
80
|
+
strcpy(zint->bgcolour, "ffffff");
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
#define CHECK(ZINT_CALL) \
|
|
85
|
+
if (int err = (ZINT_CALL); err >= ZINT_ERROR) \
|
|
86
|
+
throw std::invalid_argument(StrCat(zint->errtxt, " (retval: ", std::to_string(err), ")"));
|
|
87
|
+
|
|
88
|
+
#endif // ZXING_USE_ZINT
|
|
89
|
+
|
|
90
|
+
static std::string ToSVG(ImageView iv)
|
|
91
|
+
{
|
|
92
|
+
if (!iv.data())
|
|
93
|
+
return {};
|
|
94
|
+
|
|
95
|
+
// see https://stackoverflow.com/questions/10789059/create-qr-code-in-vector-image/60638350#60638350
|
|
96
|
+
|
|
97
|
+
std::ostringstream res;
|
|
98
|
+
|
|
99
|
+
res << R"(<?xml version="1.0" encoding="UTF-8"?>)" << "\n"
|
|
100
|
+
<< R"(<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 )" << iv.width() << ' ' << iv.height()
|
|
101
|
+
<< R"(" stroke="none">)" << "\n"
|
|
102
|
+
<< "<path d=\"";
|
|
103
|
+
|
|
104
|
+
for (int y = 0; y < iv.height(); ++y)
|
|
105
|
+
for (int x = 0; x < iv.width(); ++x)
|
|
106
|
+
if (*iv.data(x, y) == 0)
|
|
107
|
+
res << "M" << x << "," << y << "h1v1h-1z";
|
|
108
|
+
|
|
109
|
+
res << "\"/>\n</svg>";
|
|
110
|
+
|
|
111
|
+
return res.str();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
static Image ToImage(BitMatrix bits, bool isLinearCode, const WriterOptions& opts)
|
|
115
|
+
{
|
|
116
|
+
bits.flipAll();
|
|
117
|
+
int width = opts.scale() > 0 ? bits.width() * opts.scale() : -opts.scale();
|
|
118
|
+
int height = isLinearCode ? std::clamp(width / 2, 50, 300) : opts.scale() > 0 ? bits.height() * opts.scale() : -opts.scale();
|
|
119
|
+
auto symbol = Inflate(std::move(bits), width, height, opts.addQuietZones() ? 10 : 0);
|
|
120
|
+
auto bitmap = ToMatrix<uint8_t>(symbol);
|
|
121
|
+
auto iv = Image(symbol.width(), symbol.height());
|
|
122
|
+
std::memcpy(const_cast<uint8_t*>(iv.data()), bitmap.data(), iv.width() * iv.height());
|
|
123
|
+
return iv;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
std::string WriteBarcodeToSVG(const Barcode& barcode, [[maybe_unused]] const WriterOptions& options)
|
|
127
|
+
{
|
|
128
|
+
#if defined(ZXING_WRITERS) && defined(ZXING_USE_ZINT)
|
|
129
|
+
auto* zint = barcode.d->zint.get();
|
|
130
|
+
|
|
131
|
+
if (!zint)
|
|
132
|
+
#endif
|
|
133
|
+
return ToSVG(barcode.symbol());
|
|
134
|
+
|
|
135
|
+
#if defined(ZXING_WRITERS) && defined(ZXING_USE_ZINT)
|
|
136
|
+
auto zintLock = std::lock_guard(*barcode.d->zintMutex);
|
|
137
|
+
auto resetOnExit = SetCommonWriterOptions(zint, options);
|
|
138
|
+
|
|
139
|
+
zint->output_options |= BARCODE_MEMORY_FILE;// | EMBED_VECTOR_FONT;
|
|
140
|
+
strcpy(zint->outfile, "null.svg");
|
|
141
|
+
|
|
142
|
+
CHECK(ZBarcode_Print(zint, options.rotate()));
|
|
143
|
+
|
|
144
|
+
return std::string(reinterpret_cast<const char*>(zint->memfile), zint->memfile_size);
|
|
145
|
+
#endif
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
Image WriteBarcodeToImage(const Barcode& barcode, [[maybe_unused]] const WriterOptions& options)
|
|
149
|
+
{
|
|
150
|
+
#if defined(ZXING_WRITERS) && defined(ZXING_USE_ZINT)
|
|
151
|
+
auto* zint = barcode.d->zint.get();
|
|
152
|
+
|
|
153
|
+
if (!zint)
|
|
154
|
+
#endif
|
|
155
|
+
return ToImage(barcode.d->symbol.copy(), barcode.format() & BarcodeFormat::AllLinear, options);
|
|
156
|
+
|
|
157
|
+
#if defined(ZXING_WRITERS) && defined(ZXING_USE_ZINT)
|
|
158
|
+
auto zintLock = std::lock_guard(*barcode.d->zintMutex);
|
|
159
|
+
auto resetOnExit = SetCommonWriterOptions(zint, options);
|
|
160
|
+
|
|
161
|
+
CHECK(ZBarcode_Buffer(zint, options.rotate()));
|
|
162
|
+
|
|
163
|
+
#ifdef PRINT_DEBUG
|
|
164
|
+
printf("write symbol with size: %dx%d\n", zint->bitmap_width, zint->bitmap_height);
|
|
165
|
+
#endif
|
|
166
|
+
auto iv = Image(zint->bitmap_width, zint->bitmap_height);
|
|
167
|
+
auto* src = zint->bitmap;
|
|
168
|
+
auto* dst = const_cast<uint8_t*>(iv.data());
|
|
169
|
+
for(int y = 0; y < iv.height(); ++y)
|
|
170
|
+
for(int x = 0, w = iv.width(); x < w; ++x, src += 3)
|
|
171
|
+
*dst++ = RGBToLum(src[0], src[1], src[2]);
|
|
172
|
+
|
|
173
|
+
return iv;
|
|
174
|
+
#endif
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
std::string WriteBarcodeToUtf8(const Barcode& barcode, [[maybe_unused]] const WriterOptions& options)
|
|
178
|
+
{
|
|
179
|
+
auto iv = barcode.symbol();
|
|
180
|
+
if (!iv.data())
|
|
181
|
+
return {};
|
|
182
|
+
|
|
183
|
+
constexpr auto map = std::array{" ", "▀", "▄", "█"};
|
|
184
|
+
std::ostringstream res;
|
|
185
|
+
bool invert = !options.invert();
|
|
186
|
+
|
|
187
|
+
Image buffer;
|
|
188
|
+
if (options.addQuietZones()) {
|
|
189
|
+
buffer = Image(iv.width() + 2, iv.height() + 2);
|
|
190
|
+
memset(const_cast<uint8_t*>(buffer.data()), 0xff, buffer.rowStride() * buffer.height());
|
|
191
|
+
for (int y = 0; y < iv.height(); y++)
|
|
192
|
+
memcpy(const_cast<uint8_t*>(buffer.data(1, y + 1)), iv.data(0, y), iv.width());
|
|
193
|
+
iv = barcode.format() & BarcodeFormat::AllLinear ? iv.cropped(0, 1, buffer.width(), buffer.height() - 2) : buffer;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
for (int y = 0; y < iv.height(); y += 2) {
|
|
197
|
+
// for linear barcodes, only print line pairs that are distinct from the previous one
|
|
198
|
+
if (barcode.format() & BarcodeFormat::AllLinear && y > 1 && y < iv.height() - 1
|
|
199
|
+
&& memcmp(iv.data(0, y), iv.data(0, y - 2), 2 * iv.rowStride()) == 0)
|
|
200
|
+
continue;
|
|
201
|
+
|
|
202
|
+
for (int x = 0; x < iv.width(); ++x) {
|
|
203
|
+
int tp = bool(*iv.data(x, y)) ^ invert;
|
|
204
|
+
int bt = (iv.height() == 1 && tp) || (y + 1 < iv.height() && (bool(*iv.data(x, y + 1)) ^ invert));
|
|
205
|
+
res << map[tp | (bt << 1)];
|
|
206
|
+
}
|
|
207
|
+
res << '\n';
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return res.str();
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
} // namespace ZXing
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Axel Waggershauser
|
|
3
|
+
*/
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
#pragma once
|
|
7
|
+
|
|
8
|
+
#include "Barcode.h"
|
|
9
|
+
#include "ImageView.h"
|
|
10
|
+
|
|
11
|
+
#include <memory>
|
|
12
|
+
|
|
13
|
+
namespace ZXing {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @brief Configuration options for barcode writing/generation.
|
|
17
|
+
*
|
|
18
|
+
* WriterOptions provides a fluent interface for setting various parameters
|
|
19
|
+
* that control how barcodes are generated.
|
|
20
|
+
*
|
|
21
|
+
* This class supports method chaining for convenient option configuration:
|
|
22
|
+
* ```cpp
|
|
23
|
+
* auto opts = WriterOptions().scale(5).addHRT(true);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
class WriterOptions
|
|
27
|
+
{
|
|
28
|
+
struct Data;
|
|
29
|
+
|
|
30
|
+
std::unique_ptr<Data> d;
|
|
31
|
+
|
|
32
|
+
public:
|
|
33
|
+
WriterOptions();
|
|
34
|
+
~WriterOptions();
|
|
35
|
+
WriterOptions(WriterOptions&&) noexcept;
|
|
36
|
+
WriterOptions& operator=(WriterOptions&&) noexcept;
|
|
37
|
+
|
|
38
|
+
#define ZX_PROPERTY(TYPE, NAME) \
|
|
39
|
+
TYPE NAME() const noexcept; \
|
|
40
|
+
WriterOptions& NAME(TYPE v)&; \
|
|
41
|
+
WriterOptions&& NAME(TYPE v)&&;
|
|
42
|
+
|
|
43
|
+
/// scale factor for rendering, ie the module size (default: 1). Passing a negative value will choose the scale
|
|
44
|
+
/// automatically to fit the size of the barcode to abs(scale) as close as possible.
|
|
45
|
+
ZX_PROPERTY(int, scale)
|
|
46
|
+
|
|
47
|
+
/// rotate the barcode by given degrees (0, 90, 180, 270)
|
|
48
|
+
ZX_PROPERTY(int, rotate)
|
|
49
|
+
|
|
50
|
+
/// invert the colors of the barcode
|
|
51
|
+
ZX_PROPERTY(bool, invert)
|
|
52
|
+
|
|
53
|
+
/// add human readable text (HRI) to the barcode
|
|
54
|
+
ZX_PROPERTY(bool, addHRT)
|
|
55
|
+
|
|
56
|
+
/// add quiet zones around the barcode (default: true)
|
|
57
|
+
ZX_PROPERTY(bool, addQuietZones)
|
|
58
|
+
|
|
59
|
+
#undef ZX_PROPERTY
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
/// Write barcode symbol to SVG
|
|
64
|
+
std::string WriteBarcodeToSVG(const Barcode& barcode, const WriterOptions& options = {});
|
|
65
|
+
|
|
66
|
+
/// Write barcode symbol to a utf8 string using graphical characters (e.g. '▀')
|
|
67
|
+
std::string WriteBarcodeToUtf8(const Barcode& barcode, const WriterOptions& options = {});
|
|
68
|
+
|
|
69
|
+
/// Write barcode symbol to Image (Bitmap)
|
|
70
|
+
Image WriteBarcodeToImage(const Barcode& barcode, const WriterOptions& options = {});
|
|
71
|
+
|
|
72
|
+
} // ZXing
|