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,318 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Huy Cuong Nguyen
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#include "AZEncoder.h"
|
|
8
|
+
|
|
9
|
+
#include "AZHighLevelEncoder.h"
|
|
10
|
+
#include "BitArray.h"
|
|
11
|
+
#include "ReedSolomon.h"
|
|
12
|
+
#include "ZXTestSupport.h"
|
|
13
|
+
|
|
14
|
+
#include <cstdlib>
|
|
15
|
+
#include <stdexcept>
|
|
16
|
+
#include <vector>
|
|
17
|
+
|
|
18
|
+
namespace ZXing::Aztec {
|
|
19
|
+
|
|
20
|
+
static const int MAX_NB_BITS = 32;
|
|
21
|
+
static const int MAX_NB_BITS_COMPACT = 4;
|
|
22
|
+
|
|
23
|
+
static const int WORD_SIZE[] = {4, 6, 6, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10,
|
|
24
|
+
10, 10, 10, 10, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12};
|
|
25
|
+
|
|
26
|
+
static void DrawBullsEye(BitMatrix& matrix, int center, int size)
|
|
27
|
+
{
|
|
28
|
+
for (int i = 0; i < size; i += 2) {
|
|
29
|
+
for (int j = center - i; j <= center + i; j++) {
|
|
30
|
+
matrix.set(j, center - i);
|
|
31
|
+
matrix.set(j, center + i);
|
|
32
|
+
matrix.set(center - i, j);
|
|
33
|
+
matrix.set(center + i, j);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
matrix.set(center - size, center - size);
|
|
37
|
+
matrix.set(center - size + 1, center - size);
|
|
38
|
+
matrix.set(center - size, center - size + 1);
|
|
39
|
+
matrix.set(center + size, center - size);
|
|
40
|
+
matrix.set(center + size, center - size + 1);
|
|
41
|
+
matrix.set(center + size, center + size - 1);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static void GenerateCheckWords(const BitArray& bitArray, int totalBits, int wordSize, BitArray& messageBits)
|
|
45
|
+
{
|
|
46
|
+
// bitArray is guaranteed to be a multiple of the wordSize, so no padding needed
|
|
47
|
+
std::vector<int> messageWords = ToInts(bitArray, wordSize, totalBits / wordSize);
|
|
48
|
+
ReedSolomonEncode(GF2nAztec(wordSize), messageWords, (totalBits - bitArray.size()) / wordSize);
|
|
49
|
+
messageBits = BitArray();
|
|
50
|
+
if (int startPad = totalBits % wordSize)
|
|
51
|
+
messageBits.appendBits(0, startPad);
|
|
52
|
+
for (int messageWord : messageWords)
|
|
53
|
+
messageBits.appendBits(messageWord, wordSize);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
ZXING_EXPORT_TEST_ONLY
|
|
57
|
+
void GenerateModeMessage(bool compact, int layers, int messageSizeInWords, BitArray& modeMessage)
|
|
58
|
+
{
|
|
59
|
+
modeMessage = BitArray();
|
|
60
|
+
if (compact) {
|
|
61
|
+
modeMessage.appendBits(layers - 1, 2);
|
|
62
|
+
modeMessage.appendBits(messageSizeInWords - 1, 6);
|
|
63
|
+
GenerateCheckWords(modeMessage, 28, 4, modeMessage);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
modeMessage.appendBits(layers - 1, 5);
|
|
67
|
+
modeMessage.appendBits(messageSizeInWords - 1, 11);
|
|
68
|
+
GenerateCheckWords(modeMessage, 40, 4, modeMessage);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
ZXING_EXPORT_TEST_ONLY
|
|
73
|
+
void GenerateRuneMessage(uint8_t word, BitArray& runeMessage)
|
|
74
|
+
{
|
|
75
|
+
runeMessage = BitArray();
|
|
76
|
+
runeMessage.appendBits(word, 8);
|
|
77
|
+
GenerateCheckWords(runeMessage, 28, 4, runeMessage);
|
|
78
|
+
// Now flip every other bit
|
|
79
|
+
|
|
80
|
+
BitArray xorBits;
|
|
81
|
+
xorBits.appendBits(0xAAAAAAAA, 28);
|
|
82
|
+
runeMessage.bitwiseXOR(xorBits);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
static void DrawModeMessage(BitMatrix& matrix, bool compact, int matrixSize, const BitArray& modeMessage)
|
|
86
|
+
{
|
|
87
|
+
int center = matrixSize / 2;
|
|
88
|
+
if (compact) {
|
|
89
|
+
for (int i = 0; i < 7; i++) {
|
|
90
|
+
int offset = center - 3 + i;
|
|
91
|
+
if (modeMessage.get(i)) {
|
|
92
|
+
matrix.set(offset, center - 5);
|
|
93
|
+
}
|
|
94
|
+
if (modeMessage.get(i + 7)) {
|
|
95
|
+
matrix.set(center + 5, offset);
|
|
96
|
+
}
|
|
97
|
+
if (modeMessage.get(20 - i)) {
|
|
98
|
+
matrix.set(offset, center + 5);
|
|
99
|
+
}
|
|
100
|
+
if (modeMessage.get(27 - i)) {
|
|
101
|
+
matrix.set(center - 5, offset);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
for (int i = 0; i < 10; i++) {
|
|
107
|
+
int offset = center - 5 + i + i / 5;
|
|
108
|
+
if (modeMessage.get(i)) {
|
|
109
|
+
matrix.set(offset, center - 7);
|
|
110
|
+
}
|
|
111
|
+
if (modeMessage.get(i + 10)) {
|
|
112
|
+
matrix.set(center + 7, offset);
|
|
113
|
+
}
|
|
114
|
+
if (modeMessage.get(29 - i)) {
|
|
115
|
+
matrix.set(offset, center + 7);
|
|
116
|
+
}
|
|
117
|
+
if (modeMessage.get(39 - i)) {
|
|
118
|
+
matrix.set(center - 7, offset);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
ZXING_EXPORT_TEST_ONLY
|
|
125
|
+
void StuffBits(const BitArray& bits, int wordSize, BitArray& out)
|
|
126
|
+
{
|
|
127
|
+
out = BitArray();
|
|
128
|
+
int n = bits.size();
|
|
129
|
+
int mask = (1 << wordSize) - 2;
|
|
130
|
+
for (int i = 0; i < n; i += wordSize) {
|
|
131
|
+
int word = 0;
|
|
132
|
+
for (int j = 0; j < wordSize; j++) {
|
|
133
|
+
if (i + j >= n || bits.get(i + j)) {
|
|
134
|
+
word |= 1 << (wordSize - 1 - j);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if ((word & mask) == mask) {
|
|
138
|
+
out.appendBits(word & mask, wordSize);
|
|
139
|
+
i--;
|
|
140
|
+
}
|
|
141
|
+
else if ((word & mask) == 0) {
|
|
142
|
+
out.appendBits(word | 1, wordSize);
|
|
143
|
+
i--;
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
out.appendBits(word, wordSize);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
static int TotalBitsInLayer(int layers, bool compact)
|
|
152
|
+
{
|
|
153
|
+
return ((compact ? 88 : 112) + 16 * layers) * layers;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Encodes the given binary content as an Aztec symbol
|
|
158
|
+
*
|
|
159
|
+
* @param data input data string
|
|
160
|
+
* @param minECCPercent minimal percentage of error check words (According to ISO/IEC 24778:2008,
|
|
161
|
+
* a minimum of 23% + 3 words is recommended)
|
|
162
|
+
* @param userSpecifiedLayers if non-zero, a user-specified value for the number of layers
|
|
163
|
+
* @return Aztec symbol matrix with metadata
|
|
164
|
+
*/
|
|
165
|
+
EncodeResult
|
|
166
|
+
Encoder::Encode(const std::string& data, int minECCPercent, int userSpecifiedLayers)
|
|
167
|
+
{
|
|
168
|
+
// High-level encode
|
|
169
|
+
BitArray bits = HighLevelEncoder::Encode(data);
|
|
170
|
+
|
|
171
|
+
// stuff bits and choose symbol size
|
|
172
|
+
int eccBits = bits.size() * minECCPercent / 100 + 11;
|
|
173
|
+
int totalSizeBits = bits.size() + eccBits;
|
|
174
|
+
bool compact;
|
|
175
|
+
int layers;
|
|
176
|
+
int totalBitsInLayer;
|
|
177
|
+
int wordSize;
|
|
178
|
+
BitArray stuffedBits;
|
|
179
|
+
if (userSpecifiedLayers == AZTEC_RUNE_LAYERS) {
|
|
180
|
+
compact = true;
|
|
181
|
+
layers = 0;
|
|
182
|
+
totalBitsInLayer = 0;
|
|
183
|
+
wordSize = 0;
|
|
184
|
+
stuffedBits = BitArray(0);
|
|
185
|
+
} else if (userSpecifiedLayers != DEFAULT_AZTEC_LAYERS) {
|
|
186
|
+
compact = userSpecifiedLayers < 0;
|
|
187
|
+
layers = std::abs(userSpecifiedLayers);
|
|
188
|
+
if (layers > (compact ? MAX_NB_BITS_COMPACT : MAX_NB_BITS)) {
|
|
189
|
+
throw std::invalid_argument("Illegal value for layers: " + std::to_string(userSpecifiedLayers));
|
|
190
|
+
}
|
|
191
|
+
totalBitsInLayer = TotalBitsInLayer(layers, compact);
|
|
192
|
+
wordSize = WORD_SIZE[layers];
|
|
193
|
+
int usableBitsInLayers = totalBitsInLayer - (totalBitsInLayer % wordSize);
|
|
194
|
+
StuffBits(bits, wordSize, stuffedBits);
|
|
195
|
+
if (stuffedBits.size() + eccBits > usableBitsInLayers) {
|
|
196
|
+
throw std::invalid_argument("Data to large for user specified layer");
|
|
197
|
+
}
|
|
198
|
+
if (compact && stuffedBits.size() > wordSize * 64) {
|
|
199
|
+
// Compact format only allows 64 data words, though C4 can hold more words than that
|
|
200
|
+
throw std::invalid_argument("Data to large for user specified layer");
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
wordSize = 0;
|
|
205
|
+
// We look at the possible table sizes in the order Compact1, Compact2, Compact3,
|
|
206
|
+
// Compact4, Normal4,... Normal(i) for i < 4 isn't typically used since Compact(i+1)
|
|
207
|
+
// is the same size, but has more data.
|
|
208
|
+
for (int i = 0; ; i++) {
|
|
209
|
+
if (i > MAX_NB_BITS) {
|
|
210
|
+
throw std::invalid_argument("Data too large for an Aztec code");
|
|
211
|
+
}
|
|
212
|
+
compact = i <= 3;
|
|
213
|
+
layers = compact ? i + 1 : i;
|
|
214
|
+
totalBitsInLayer = TotalBitsInLayer(layers, compact);
|
|
215
|
+
if (totalSizeBits > totalBitsInLayer) {
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
// [Re]stuff the bits if this is the first opportunity, or if the
|
|
219
|
+
// wordSize has changed
|
|
220
|
+
if (wordSize != WORD_SIZE[layers]) {
|
|
221
|
+
wordSize = WORD_SIZE[layers];
|
|
222
|
+
StuffBits(bits, wordSize, stuffedBits);
|
|
223
|
+
}
|
|
224
|
+
int usableBitsInLayers = totalBitsInLayer - (totalBitsInLayer % wordSize);
|
|
225
|
+
if (compact && stuffedBits.size() > wordSize * 64) {
|
|
226
|
+
// Compact format only allows 64 data words, though C4 can hold more words than that
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
if (stuffedBits.size() + eccBits <= usableBitsInLayers) {
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
BitArray messageBits;
|
|
236
|
+
BitArray modeMessage;
|
|
237
|
+
int messageSizeInWords;
|
|
238
|
+
|
|
239
|
+
if (layers == 0) {
|
|
240
|
+
// This is a rune, and messageBits should be empty
|
|
241
|
+
messageBits = BitArray(0);
|
|
242
|
+
messageSizeInWords = 0;
|
|
243
|
+
GenerateRuneMessage(data[0], modeMessage);
|
|
244
|
+
} else {
|
|
245
|
+
GenerateCheckWords(stuffedBits, totalBitsInLayer, wordSize, messageBits);
|
|
246
|
+
messageSizeInWords = stuffedBits.size() / wordSize;
|
|
247
|
+
GenerateModeMessage(compact, layers, messageSizeInWords, modeMessage);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// allocate symbol
|
|
251
|
+
int baseMatrixSize = (compact ? 11 : 14) + layers * 4; // not including alignment lines
|
|
252
|
+
std::vector<int> alignmentMap(baseMatrixSize, 0);
|
|
253
|
+
int matrixSize;
|
|
254
|
+
if (compact) {
|
|
255
|
+
// no alignment marks in compact mode, alignmentMap is a no-op
|
|
256
|
+
matrixSize = baseMatrixSize;
|
|
257
|
+
std::iota(alignmentMap.begin(), alignmentMap.end(), 0);
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
matrixSize = baseMatrixSize + 1 + 2 * ((baseMatrixSize / 2 - 1) / 15);
|
|
261
|
+
int origCenter = baseMatrixSize / 2;
|
|
262
|
+
int center = matrixSize / 2;
|
|
263
|
+
for (int i = 0; i < origCenter; i++) {
|
|
264
|
+
int newOffset = i + i / 15;
|
|
265
|
+
alignmentMap[origCenter - i - 1] = center - newOffset - 1;
|
|
266
|
+
alignmentMap[origCenter + i] = center + newOffset + 1;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
EncodeResult output{compact, matrixSize, layers, messageSizeInWords, BitMatrix(matrixSize)};
|
|
271
|
+
|
|
272
|
+
BitMatrix& matrix = output.matrix;
|
|
273
|
+
|
|
274
|
+
// draw data bits
|
|
275
|
+
for (int i = 0, rowOffset = 0; i < layers; i++) {
|
|
276
|
+
int rowSize = (layers - i) * 4 + (compact ? 9 : 12);
|
|
277
|
+
for (int j = 0; j < rowSize; j++) {
|
|
278
|
+
int columnOffset = j * 2;
|
|
279
|
+
for (int k = 0; k < 2; k++) {
|
|
280
|
+
if (messageBits.get(rowOffset + columnOffset + k)) {
|
|
281
|
+
matrix.set(alignmentMap[i * 2 + k], alignmentMap[i * 2 + j]);
|
|
282
|
+
}
|
|
283
|
+
if (messageBits.get(rowOffset + rowSize * 2 + columnOffset + k)) {
|
|
284
|
+
matrix.set(alignmentMap[i * 2 + j], alignmentMap[baseMatrixSize - 1 - i * 2 - k]);
|
|
285
|
+
}
|
|
286
|
+
if (messageBits.get(rowOffset + rowSize * 4 + columnOffset + k)) {
|
|
287
|
+
matrix.set(alignmentMap[baseMatrixSize - 1 - i * 2 - k], alignmentMap[baseMatrixSize - 1 - i * 2 - j]);
|
|
288
|
+
}
|
|
289
|
+
if (messageBits.get(rowOffset + rowSize * 6 + columnOffset + k)) {
|
|
290
|
+
matrix.set(alignmentMap[baseMatrixSize - 1 - i * 2 - j], alignmentMap[i * 2 + k]);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
rowOffset += rowSize * 8;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// draw mode message
|
|
298
|
+
DrawModeMessage(matrix, compact, matrixSize, modeMessage);
|
|
299
|
+
|
|
300
|
+
// draw alignment marks
|
|
301
|
+
if (compact) {
|
|
302
|
+
DrawBullsEye(matrix, matrixSize / 2, 5);
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
DrawBullsEye(matrix, matrixSize / 2, 7);
|
|
306
|
+
for (int i = 0, j = 0; i < baseMatrixSize / 2 - 1; i += 15, j += 16) {
|
|
307
|
+
for (int k = (matrixSize / 2) & 1; k < matrixSize; k += 2) {
|
|
308
|
+
matrix.set(matrixSize / 2 - j, k);
|
|
309
|
+
matrix.set(matrixSize / 2 + j, k);
|
|
310
|
+
matrix.set(k, matrixSize / 2 - j);
|
|
311
|
+
matrix.set(k, matrixSize / 2 + j);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return output;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
} // 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
|
+
#pragma once
|
|
8
|
+
|
|
9
|
+
#include "BitMatrix.h"
|
|
10
|
+
|
|
11
|
+
#include <string>
|
|
12
|
+
|
|
13
|
+
namespace ZXing::Aztec {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Aztec 2D code representation
|
|
17
|
+
*
|
|
18
|
+
* @author Rustam Abdullaev
|
|
19
|
+
*/
|
|
20
|
+
struct EncodeResult
|
|
21
|
+
{
|
|
22
|
+
bool compact;
|
|
23
|
+
int size;
|
|
24
|
+
int layers;
|
|
25
|
+
int codeWords;
|
|
26
|
+
BitMatrix matrix;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Generates Aztec 2D barcodes.
|
|
31
|
+
*
|
|
32
|
+
* @author Rustam Abdullaev
|
|
33
|
+
*/
|
|
34
|
+
class Encoder
|
|
35
|
+
{
|
|
36
|
+
public:
|
|
37
|
+
static const int DEFAULT_EC_PERCENT = 33; // default minimal percentage of error check words
|
|
38
|
+
static const int DEFAULT_AZTEC_LAYERS = 0;
|
|
39
|
+
static const int AZTEC_RUNE_LAYERS = 0xFF;
|
|
40
|
+
|
|
41
|
+
static EncodeResult Encode(const std::string& data, int minECCPercent, int userSpecifiedLayers);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
} // namespace ZXing::Aztec
|
|
@@ -0,0 +1,40 @@
|
|
|
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 "AZToken.h"
|
|
10
|
+
|
|
11
|
+
#include <vector>
|
|
12
|
+
|
|
13
|
+
namespace ZXing::Aztec {
|
|
14
|
+
|
|
15
|
+
class Token;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* State represents all information about a sequence necessary to generate the current output.
|
|
19
|
+
* Note that a state is immutable.
|
|
20
|
+
*/
|
|
21
|
+
class EncodingState
|
|
22
|
+
{
|
|
23
|
+
public:
|
|
24
|
+
// The list of tokens that we output. If we are in Binary Shift mode, this
|
|
25
|
+
// token list does *not* yet included the token for those bytes
|
|
26
|
+
std::vector<Token> tokens;
|
|
27
|
+
|
|
28
|
+
// The current mode of the encoding (or the mode to which we'll return if
|
|
29
|
+
// we're in Binary Shift mode.
|
|
30
|
+
int mode = 0;
|
|
31
|
+
|
|
32
|
+
// If non-zero, the number of most recent bytes that should be output
|
|
33
|
+
// in Binary Shift mode.
|
|
34
|
+
int binaryShiftByteCount = 0;
|
|
35
|
+
|
|
36
|
+
// The total number of bits generated (including Binary Shift).
|
|
37
|
+
int bitCount = 0;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
} // namespace ZXing::Aztec
|