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,377 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Huy Cuong Nguyen
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#include "AZHighLevelEncoder.h"
|
|
8
|
+
|
|
9
|
+
#include "AZEncodingState.h"
|
|
10
|
+
#include "AZToken.h"
|
|
11
|
+
#include "BitArray.h"
|
|
12
|
+
#include "ZXAlgorithms.h"
|
|
13
|
+
|
|
14
|
+
#include <algorithm>
|
|
15
|
+
#include <array>
|
|
16
|
+
#include <cstdint>
|
|
17
|
+
#include <list>
|
|
18
|
+
#include <vector>
|
|
19
|
+
|
|
20
|
+
namespace ZXing::Aztec {
|
|
21
|
+
|
|
22
|
+
// Do not change these constants
|
|
23
|
+
static const int MODE_UPPER = 0; // 5 bits
|
|
24
|
+
static const int MODE_LOWER = 1; // 5 bits
|
|
25
|
+
static const int MODE_DIGIT = 2; // 4 bits
|
|
26
|
+
static const int MODE_MIXED = 3; // 5 bits
|
|
27
|
+
static const int MODE_PUNCT = 4; // 5 bits
|
|
28
|
+
|
|
29
|
+
// The Latch Table shows, for each pair of Modes, the optimal method for
|
|
30
|
+
// getting from one mode to another. In the worst possible case, this can
|
|
31
|
+
// be up to 14 bits. In the best possible case, we are already there!
|
|
32
|
+
// The high half-word of each entry gives the number of bits.
|
|
33
|
+
// The low half-word of each entry are the actual bits necessary to change
|
|
34
|
+
static const std::array<std::array<int, 5>, 5> LATCH_TABLE = {
|
|
35
|
+
0,
|
|
36
|
+
(5 << 16) + 28, // UPPER -> LOWER
|
|
37
|
+
(5 << 16) + 30, // UPPER -> DIGIT
|
|
38
|
+
(5 << 16) + 29, // UPPER -> MIXED
|
|
39
|
+
(10 << 16) + (29 << 5) + 30, // UPPER -> MIXED -> PUNCT
|
|
40
|
+
|
|
41
|
+
(9 << 16) + (30 << 4) + 14, // LOWER -> DIGIT -> UPPER
|
|
42
|
+
0,
|
|
43
|
+
(5 << 16) + 30, // LOWER -> DIGIT
|
|
44
|
+
(5 << 16) + 29, // LOWER -> MIXED
|
|
45
|
+
(10 << 16) + (29 << 5) + 30, // LOWER -> MIXED -> PUNCT
|
|
46
|
+
|
|
47
|
+
(4 << 16) + 14, // DIGIT -> UPPER
|
|
48
|
+
(9 << 16) + (14 << 5) + 28, // DIGIT -> UPPER -> LOWER
|
|
49
|
+
0,
|
|
50
|
+
(9 << 16) + (14 << 5) + 29, // DIGIT -> UPPER -> MIXED
|
|
51
|
+
(14 << 16) + (14 << 10) + (29 << 5) + 30,
|
|
52
|
+
// DIGIT -> UPPER -> MIXED -> PUNCT
|
|
53
|
+
|
|
54
|
+
(5 << 16) + 29, // MIXED -> UPPER
|
|
55
|
+
(5 << 16) + 28, // MIXED -> LOWER
|
|
56
|
+
(10 << 16) + (29 << 5) + 30, // MIXED -> UPPER -> DIGIT
|
|
57
|
+
0,
|
|
58
|
+
(5 << 16) + 30, // MIXED -> PUNCT
|
|
59
|
+
|
|
60
|
+
(5 << 16) + 31, // PUNCT -> UPPER
|
|
61
|
+
(10 << 16) + (31 << 5) + 28, // PUNCT -> UPPER -> LOWER
|
|
62
|
+
(10 << 16) + (31 << 5) + 30, // PUNCT -> UPPER -> DIGIT
|
|
63
|
+
(10 << 16) + (31 << 5) + 29, // PUNCT -> UPPER -> MIXED
|
|
64
|
+
0,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// A reverse mapping from [mode][char] to the encoding for that character
|
|
68
|
+
// in that mode. An entry of 0 indicates no mapping exists.
|
|
69
|
+
static const std::array<std::array<int8_t, 256>, 5>& InitCharMap()
|
|
70
|
+
{
|
|
71
|
+
static std::array<std::array<int8_t, 256>, 5> charmap = {};
|
|
72
|
+
charmap[MODE_UPPER][' '] = 1;
|
|
73
|
+
for (int c = 'A'; c <= 'Z'; c++) {
|
|
74
|
+
charmap[MODE_UPPER][c] = c - 'A' + 2;
|
|
75
|
+
}
|
|
76
|
+
charmap[MODE_LOWER][' '] = 1;
|
|
77
|
+
for (int c = 'a'; c <= 'z'; c++) {
|
|
78
|
+
charmap[MODE_LOWER][c] = c - 'a' + 2;
|
|
79
|
+
}
|
|
80
|
+
charmap[MODE_DIGIT][' '] = 1;
|
|
81
|
+
for (int c = '0'; c <= '9'; c++) {
|
|
82
|
+
charmap[MODE_DIGIT][c] = c - '0' + 2;
|
|
83
|
+
}
|
|
84
|
+
charmap[MODE_DIGIT][','] = 12;
|
|
85
|
+
charmap[MODE_DIGIT]['.'] = 13;
|
|
86
|
+
constexpr int8_t mixedTable[] = {
|
|
87
|
+
0x00, 0x20, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
|
|
88
|
+
0x0d, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x40, 0x5c, 0x5e, 0x5f, 0x60, 0x7c, 0x7e, 0x7f,
|
|
89
|
+
};
|
|
90
|
+
for (int i = 0; i < Size(mixedTable); i++) {
|
|
91
|
+
charmap[MODE_MIXED][mixedTable[i]] = i;
|
|
92
|
+
}
|
|
93
|
+
constexpr std::array punctTable = {'\0', '\r', '\0', '\0', '\0', '\0', '!', '\'', '#', '$', '%', '&', '\'', '(', ')', '*',
|
|
94
|
+
'+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '[', ']', '{', '}'};
|
|
95
|
+
for (int i = 0; i < Size(punctTable); i++) {
|
|
96
|
+
if (punctTable[i] > 0) {
|
|
97
|
+
charmap[MODE_PUNCT][punctTable[i]] = i;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return charmap;
|
|
101
|
+
}
|
|
102
|
+
const std::array<std::array<int8_t, 256>, 5>& CHAR_MAP = InitCharMap();
|
|
103
|
+
|
|
104
|
+
// A map showing the available shift codes. (The shifts to BINARY are not shown
|
|
105
|
+
static const std::array<std::array<int8_t, 6>, 6>& InitShiftTable()
|
|
106
|
+
{
|
|
107
|
+
static std::array<std::array<int8_t, 6>, 6> table;
|
|
108
|
+
|
|
109
|
+
for (auto& row : table) {
|
|
110
|
+
std::fill(row.begin(), row.end(), -1);
|
|
111
|
+
}
|
|
112
|
+
table[MODE_UPPER][MODE_PUNCT] = 0;
|
|
113
|
+
table[MODE_LOWER][MODE_PUNCT] = 0;
|
|
114
|
+
table[MODE_LOWER][MODE_UPPER] = 28;
|
|
115
|
+
table[MODE_MIXED][MODE_PUNCT] = 0;
|
|
116
|
+
table[MODE_DIGIT][MODE_PUNCT] = 0;
|
|
117
|
+
table[MODE_DIGIT][MODE_UPPER] = 15;
|
|
118
|
+
return table;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const std::array<std::array<int8_t, 6>, 6>& SHIFT_TABLE = InitShiftTable();
|
|
122
|
+
|
|
123
|
+
// Create a new state representing this state with a latch to a (not
|
|
124
|
+
// necessary different) mode, and then a code.
|
|
125
|
+
static EncodingState LatchAndAppend(const EncodingState& state, int mode, int value)
|
|
126
|
+
{
|
|
127
|
+
//assert binaryShiftByteCount == 0;
|
|
128
|
+
int bitCount = state.bitCount;
|
|
129
|
+
auto tokens = state.tokens;
|
|
130
|
+
if (mode != state.mode) {
|
|
131
|
+
int latch = LATCH_TABLE[state.mode][mode];
|
|
132
|
+
tokens.push_back(Token::CreateSimple(latch & 0xFFFF, latch >> 16));
|
|
133
|
+
bitCount += latch >> 16;
|
|
134
|
+
}
|
|
135
|
+
int latchModeBitCount = mode == MODE_DIGIT ? 4 : 5;
|
|
136
|
+
tokens.push_back(Token::CreateSimple(value, latchModeBitCount));
|
|
137
|
+
return EncodingState{ tokens, mode, 0, bitCount + latchModeBitCount };
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Create a new state representing this state, with a temporary shift
|
|
141
|
+
// to a different mode to output a single value.
|
|
142
|
+
static EncodingState ShiftAndAppend(const EncodingState& state, int mode, int value)
|
|
143
|
+
{
|
|
144
|
+
//assert binaryShiftByteCount == 0 && this.mode != mode;
|
|
145
|
+
int thisModeBitCount = state.mode == MODE_DIGIT ? 4 : 5;
|
|
146
|
+
// Shifts exist only to UPPER and PUNCT, both with tokens size 5.
|
|
147
|
+
auto tokens = state.tokens;
|
|
148
|
+
tokens.push_back(Token::CreateSimple(SHIFT_TABLE[state.mode][mode], thisModeBitCount));
|
|
149
|
+
tokens.push_back(Token::CreateSimple(value, 5));
|
|
150
|
+
return EncodingState{ tokens, state.mode, 0, state.bitCount + thisModeBitCount + 5 };
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Create the state identical to this one, but we are no longer in
|
|
154
|
+
// Binary Shift mode.
|
|
155
|
+
static EncodingState EndBinaryShift(const EncodingState& state, int index)
|
|
156
|
+
{
|
|
157
|
+
if (state.binaryShiftByteCount == 0) {
|
|
158
|
+
return state;
|
|
159
|
+
}
|
|
160
|
+
auto tokens = state.tokens;
|
|
161
|
+
tokens.push_back(Token::CreateBinaryShift(index - state.binaryShiftByteCount, state.binaryShiftByteCount));
|
|
162
|
+
//assert token.getTotalBitCount() == this.bitCount;
|
|
163
|
+
return EncodingState{ tokens, state.mode, 0, state.bitCount };
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Create a new state representing this state, but an additional character
|
|
167
|
+
// output in Binary Shift mode.
|
|
168
|
+
static EncodingState AddBinaryShiftChar(const EncodingState& state, int index)
|
|
169
|
+
{
|
|
170
|
+
auto tokens = state.tokens;
|
|
171
|
+
int mode = state.mode;
|
|
172
|
+
int bitCount = state.bitCount;
|
|
173
|
+
if (state.mode == MODE_PUNCT || state.mode == MODE_DIGIT) {
|
|
174
|
+
//assert binaryShiftByteCount == 0;
|
|
175
|
+
int latch = LATCH_TABLE[mode][MODE_UPPER];
|
|
176
|
+
tokens.push_back(Token::CreateSimple(latch & 0xFFFF, latch >> 16));
|
|
177
|
+
bitCount += latch >> 16;
|
|
178
|
+
mode = MODE_UPPER;
|
|
179
|
+
}
|
|
180
|
+
int deltaBitCount = (state.binaryShiftByteCount == 0 || state.binaryShiftByteCount == 31) ? 18 : (state.binaryShiftByteCount == 62) ? 9 : 8;
|
|
181
|
+
EncodingState result{ tokens, mode, state.binaryShiftByteCount + 1, bitCount + deltaBitCount };
|
|
182
|
+
if (result.binaryShiftByteCount == 2047 + 31) {
|
|
183
|
+
// The string is as long as it's allowed to be. We should end it.
|
|
184
|
+
result = EndBinaryShift(result, index + 1);
|
|
185
|
+
}
|
|
186
|
+
return result;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
static int CalculateBinaryShiftCost(const EncodingState& state)
|
|
190
|
+
{
|
|
191
|
+
if (state.binaryShiftByteCount > 62) {
|
|
192
|
+
return 21; // B/S with extended length
|
|
193
|
+
}
|
|
194
|
+
if (state.binaryShiftByteCount > 31) {
|
|
195
|
+
return 20; // two B/S
|
|
196
|
+
}
|
|
197
|
+
if (state.binaryShiftByteCount > 0) {
|
|
198
|
+
return 10; // one B/S
|
|
199
|
+
}
|
|
200
|
+
return 0;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Returns true if "this" state is better (or equal) to be in than "that"
|
|
204
|
+
// state under all possible circumstances.
|
|
205
|
+
static bool IsBetterThanOrEqualTo(const EncodingState& state, const EncodingState& other)
|
|
206
|
+
{
|
|
207
|
+
int newModeBitCount = state.bitCount + (LATCH_TABLE[state.mode][other.mode] >> 16);
|
|
208
|
+
if (state.binaryShiftByteCount < other.binaryShiftByteCount) {
|
|
209
|
+
// add additional B/S encoding cost of other, if any
|
|
210
|
+
newModeBitCount += CalculateBinaryShiftCost(other) - CalculateBinaryShiftCost(state);
|
|
211
|
+
}
|
|
212
|
+
else if (state.binaryShiftByteCount > other.binaryShiftByteCount && other.binaryShiftByteCount > 0) {
|
|
213
|
+
// maximum possible additional cost (we end up exceeding the 31 byte boundary and other state can stay beneath it)
|
|
214
|
+
newModeBitCount += 10;
|
|
215
|
+
}
|
|
216
|
+
return newModeBitCount <= other.bitCount;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
static BitArray ToBitArray(const EncodingState& state, const std::string& text)
|
|
220
|
+
{
|
|
221
|
+
auto endState = EndBinaryShift(state, Size(text));
|
|
222
|
+
BitArray bits;
|
|
223
|
+
// Add each token to the result.
|
|
224
|
+
for (const Token& symbol : endState.tokens) {
|
|
225
|
+
symbol.appendTo(bits, text);
|
|
226
|
+
}
|
|
227
|
+
//assert bitArray.getSize() == this.bitCount;
|
|
228
|
+
return bits;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
static void UpdateStateForPair(const EncodingState& state, int index, int pairCode, std::list<EncodingState>& result)
|
|
232
|
+
{
|
|
233
|
+
EncodingState stateNoBinary = EndBinaryShift(state, index);
|
|
234
|
+
// Possibility 1. Latch to MODE_PUNCT, and then append this code
|
|
235
|
+
result.push_back(LatchAndAppend(stateNoBinary, MODE_PUNCT, pairCode));
|
|
236
|
+
if (state.mode != MODE_PUNCT) {
|
|
237
|
+
// Possibility 2. Shift to MODE_PUNCT, and then append this code.
|
|
238
|
+
// Every state except MODE_PUNCT (handled above) can shift
|
|
239
|
+
result.push_back(ShiftAndAppend(stateNoBinary, MODE_PUNCT, pairCode));
|
|
240
|
+
}
|
|
241
|
+
if (pairCode == 3 || pairCode == 4) {
|
|
242
|
+
// both characters are in DIGITS. Sometimes better to just add two digits
|
|
243
|
+
auto digitState = LatchAndAppend(stateNoBinary, MODE_DIGIT, 16 - pairCode); // period or comma in DIGIT
|
|
244
|
+
result.push_back(LatchAndAppend(digitState, MODE_DIGIT, 1)); // space in DIGIT
|
|
245
|
+
}
|
|
246
|
+
if (state.binaryShiftByteCount > 0) {
|
|
247
|
+
// It only makes sense to do the characters as binary if we're already
|
|
248
|
+
// in binary mode.
|
|
249
|
+
result.push_back(AddBinaryShiftChar(AddBinaryShiftChar(state, index), index + 1));
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
static std::list<EncodingState> SimplifyStates(const std::list<EncodingState>& states)
|
|
255
|
+
{
|
|
256
|
+
std::list<EncodingState> result;
|
|
257
|
+
for (auto& newState : states) {
|
|
258
|
+
bool add = true;
|
|
259
|
+
for (auto iterator = result.begin(); iterator != result.end();) {
|
|
260
|
+
auto& oldState = *iterator;
|
|
261
|
+
if (IsBetterThanOrEqualTo(oldState, newState)) {
|
|
262
|
+
add = false;
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
if (IsBetterThanOrEqualTo(newState, oldState)) {
|
|
266
|
+
iterator = result.erase(iterator);
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
++iterator;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
if (add) {
|
|
273
|
+
result.push_back(newState);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return result;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
static std::list<EncodingState> UpdateStateListForPair(const std::list<EncodingState>& states, int index, int pairCode)
|
|
280
|
+
{
|
|
281
|
+
std::list<EncodingState> result;
|
|
282
|
+
for (auto& state : states) {
|
|
283
|
+
UpdateStateForPair(state, index, pairCode, result);
|
|
284
|
+
}
|
|
285
|
+
return SimplifyStates(result);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
// Return a set of states that represent the possible ways of updating this
|
|
291
|
+
// state for the next character. The resulting set of states are added to
|
|
292
|
+
// the "result" list.
|
|
293
|
+
static void UpdateStateForChar(const EncodingState& state, const std::string& text, int index, std::list<EncodingState>& result)
|
|
294
|
+
{
|
|
295
|
+
int ch = text[index] & 0xff;
|
|
296
|
+
bool charInCurrentTable = CHAR_MAP[state.mode][ch] > 0;
|
|
297
|
+
EncodingState stateNoBinary;
|
|
298
|
+
bool firstTime = true;
|
|
299
|
+
for (int mode = 0; mode <= MODE_PUNCT; mode++) {
|
|
300
|
+
int charInMode = CHAR_MAP[mode][ch];
|
|
301
|
+
if (charInMode > 0) {
|
|
302
|
+
if (firstTime) {
|
|
303
|
+
// Only create stateNoBinary the first time it's required.
|
|
304
|
+
stateNoBinary = EndBinaryShift(state, index);
|
|
305
|
+
firstTime = false;
|
|
306
|
+
}
|
|
307
|
+
// Try generating the character by latching to its mode
|
|
308
|
+
if (!charInCurrentTable || mode == state.mode || mode == MODE_DIGIT) {
|
|
309
|
+
// If the character is in the current table, we don't want to latch to
|
|
310
|
+
// any other mode except possibly digit (which uses only 4 bits). Any
|
|
311
|
+
// other latch would be equally successful *after* this character, and
|
|
312
|
+
// so wouldn't save any bits.
|
|
313
|
+
result.push_back(LatchAndAppend(stateNoBinary, mode, charInMode));
|
|
314
|
+
}
|
|
315
|
+
// Try generating the character by switching to its mode.
|
|
316
|
+
if (!charInCurrentTable && SHIFT_TABLE[state.mode][mode] >= 0) {
|
|
317
|
+
// It never makes sense to temporarily shift to another mode if the
|
|
318
|
+
// character exists in the current mode. That can never save bits.
|
|
319
|
+
result.push_back(ShiftAndAppend(stateNoBinary, mode, charInMode));
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
if (state.binaryShiftByteCount > 0 || CHAR_MAP[state.mode][ch] == 0) {
|
|
324
|
+
// It's never worthwhile to go into binary shift mode if you're not already
|
|
325
|
+
// in binary shift mode, and the character exists in your current mode.
|
|
326
|
+
// That can never save bits over just outputting the char in the current mode.
|
|
327
|
+
result.push_back(AddBinaryShiftChar(state, index));
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// We update a set of states for a new character by updating each state
|
|
332
|
+
// for the new character, merging the results, and then removing the
|
|
333
|
+
// non-optimal states.
|
|
334
|
+
static std::list<EncodingState> UpdateStateListForChar(const std::list<EncodingState>& states, const std::string& text, int index)
|
|
335
|
+
{
|
|
336
|
+
std::list<EncodingState> result;
|
|
337
|
+
for (auto& state : states) {
|
|
338
|
+
UpdateStateForChar(state, text, index, result);
|
|
339
|
+
}
|
|
340
|
+
return result.size() > 1 ? SimplifyStates(result) : result;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* @return text represented by this encoder encoded as a {@link BitArray}
|
|
345
|
+
*/
|
|
346
|
+
BitArray
|
|
347
|
+
HighLevelEncoder::Encode(const std::string& text)
|
|
348
|
+
{
|
|
349
|
+
std::list<EncodingState> states;
|
|
350
|
+
states.push_back(EncodingState{ std::vector<Token>(), MODE_UPPER, 0, 0 });
|
|
351
|
+
for (int index = 0; index < Size(text); index++) {
|
|
352
|
+
int pairCode;
|
|
353
|
+
int nextChar = index + 1 < Size(text) ? text[index + 1] : 0;
|
|
354
|
+
switch (text[index]) {
|
|
355
|
+
case '\r': pairCode = nextChar == '\n' ? 2 : 0; break;
|
|
356
|
+
case '.': pairCode = nextChar == ' ' ? 3 : 0; break;
|
|
357
|
+
case ',': pairCode = nextChar == ' ' ? 4 : 0; break;
|
|
358
|
+
case ':': pairCode = nextChar == ' ' ? 5 : 0; break;
|
|
359
|
+
default: pairCode = 0;
|
|
360
|
+
}
|
|
361
|
+
if (pairCode > 0) {
|
|
362
|
+
// We have one of the four special PUNCT pairs. Treat them specially.
|
|
363
|
+
// Get a new set of states for the two new characters.
|
|
364
|
+
states = UpdateStateListForPair(states, index, pairCode);
|
|
365
|
+
index++;
|
|
366
|
+
} else {
|
|
367
|
+
// Get a new set of states for the new character.
|
|
368
|
+
states = UpdateStateListForChar(states, text, index);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
// We are left with a set of states. Find the shortest one.
|
|
372
|
+
EncodingState minState = *std::min_element(states.begin(), states.end(), [](const EncodingState& a, const EncodingState& b) { return a.bitCount < b.bitCount; });
|
|
373
|
+
// Convert it to a bit array, and return.
|
|
374
|
+
return ToBitArray(minState, text);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
} // namespace ZXing::Aztec
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Huy Cuong Nguyen
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#pragma once
|
|
8
|
+
|
|
9
|
+
#include <string>
|
|
10
|
+
|
|
11
|
+
namespace ZXing {
|
|
12
|
+
|
|
13
|
+
class BitArray;
|
|
14
|
+
|
|
15
|
+
namespace Aztec {
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* This produces nearly optimal encodings of text into the first-level of
|
|
19
|
+
* encoding used by Aztec code.
|
|
20
|
+
*
|
|
21
|
+
* It uses a dynamic algorithm. For each prefix of the string, it determines
|
|
22
|
+
* a set of encodings that could lead to this prefix. We repeatedly add a
|
|
23
|
+
* character and generate a new set of optimal encodings until we have read
|
|
24
|
+
* through the entire input.
|
|
25
|
+
*
|
|
26
|
+
* @author Frank Yellin
|
|
27
|
+
* @author Rustam Abdullaev
|
|
28
|
+
*/
|
|
29
|
+
class HighLevelEncoder
|
|
30
|
+
{
|
|
31
|
+
public:
|
|
32
|
+
static BitArray Encode(const std::string& text);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
} // Aztec
|
|
36
|
+
} // ZXing
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Nu-book Inc.
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
* Copyright 2022 Axel Waggershauser
|
|
5
|
+
*/
|
|
6
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
|
|
8
|
+
#include "AZReader.h"
|
|
9
|
+
|
|
10
|
+
#include "AZDecoder.h"
|
|
11
|
+
#include "AZDetector.h"
|
|
12
|
+
#include "AZDetectorResult.h"
|
|
13
|
+
#include "BinaryBitmap.h"
|
|
14
|
+
#include "ReaderOptions.h"
|
|
15
|
+
#include "DecoderResult.h"
|
|
16
|
+
#include "BarcodeData.h"
|
|
17
|
+
|
|
18
|
+
#include <utility>
|
|
19
|
+
|
|
20
|
+
namespace ZXing::Aztec {
|
|
21
|
+
|
|
22
|
+
BarcodesData Reader::read(const BinaryBitmap& image, int maxSymbols) const
|
|
23
|
+
{
|
|
24
|
+
auto binImg = image.getBitMatrix();
|
|
25
|
+
if (binImg == nullptr)
|
|
26
|
+
return {};
|
|
27
|
+
|
|
28
|
+
auto detRess = Detect(*binImg, _opts.isPure(), _opts.tryHarder(), maxSymbols, _opts.hasFormat(BarcodeFormat::AztecCode),
|
|
29
|
+
_opts.hasFormat(BarcodeFormat::AztecRune));
|
|
30
|
+
|
|
31
|
+
BarcodesData res;
|
|
32
|
+
for (auto&& detRes : detRess) {
|
|
33
|
+
auto decRes =
|
|
34
|
+
Decode(detRes).setReaderInit(detRes.readerInit()).setIsMirrored(detRes.isMirrored()).setVersionNumber(detRes.nbLayers());
|
|
35
|
+
if (decRes.isValid(_opts.returnErrors())) {
|
|
36
|
+
res.emplace_back(MatrixBarcode(std::move(decRes), std::move(detRes), BarcodeFormat::Aztec));
|
|
37
|
+
if (maxSymbols > 0 && Size(res) >= maxSymbols)
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return res;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
} // namespace ZXing::Aztec
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Nu-book Inc.
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#pragma once
|
|
8
|
+
|
|
9
|
+
#include "Reader.h"
|
|
10
|
+
|
|
11
|
+
namespace ZXing::Aztec {
|
|
12
|
+
|
|
13
|
+
class Reader : public ZXing::Reader
|
|
14
|
+
{
|
|
15
|
+
public:
|
|
16
|
+
using ZXing::Reader::Reader;
|
|
17
|
+
|
|
18
|
+
BarcodesData read(const BinaryBitmap& image, int maxSymbols) const override;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
} // namespace ZXing::Aztec
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Huy Cuong Nguyen
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#include "AZToken.h"
|
|
8
|
+
|
|
9
|
+
#include "BitArray.h"
|
|
10
|
+
|
|
11
|
+
#include <algorithm>
|
|
12
|
+
|
|
13
|
+
namespace ZXing::Aztec {
|
|
14
|
+
|
|
15
|
+
void
|
|
16
|
+
Token::appendTo(BitArray& bitArray, const std::string& text) const
|
|
17
|
+
{
|
|
18
|
+
if (_count < 0) {
|
|
19
|
+
bitArray.appendBits(_value, -_count);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
for (int i = 0; i < _count; i++) {
|
|
23
|
+
if (i == 0 || (i == 31 && _count <= 62)) {
|
|
24
|
+
// We need a header before the first character, and before
|
|
25
|
+
// character 31 when the total byte code is <= 62
|
|
26
|
+
bitArray.appendBits(31, 5); // BINARY_SHIFT
|
|
27
|
+
if (_count > 62) {
|
|
28
|
+
bitArray.appendBits(_count - 31, 16);
|
|
29
|
+
}
|
|
30
|
+
else if (i == 0) {
|
|
31
|
+
// 1 <= binaryShiftByteCode <= 62
|
|
32
|
+
bitArray.appendBits(std::min((int)_count, 31), 5);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
// 32 <= binaryShiftCount <= 62 and i == 31
|
|
36
|
+
bitArray.appendBits(_count - 31, 5);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
bitArray.appendBits(text[_value + i], 8);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
} // namespace ZXing::Aztec
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Huy Cuong Nguyen
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#pragma once
|
|
8
|
+
|
|
9
|
+
#include <string>
|
|
10
|
+
|
|
11
|
+
namespace ZXing {
|
|
12
|
+
|
|
13
|
+
class BitArray;
|
|
14
|
+
|
|
15
|
+
namespace Aztec {
|
|
16
|
+
|
|
17
|
+
class Token
|
|
18
|
+
{
|
|
19
|
+
public:
|
|
20
|
+
void appendTo(BitArray& bitArray, const std::string& text) const;
|
|
21
|
+
|
|
22
|
+
static Token CreateSimple(int value, int bitCount) {
|
|
23
|
+
return {value, -bitCount};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static Token CreateBinaryShift(int start, int byteCount) {
|
|
27
|
+
return {start, byteCount};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
private:
|
|
31
|
+
short _value;
|
|
32
|
+
short _count; // is simple token if negative,
|
|
33
|
+
|
|
34
|
+
public:
|
|
35
|
+
Token(int value, int count) : _value((short)value), _count((short)count) {}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
} // Aztec
|
|
39
|
+
} // ZXing
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Huy Cuong Nguyen
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#include "AZWriter.h"
|
|
8
|
+
|
|
9
|
+
#include "AZEncoder.h"
|
|
10
|
+
#include "CharacterSet.h"
|
|
11
|
+
#include "TextEncoder.h"
|
|
12
|
+
#include "Utf.h"
|
|
13
|
+
|
|
14
|
+
#include <utility>
|
|
15
|
+
|
|
16
|
+
namespace ZXing::Aztec {
|
|
17
|
+
|
|
18
|
+
Writer::Writer() :
|
|
19
|
+
_encoding(CharacterSet::ISO8859_1),
|
|
20
|
+
_eccPercent(Encoder::DEFAULT_EC_PERCENT),
|
|
21
|
+
_layers(Encoder::DEFAULT_AZTEC_LAYERS)
|
|
22
|
+
{
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
BitMatrix
|
|
26
|
+
Writer::encode(const std::wstring& contents, int width, int height) const
|
|
27
|
+
{
|
|
28
|
+
std::string bytes = TextEncoder::FromUnicode(contents, _encoding);
|
|
29
|
+
EncodeResult aztec = Encoder::Encode(bytes, _eccPercent, _layers);
|
|
30
|
+
return Inflate(std::move(aztec.matrix), width, height, _margin);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
BitMatrix Writer::encode(const std::string& contents, int width, int height) const
|
|
34
|
+
{
|
|
35
|
+
return encode(FromUtf8(contents), width, height);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
} // namespace ZXing::Aztec
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Huy Cuong Nguyen
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#pragma once
|
|
8
|
+
|
|
9
|
+
#include "CharacterSet.h"
|
|
10
|
+
|
|
11
|
+
#include <string>
|
|
12
|
+
|
|
13
|
+
namespace ZXing {
|
|
14
|
+
|
|
15
|
+
class BitMatrix;
|
|
16
|
+
|
|
17
|
+
namespace Aztec {
|
|
18
|
+
|
|
19
|
+
class Writer
|
|
20
|
+
{
|
|
21
|
+
public:
|
|
22
|
+
Writer();
|
|
23
|
+
|
|
24
|
+
Writer& setMargin(int margin) {
|
|
25
|
+
_margin = margin;
|
|
26
|
+
return *this;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
Writer& setEncoding(CharacterSet encoding) {
|
|
30
|
+
_encoding = encoding;
|
|
31
|
+
return *this;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
Writer& setEccPercent(int percent) {
|
|
35
|
+
_eccPercent = percent;
|
|
36
|
+
return *this;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
Writer& setLayers(int layers) {
|
|
40
|
+
_layers = layers;
|
|
41
|
+
return *this;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
BitMatrix encode(const std::wstring& contents, int width, int height) const;
|
|
45
|
+
BitMatrix encode(const std::string& contents, int width, int height) const;
|
|
46
|
+
|
|
47
|
+
private:
|
|
48
|
+
CharacterSet _encoding;
|
|
49
|
+
int _eccPercent;
|
|
50
|
+
int _layers;
|
|
51
|
+
int _margin = 0;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
} // Aztec
|
|
55
|
+
} // ZXing
|