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,185 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Axel Waggershauser
|
|
3
|
+
*/
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
#pragma once
|
|
7
|
+
|
|
8
|
+
#include <algorithm>
|
|
9
|
+
#include <cmath>
|
|
10
|
+
#include <string>
|
|
11
|
+
|
|
12
|
+
namespace ZXing {
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @brief A simple 2D point class template.
|
|
16
|
+
*
|
|
17
|
+
* PointT is a simple 2D point class template with direct access to its x and y coordinate members.
|
|
18
|
+
*/
|
|
19
|
+
template <typename T>
|
|
20
|
+
struct PointT
|
|
21
|
+
{
|
|
22
|
+
using value_t = T;
|
|
23
|
+
T x = 0, y = 0;
|
|
24
|
+
|
|
25
|
+
constexpr PointT() = default;
|
|
26
|
+
constexpr PointT(T xx, T yy) : x(xx), y(yy) {}
|
|
27
|
+
|
|
28
|
+
template <typename U>
|
|
29
|
+
constexpr explicit PointT(const PointT<U>& p) : x(static_cast<T>(p.x)), y(static_cast<T>(p.y))
|
|
30
|
+
{}
|
|
31
|
+
|
|
32
|
+
template <typename U>
|
|
33
|
+
PointT& operator+=(const PointT<U>& b)
|
|
34
|
+
{
|
|
35
|
+
x += b.x;
|
|
36
|
+
y += b.y;
|
|
37
|
+
return *this;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
using PointI = PointT<int>;
|
|
42
|
+
using PointF = PointT<double>;
|
|
43
|
+
|
|
44
|
+
/// @cond INTERNAL
|
|
45
|
+
|
|
46
|
+
template <typename T>
|
|
47
|
+
bool operator==(const PointT<T>& a, const PointT<T>& b)
|
|
48
|
+
{
|
|
49
|
+
return a.x == b.x && a.y == b.y;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
template <typename T>
|
|
53
|
+
bool operator!=(const PointT<T>& a, const PointT<T>& b)
|
|
54
|
+
{
|
|
55
|
+
return !(a == b);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
template <typename T>
|
|
59
|
+
auto operator-(const PointT<T>& a) -> PointT<T>
|
|
60
|
+
{
|
|
61
|
+
return {-a.x, -a.y};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
template <typename T, typename U>
|
|
65
|
+
auto operator+(const PointT<T>& a, const PointT<U>& b) -> PointT<decltype(a.x + b.x)>
|
|
66
|
+
{
|
|
67
|
+
return {a.x + b.x, a.y + b.y};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
template <typename T, typename U>
|
|
71
|
+
auto operator-(const PointT<T>& a, const PointT<U>& b) -> PointT<decltype(a.x - b.x)>
|
|
72
|
+
{
|
|
73
|
+
return {a.x - b.x, a.y - b.y};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
template <typename T, typename U>
|
|
77
|
+
auto operator*(const PointT<T>& a, const PointT<U>& b) -> PointT<decltype(a.x * b.x)>
|
|
78
|
+
{
|
|
79
|
+
return {a.x * b.x, a.y * b.y};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
template <typename T, typename U>
|
|
83
|
+
PointT<T> operator*(U s, const PointT<T>& a)
|
|
84
|
+
{
|
|
85
|
+
return {s * a.x, s * a.y};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
template <typename T, typename U>
|
|
89
|
+
PointT<T> operator/(const PointT<T>& a, U d)
|
|
90
|
+
{
|
|
91
|
+
return {a.x / d, a.y / d};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
template <typename T, typename U>
|
|
95
|
+
auto dot(const PointT<T>& a, const PointT<U>& b) -> decltype (a.x * b.x)
|
|
96
|
+
{
|
|
97
|
+
return a.x * b.x + a.y * b.y;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
template <typename T>
|
|
101
|
+
auto cross(PointT<T> a, PointT<T> b) -> decltype(a.x * b.x)
|
|
102
|
+
{
|
|
103
|
+
return a.x * b.y - b.x * a.y;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/// L1 norm
|
|
107
|
+
template <typename T>
|
|
108
|
+
T sumAbsComponent(PointT<T> p)
|
|
109
|
+
{
|
|
110
|
+
return std::abs(p.x) + std::abs(p.y);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/// L2 norm
|
|
114
|
+
template <typename T>
|
|
115
|
+
auto length(PointT<T> p) -> decltype(std::sqrt(dot(p, p)))
|
|
116
|
+
{
|
|
117
|
+
return std::sqrt(dot(p, p));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/// L-inf norm
|
|
121
|
+
template <typename T>
|
|
122
|
+
T maxAbsComponent(PointT<T> p)
|
|
123
|
+
{
|
|
124
|
+
return std::max(std::abs(p.x), std::abs(p.y));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
template <typename T>
|
|
128
|
+
auto distance(PointT<T> a, PointT<T> b) -> decltype(length(a - b))
|
|
129
|
+
{
|
|
130
|
+
return length(a - b);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
template <typename T>
|
|
134
|
+
PointF normalized(PointT<T> d)
|
|
135
|
+
{
|
|
136
|
+
return PointF(d) / length(PointF(d));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
template <typename T>
|
|
140
|
+
PointT<T> bresenhamDirection(PointT<T> d)
|
|
141
|
+
{
|
|
142
|
+
return d / maxAbsComponent(d);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
template <typename T>
|
|
146
|
+
PointT<T> mainDirection(PointT<T> d)
|
|
147
|
+
{
|
|
148
|
+
return std::abs(d.x) > std::abs(d.y) ? PointT<T>(d.x, 0) : PointT<T>(0, d.y);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
template <typename T>
|
|
152
|
+
PointT<T> right(PointT<T> d)
|
|
153
|
+
{
|
|
154
|
+
return {-d.y, d.x};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
template <typename T>
|
|
158
|
+
PointT<T> left(PointT<T> d)
|
|
159
|
+
{
|
|
160
|
+
return {d.y, -d.x};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/// Calculate a floating point pixel coordinate representing the 'center' of the pixel.
|
|
164
|
+
/// This is sort of the inverse operation of the PointI(PointF) conversion constructor.
|
|
165
|
+
/// See also the documentation of the GridSampler API.
|
|
166
|
+
inline PointF centered(PointI p)
|
|
167
|
+
{
|
|
168
|
+
return p + PointF(0.5f, 0.5f);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
inline PointF centered(PointF p)
|
|
172
|
+
{
|
|
173
|
+
return {std::floor(p.x) + 0.5f, std::floor(p.y) + 0.5f};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/// @endcond
|
|
177
|
+
|
|
178
|
+
template <typename T>
|
|
179
|
+
std::string ToString(const PointT<T>& p, bool swap = false, char delim = 'x')
|
|
180
|
+
{
|
|
181
|
+
return std::to_string(swap ? p.y : p.x) + delim + std::to_string(swap ? p.x : p.y);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
} // ZXing
|
|
185
|
+
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Axel Waggershauser
|
|
3
|
+
*/
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
#pragma once
|
|
7
|
+
|
|
8
|
+
#include "Point.h"
|
|
9
|
+
|
|
10
|
+
#ifdef ZXING_INTERNAL
|
|
11
|
+
#include "ZXAlgorithms.h"
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
#include <array>
|
|
15
|
+
#include <cmath>
|
|
16
|
+
#include <string>
|
|
17
|
+
|
|
18
|
+
namespace ZXing {
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @brief A simple class representing a quadrilateral defined by its four corner points.
|
|
22
|
+
*
|
|
23
|
+
* It represents a quadrilateral defined by its four corner points:
|
|
24
|
+
* top-left, top-right, bottom-right, and bottom-left. Those points are relative to the detected symbol
|
|
25
|
+
* i.e. topLeft() will return the coordinates of the top-left corner of the symbol. If e.g. the symbol
|
|
26
|
+
* is rotated 180 degrees, the top-left corner will be the one that is at the bottom-right position in the image.
|
|
27
|
+
*/
|
|
28
|
+
template <typename T>
|
|
29
|
+
class Quadrilateral : public std::array<T, 4>
|
|
30
|
+
{
|
|
31
|
+
using Base = std::array<T, 4>;
|
|
32
|
+
using Base::at;
|
|
33
|
+
public:
|
|
34
|
+
using Point = T;
|
|
35
|
+
|
|
36
|
+
Quadrilateral() = default;
|
|
37
|
+
Quadrilateral(T tl, T tr, T br, T bl) : Base{tl, tr, br, bl} {}
|
|
38
|
+
template <typename U>
|
|
39
|
+
Quadrilateral(PointT<U> tl, PointT<U> tr, PointT<U> br, PointT<U> bl)
|
|
40
|
+
: Quadrilateral(Point(tl), Point(tr), Point(br), Point(bl))
|
|
41
|
+
{}
|
|
42
|
+
|
|
43
|
+
constexpr Point topLeft() const noexcept { return at(0); }
|
|
44
|
+
constexpr Point topRight() const noexcept { return at(1); }
|
|
45
|
+
constexpr Point bottomRight() const noexcept { return at(2); }
|
|
46
|
+
constexpr Point bottomLeft() const noexcept { return at(3); }
|
|
47
|
+
|
|
48
|
+
/// Return the orientation of the quadrilateral in radians, where 0 means the horizontal center line
|
|
49
|
+
/// is parallel to the x-axis and positive values mean a clockwise rotation.
|
|
50
|
+
double orientation() const
|
|
51
|
+
{
|
|
52
|
+
auto centerLine = (topRight() + bottomRight()) - (topLeft() + bottomLeft());
|
|
53
|
+
if (centerLine == Point{})
|
|
54
|
+
return 0.;
|
|
55
|
+
auto centerLineF = normalized(centerLine);
|
|
56
|
+
return std::atan2(centerLineF.y, centerLineF.x);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
using QuadrilateralF = Quadrilateral<PointF>;
|
|
61
|
+
using QuadrilateralI = Quadrilateral<PointI>;
|
|
62
|
+
|
|
63
|
+
template <typename T>
|
|
64
|
+
std::string ToString(const Quadrilateral<PointT<T>>& points)
|
|
65
|
+
{
|
|
66
|
+
std::string res;
|
|
67
|
+
for (const auto& p : points)
|
|
68
|
+
res += std::to_string(p.x) + "x" + std::to_string(p.y) + (&p == &points.back() ? "" : " ");
|
|
69
|
+
return res;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
#ifdef ZXING_INTERNAL
|
|
73
|
+
|
|
74
|
+
template <typename PointT = PointF>
|
|
75
|
+
Quadrilateral<PointT> Rectangle(int width, int height, typename PointT::value_t margin = 0)
|
|
76
|
+
{
|
|
77
|
+
return {
|
|
78
|
+
PointT{margin, margin}, {width - margin, margin}, {width - margin, height - margin}, {margin, height - margin}};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
template <typename PointT = PointF>
|
|
82
|
+
Quadrilateral<PointT> Rectangle(int x0, int x1, int y0, int y1, typename PointT::value_t o)
|
|
83
|
+
{
|
|
84
|
+
return {PointT{x0 + o, y0 + o}, {x1 + o, y0 + o}, {x1 + o, y1 + o}, {x0 + o, y1 + o}};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
template <typename PointT = PointF>
|
|
88
|
+
Quadrilateral<PointT> Rectangle(int left, int top, int width, int height)
|
|
89
|
+
{
|
|
90
|
+
int right = left + width - 1;
|
|
91
|
+
int bottom = top + height - 1;
|
|
92
|
+
|
|
93
|
+
return {PointT{left, top}, {right, top}, {right, bottom}, {left, bottom}};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
template <typename PointT = PointF>
|
|
97
|
+
Quadrilateral<PointT> CenteredSquare(int size)
|
|
98
|
+
{
|
|
99
|
+
return Scale(Quadrilateral(PointT{-1, -1}, {1, -1}, {1, 1}, {-1, 1}), size / 2);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
template <typename PointT = PointI>
|
|
103
|
+
Quadrilateral<PointT> Line(int y, int xStart, int xStop)
|
|
104
|
+
{
|
|
105
|
+
return {PointT{xStart, y}, {xStop, y}, {xStop, y}, {xStart, y}};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
template <typename PointT>
|
|
109
|
+
bool IsConvex(const Quadrilateral<PointT>& poly)
|
|
110
|
+
{
|
|
111
|
+
const int N = Size(poly);
|
|
112
|
+
bool sign = false;
|
|
113
|
+
|
|
114
|
+
typename PointT::value_t m = INFINITY, M = 0;
|
|
115
|
+
|
|
116
|
+
for(int i = 0; i < N; i++)
|
|
117
|
+
{
|
|
118
|
+
auto d1 = poly[(i + 2) % N] - poly[(i + 1) % N];
|
|
119
|
+
auto d2 = poly[i] - poly[(i + 1) % N];
|
|
120
|
+
auto cp = cross(d1, d2);
|
|
121
|
+
|
|
122
|
+
// TODO: see if the isInside check for all boundary points in GridSampler is still required after fixing the wrong fabs()
|
|
123
|
+
// application in the following line
|
|
124
|
+
UpdateMinMax(m, M, std::fabs(cp));
|
|
125
|
+
|
|
126
|
+
if (i == 0)
|
|
127
|
+
sign = cp > 0;
|
|
128
|
+
else if (sign != (cp > 0))
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// It turns out being convex is not enough to prevent a "numerical instability"
|
|
133
|
+
// that can cause the corners being projected inside the image boundaries but
|
|
134
|
+
// some points near the corners being projected outside. This has been observed
|
|
135
|
+
// where one corner is almost in line with two others. The M/m ratio is below 2
|
|
136
|
+
// for the complete existing sample set. For very "skewed" QRCodes a value of
|
|
137
|
+
// around 3 is realistic. A value of 14 has been observed to trigger the
|
|
138
|
+
// instability.
|
|
139
|
+
return M / m < 4.0;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
template <typename PointT>
|
|
143
|
+
Quadrilateral<PointT> Scale(const Quadrilateral<PointT>& q, int factor)
|
|
144
|
+
{
|
|
145
|
+
return {factor * q[0], factor * q[1], factor * q[2], factor * q[3]};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
template <typename PointT>
|
|
149
|
+
Quadrilateral<PointT> Move(const Quadrilateral<PointT>& q, PointT offset)
|
|
150
|
+
{
|
|
151
|
+
return {q[0] + offset, q[1] + offset, q[2] + offset, q[3] + offset};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
template <typename PointT>
|
|
155
|
+
PointT Center(const Quadrilateral<PointT>& q)
|
|
156
|
+
{
|
|
157
|
+
return Reduce(q) / Size(q);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
template <typename PointT>
|
|
161
|
+
Quadrilateral<PointT> RotatedCorners(const Quadrilateral<PointT>& q, int n = 1, bool mirror = false)
|
|
162
|
+
{
|
|
163
|
+
Quadrilateral<PointT> res;
|
|
164
|
+
std::rotate_copy(q.begin(), q.begin() + ((n + 4) % 4), q.end(), res.begin());
|
|
165
|
+
if (mirror)
|
|
166
|
+
std::swap(res[1], res[3]);
|
|
167
|
+
return res;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
template <typename PointT>
|
|
171
|
+
bool IsInside(const PointT& p, const Quadrilateral<PointT>& q)
|
|
172
|
+
{
|
|
173
|
+
// Test if p is on the same side (right or left) of all polygon segments
|
|
174
|
+
int pos = 0, neg = 0;
|
|
175
|
+
for (int i = 0; i < Size(q); ++i)
|
|
176
|
+
(cross(p - q[i], q[(i + 1) % Size(q)] - q[i]) < 0 ? neg : pos)++;
|
|
177
|
+
return pos == 0 || neg == 0;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
template <typename PointT>
|
|
181
|
+
Quadrilateral<PointT> BoundingBox(const Quadrilateral<PointT>& q)
|
|
182
|
+
{
|
|
183
|
+
auto [minX, maxX] = std::minmax({q[0].x, q[1].x, q[2].x, q[3].x});
|
|
184
|
+
auto [minY, maxY] = std::minmax({q[0].y, q[1].y, q[2].y, q[3].y});
|
|
185
|
+
return {PointT{minX, minY}, {maxX, minY}, {maxX, maxY}, {minX, maxY}};
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
template <typename PointT>
|
|
189
|
+
bool HaveIntersectingBoundingBoxes(const Quadrilateral<PointT>& a, const Quadrilateral<PointT>& b)
|
|
190
|
+
{
|
|
191
|
+
auto bba = BoundingBox(a), bbb = BoundingBox(b);
|
|
192
|
+
|
|
193
|
+
bool x = bbb.topRight().x < bba.topLeft().x || bbb.topLeft().x > bba.topRight().x;
|
|
194
|
+
bool y = bbb.bottomLeft().y < bba.topLeft().y || bbb.topLeft().y > bba.bottomLeft().y;
|
|
195
|
+
return !(x || y);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
template <typename PointT>
|
|
199
|
+
Quadrilateral<PointT> Blend(const Quadrilateral<PointT>& a, const Quadrilateral<PointT>& b)
|
|
200
|
+
{
|
|
201
|
+
auto dist2First = [r = a[0]](auto s, auto t) { return distance(s, r) < distance(t, r); };
|
|
202
|
+
// rotate points such that the the two topLeft points are closest to each other
|
|
203
|
+
auto offset = std::min_element(b.begin(), b.end(), dist2First) - b.begin();
|
|
204
|
+
|
|
205
|
+
Quadrilateral<PointT> res;
|
|
206
|
+
for (int i = 0; i < 4; ++i)
|
|
207
|
+
res[i] = (a[i] + b[(i + offset) % 4]) / 2;
|
|
208
|
+
|
|
209
|
+
return res;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
#endif
|
|
213
|
+
|
|
214
|
+
} // ZXing
|
|
215
|
+
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 Axel Waggershauser
|
|
3
|
+
*/
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
#pragma once
|
|
7
|
+
|
|
8
|
+
#include "ZXAlgorithms.h"
|
|
9
|
+
|
|
10
|
+
#include <cstdint>
|
|
11
|
+
#include <iterator>
|
|
12
|
+
|
|
13
|
+
namespace ZXing {
|
|
14
|
+
|
|
15
|
+
template <typename Iterator>
|
|
16
|
+
struct StrideIter
|
|
17
|
+
{
|
|
18
|
+
Iterator pos;
|
|
19
|
+
int stride;
|
|
20
|
+
|
|
21
|
+
using iterator_category = std::random_access_iterator_tag;
|
|
22
|
+
using difference_type = typename std::iterator_traits<Iterator>::difference_type;
|
|
23
|
+
using value_type = typename std::iterator_traits<Iterator>::value_type;
|
|
24
|
+
using pointer = Iterator;
|
|
25
|
+
using reference = typename std::iterator_traits<Iterator>::reference;
|
|
26
|
+
|
|
27
|
+
auto operator*() const { return *pos; }
|
|
28
|
+
auto operator[](int i) const { return *(pos + i * stride); }
|
|
29
|
+
StrideIter<Iterator>& operator++() { return pos += stride, *this; }
|
|
30
|
+
StrideIter<Iterator> operator++(int) { auto temp = *this; ++*this; return temp; }
|
|
31
|
+
bool operator==(const StrideIter<Iterator>& rhs) const { return pos == rhs.pos; }
|
|
32
|
+
StrideIter<Iterator> operator+(int i) const { return {pos + i * stride, stride}; }
|
|
33
|
+
StrideIter<Iterator> operator-(int i) const { return {pos - i * stride, stride}; }
|
|
34
|
+
int operator-(const StrideIter<Iterator>& rhs) const { return narrow_cast<int>((pos - rhs.pos) / stride); }
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
template <typename Iterator>
|
|
38
|
+
StrideIter(const Iterator&, int) -> StrideIter<Iterator>;
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
template <typename Iterator>
|
|
42
|
+
struct Range
|
|
43
|
+
{
|
|
44
|
+
Iterator _begin, _end;
|
|
45
|
+
|
|
46
|
+
Range(Iterator b, Iterator e) : _begin(b), _end(e) {}
|
|
47
|
+
|
|
48
|
+
template <typename C>
|
|
49
|
+
Range(const C& c) : _begin(std::begin(c)), _end(std::end(c)) {}
|
|
50
|
+
|
|
51
|
+
Iterator begin() const noexcept { return _begin; }
|
|
52
|
+
Iterator end() const noexcept { return _end; }
|
|
53
|
+
explicit operator bool() const { return begin() < end(); }
|
|
54
|
+
int size() const { return narrow_cast<int>(end() - begin()); }
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
template <typename C>
|
|
58
|
+
Range(const C&) -> Range<typename C::const_iterator>;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* ArrayView is a lightweight, non-owning, non-mutable view over a contiguous sequence of elements.
|
|
62
|
+
* Similar to std::span<const T>. See also Range template for general iterator use case.
|
|
63
|
+
*/
|
|
64
|
+
template <typename T>
|
|
65
|
+
class ArrayView
|
|
66
|
+
{
|
|
67
|
+
const T* _data = nullptr;
|
|
68
|
+
std::size_t _size = 0;
|
|
69
|
+
|
|
70
|
+
public:
|
|
71
|
+
using value_type = T;
|
|
72
|
+
using pointer = const value_type*;
|
|
73
|
+
using const_pointer = const value_type*;
|
|
74
|
+
using reference = const value_type&;
|
|
75
|
+
using const_reference = const value_type&;
|
|
76
|
+
using size_type = std::size_t;
|
|
77
|
+
|
|
78
|
+
constexpr ArrayView() noexcept = default;
|
|
79
|
+
|
|
80
|
+
constexpr ArrayView(pointer data, size_type size) noexcept : _data(data), _size(size) {}
|
|
81
|
+
|
|
82
|
+
template <typename P, typename U = T,
|
|
83
|
+
typename = std::enable_if_t<
|
|
84
|
+
sizeof(U) == 1 && std::is_same_v<void, std::remove_cv_t<std::remove_reference_t<std::remove_pointer_t<P>>>>>>
|
|
85
|
+
constexpr ArrayView(P data, size_type size) noexcept : _data(reinterpret_cast<pointer>(data)), _size(size)
|
|
86
|
+
{}
|
|
87
|
+
|
|
88
|
+
template <typename Container,
|
|
89
|
+
typename = std::enable_if_t<std::is_convertible_v<decltype(std::data(std::declval<Container&>())), const_pointer>>>
|
|
90
|
+
constexpr ArrayView(const Container& c) noexcept : _data(std::data(c)), _size(std::size(c))
|
|
91
|
+
{}
|
|
92
|
+
|
|
93
|
+
constexpr pointer data() const noexcept { return _data; }
|
|
94
|
+
constexpr size_type size() const noexcept { return _size; }
|
|
95
|
+
constexpr bool empty() const noexcept { return _size == 0; }
|
|
96
|
+
|
|
97
|
+
constexpr const_reference operator[](size_type index) const noexcept { return _data[index]; }
|
|
98
|
+
|
|
99
|
+
constexpr pointer begin() const noexcept { return _data; }
|
|
100
|
+
constexpr pointer end() const noexcept { return _data + _size; }
|
|
101
|
+
|
|
102
|
+
constexpr ArrayView<T> subview(size_type pos, size_type len = size_type(-1)) const noexcept
|
|
103
|
+
{
|
|
104
|
+
if (pos > _size)
|
|
105
|
+
return {};
|
|
106
|
+
return {_data + pos, std::min(len, _size - pos)};
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
using ByteView = ArrayView<uint8_t>;
|
|
111
|
+
|
|
112
|
+
} // namespace ZXing
|