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,176 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Huy Cuong Nguyen
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#include "ODCode39Writer.h"
|
|
8
|
+
|
|
9
|
+
#include "CharacterSet.h"
|
|
10
|
+
#include "ODWriterHelper.h"
|
|
11
|
+
#include "TextEncoder.h"
|
|
12
|
+
#include "Utf.h"
|
|
13
|
+
#include "ZXAlgorithms.h"
|
|
14
|
+
|
|
15
|
+
#include <array>
|
|
16
|
+
#include <stdexcept>
|
|
17
|
+
#include <vector>
|
|
18
|
+
|
|
19
|
+
namespace ZXing::OneD {
|
|
20
|
+
|
|
21
|
+
static constexpr char ALPHABET[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* These represent the encodings of characters, as patterns of wide and narrow bars.
|
|
25
|
+
* The 9 least-significant bits of each int correspond to the pattern of wide and narrow,
|
|
26
|
+
* with 1s representing "wide" and 0s representing narrow.
|
|
27
|
+
*/
|
|
28
|
+
static constexpr int CHARACTER_ENCODINGS[] = {
|
|
29
|
+
0x034, 0x121, 0x061, 0x160, 0x031, 0x130, 0x070, 0x025, 0x124, 0x064, // 0-9
|
|
30
|
+
0x109, 0x049, 0x148, 0x019, 0x118, 0x058, 0x00D, 0x10C, 0x04C, 0x01C, // A-J
|
|
31
|
+
0x103, 0x043, 0x142, 0x013, 0x112, 0x052, 0x007, 0x106, 0x046, 0x016, // K-T
|
|
32
|
+
0x181, 0x0C1, 0x1C0, 0x091, 0x190, 0x0D0, 0x085, 0x184, 0x0C4, 0x094, // U-*
|
|
33
|
+
0x0A8, 0x0A2, 0x08A, 0x02A // $-%
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
static_assert(Size(ALPHABET) == Size(CHARACTER_ENCODINGS), "table size mismatch");
|
|
37
|
+
|
|
38
|
+
static const int ASTERISK_ENCODING = CHARACTER_ENCODINGS[39];
|
|
39
|
+
|
|
40
|
+
static void ToIntArray(int a, std::array<int, 9>& toReturn) {
|
|
41
|
+
for (int i = 0; i < 9; ++i) {
|
|
42
|
+
toReturn[i] = (a & (1 << (8 - i))) == 0 ? 1 : 2;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static std::string ToHexString(int c)
|
|
47
|
+
{
|
|
48
|
+
const char* digits = "0123456789abcdef";
|
|
49
|
+
std::string val(4, '0');
|
|
50
|
+
val[1] = 'x';
|
|
51
|
+
val[2] = digits[(c >> 4) & 0xf];
|
|
52
|
+
val[3] = digits[c & 0xf];
|
|
53
|
+
return val;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static std::string TryToConvertToExtendedMode(const std::wstring& contents) {
|
|
57
|
+
size_t length = contents.length();
|
|
58
|
+
std::string extendedContent;
|
|
59
|
+
extendedContent.reserve(length * 2);
|
|
60
|
+
|
|
61
|
+
for (size_t i = 0; i < length; i++) {
|
|
62
|
+
int character = contents[i];
|
|
63
|
+
switch (character) {
|
|
64
|
+
case '\0':
|
|
65
|
+
extendedContent.append("%U");
|
|
66
|
+
break;
|
|
67
|
+
case ' ':
|
|
68
|
+
case '-':
|
|
69
|
+
case '.':
|
|
70
|
+
extendedContent.push_back((char)character);
|
|
71
|
+
break;
|
|
72
|
+
case '@':
|
|
73
|
+
extendedContent.append("%V");
|
|
74
|
+
break;
|
|
75
|
+
case '`':
|
|
76
|
+
extendedContent.append("%W");
|
|
77
|
+
break;
|
|
78
|
+
default:
|
|
79
|
+
if (character > 0 && character < 27) {
|
|
80
|
+
extendedContent.push_back('$');
|
|
81
|
+
extendedContent.push_back((char)('A' + (character - 1)));
|
|
82
|
+
}
|
|
83
|
+
else if (character > 26 && character < ' ') {
|
|
84
|
+
extendedContent.push_back('%');
|
|
85
|
+
extendedContent.push_back((char)('A' + (character - 27)));
|
|
86
|
+
}
|
|
87
|
+
else if ((character > ' ' && character < '-') || character == '/' || character == ':') {
|
|
88
|
+
extendedContent.push_back('/');
|
|
89
|
+
extendedContent.push_back((char)('A' + (character - 33)));
|
|
90
|
+
}
|
|
91
|
+
else if (character > '/' && character < ':') {
|
|
92
|
+
extendedContent.push_back((char)('0' + (character - 48)));
|
|
93
|
+
}
|
|
94
|
+
else if (character > ':' && character < '@') {
|
|
95
|
+
extendedContent.push_back('%');
|
|
96
|
+
extendedContent.push_back((char)('F' + (character - 59)));
|
|
97
|
+
}
|
|
98
|
+
else if (character > '@' && character < '[') {
|
|
99
|
+
extendedContent.push_back((char)('A' + (character - 65)));
|
|
100
|
+
}
|
|
101
|
+
else if (character > 'Z' && character < '`') {
|
|
102
|
+
extendedContent.push_back('%');
|
|
103
|
+
extendedContent.push_back((char)('K' + (character - 91)));
|
|
104
|
+
}
|
|
105
|
+
else if (character > '`' && character < '{') {
|
|
106
|
+
extendedContent.push_back('+');
|
|
107
|
+
extendedContent.push_back((char)('A' + (character - 97)));
|
|
108
|
+
}
|
|
109
|
+
else if (character > 'z' && character < 128) {
|
|
110
|
+
extendedContent.push_back('%');
|
|
111
|
+
extendedContent.push_back((char)('P' + (character - 123)));
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
throw std::invalid_argument("Requested content contains a non-encodable character: '" + ToHexString(character) + "'");
|
|
115
|
+
}
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return extendedContent;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
BitMatrix
|
|
124
|
+
Code39Writer::encode(const std::wstring& contents, int width, int height) const
|
|
125
|
+
{
|
|
126
|
+
size_t length = contents.length();
|
|
127
|
+
if (length == 0) {
|
|
128
|
+
throw std::invalid_argument("Found empty contents");
|
|
129
|
+
}
|
|
130
|
+
if (length > 80) {
|
|
131
|
+
throw std::invalid_argument("Requested contents should be less than 80 digits long");
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
std::string extendedContent;
|
|
135
|
+
for (size_t i = 0; i < length; i++) {
|
|
136
|
+
int indexInString = IndexOf(ALPHABET, contents[i]);
|
|
137
|
+
if (indexInString < 0) {
|
|
138
|
+
extendedContent = TryToConvertToExtendedMode(contents);
|
|
139
|
+
length = extendedContent.length();
|
|
140
|
+
if (length > 80) {
|
|
141
|
+
throw std::invalid_argument("Requested contents should be less than 80 digits long, but got " + std::to_string(length) + " (extended full ASCII mode)");
|
|
142
|
+
}
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (extendedContent.empty()) {
|
|
148
|
+
extendedContent = TextEncoder::FromUnicode(contents, CharacterSet::ISO8859_1);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
std::array<int, 9> widths = {};
|
|
152
|
+
size_t codeWidth = 24 + 1 + (13 * length);
|
|
153
|
+
|
|
154
|
+
std::vector<bool> result(codeWidth, false);
|
|
155
|
+
ToIntArray(ASTERISK_ENCODING, widths);
|
|
156
|
+
int pos = WriterHelper::AppendPattern(result, 0, widths, true);
|
|
157
|
+
std::array<int, 1> narrowWhite = { 1 };
|
|
158
|
+
pos += WriterHelper::AppendPattern(result, pos, narrowWhite, false);
|
|
159
|
+
//append next character to byte matrix
|
|
160
|
+
for (size_t i = 0; i < length; ++i) {
|
|
161
|
+
int indexInString = IndexOf(ALPHABET, extendedContent[i]);
|
|
162
|
+
ToIntArray(CHARACTER_ENCODINGS[indexInString], widths);
|
|
163
|
+
pos += WriterHelper::AppendPattern(result, pos, widths, true);
|
|
164
|
+
pos += WriterHelper::AppendPattern(result, pos, narrowWhite, false);
|
|
165
|
+
}
|
|
166
|
+
ToIntArray(ASTERISK_ENCODING, widths);
|
|
167
|
+
WriterHelper::AppendPattern(result, pos, widths, true);
|
|
168
|
+
return WriterHelper::RenderResult(result, width, height, _sidesMargin >= 0 ? _sidesMargin : 10);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
BitMatrix Code39Writer::encode(const std::string& contents, int width, int height) const
|
|
172
|
+
{
|
|
173
|
+
return encode(FromUtf8(contents), width, height);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
} // namespace ZXing::OneD
|
|
@@ -0,0 +1,34 @@
|
|
|
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 BitMatrix;
|
|
14
|
+
|
|
15
|
+
namespace OneD {
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* This object renders a CODE39 code as a {@link BitMatrix}.
|
|
19
|
+
*
|
|
20
|
+
* @author erik.barbara@gmail.com (Erik Barbara)
|
|
21
|
+
*/
|
|
22
|
+
class Code39Writer
|
|
23
|
+
{
|
|
24
|
+
public:
|
|
25
|
+
Code39Writer& setMargin(int sidesMargin) { _sidesMargin = sidesMargin; return *this; }
|
|
26
|
+
BitMatrix encode(const std::wstring& contents, int width, int height) const;
|
|
27
|
+
BitMatrix encode(const std::string& contents, int width, int height) const;
|
|
28
|
+
|
|
29
|
+
private:
|
|
30
|
+
int _sidesMargin = -1;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
} // OneD
|
|
34
|
+
} // ZXing
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 wooyechan
|
|
3
|
+
* Copyright 2026 Axel Waggershauser
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#pragma once
|
|
8
|
+
|
|
9
|
+
#include "Pattern.h"
|
|
10
|
+
|
|
11
|
+
namespace ZXing::OneD::Code93 {
|
|
12
|
+
|
|
13
|
+
// Each character consist of 3 bars and 3 spaces and is 9 modules wide in total.
|
|
14
|
+
// Each bar and space is from 1 to 4 modules wide.
|
|
15
|
+
constexpr int CHAR_LEN = 6;
|
|
16
|
+
constexpr int CHAR_MODS = 9;
|
|
17
|
+
|
|
18
|
+
constexpr std::array<FixedPattern<CHAR_LEN, CHAR_MODS>, 48> CODE_PATTERNS = { {
|
|
19
|
+
{ 1, 3, 1, 1, 1, 2 }, // 0
|
|
20
|
+
{ 1, 1, 1, 2, 1, 3 },
|
|
21
|
+
{ 1, 1, 1, 3, 1, 2 },
|
|
22
|
+
{ 1, 1, 1, 4, 1, 1 },
|
|
23
|
+
{ 1, 2, 1, 1, 1, 3 },
|
|
24
|
+
{ 1, 2, 1, 2, 1, 2 }, // 5
|
|
25
|
+
{ 1, 2, 1, 3, 1, 1 },
|
|
26
|
+
{ 1, 1, 1, 1, 1, 4 },
|
|
27
|
+
{ 1, 3, 1, 2, 1, 1 },
|
|
28
|
+
{ 1, 4, 1, 1, 1, 1 },
|
|
29
|
+
{ 2, 1, 1, 1, 1, 3 }, // 10
|
|
30
|
+
{ 2, 1, 1, 2, 1, 2 },
|
|
31
|
+
{ 2, 1, 1, 3, 1, 1 },
|
|
32
|
+
{ 2, 2, 1, 1, 1, 2 },
|
|
33
|
+
{ 2, 2, 1, 2, 1, 1 },
|
|
34
|
+
{ 2, 3, 1, 1, 1, 1 }, // 15
|
|
35
|
+
{ 1, 1, 2, 1, 1, 3 },
|
|
36
|
+
{ 1, 1, 2, 2, 1, 2 },
|
|
37
|
+
{ 1, 1, 2, 3, 1, 1 },
|
|
38
|
+
{ 1, 2, 2, 1, 1, 2 },
|
|
39
|
+
{ 1, 3, 2, 1, 1, 1 }, // 20
|
|
40
|
+
{ 1, 1, 1, 1, 2, 3 },
|
|
41
|
+
{ 1, 1, 1, 2, 2, 2 },
|
|
42
|
+
{ 1, 1, 1, 3, 2, 1 },
|
|
43
|
+
{ 1, 2, 1, 1, 2, 2 },
|
|
44
|
+
{ 1, 3, 1, 1, 2, 1 }, // 25
|
|
45
|
+
{ 2, 1, 2, 1, 1, 2 },
|
|
46
|
+
{ 2, 1, 2, 2, 1, 1 },
|
|
47
|
+
{ 2, 1, 1, 1, 2, 2 },
|
|
48
|
+
{ 2, 1, 1, 2, 2, 1 },
|
|
49
|
+
{ 2, 2, 1, 1, 2, 1 }, // 30
|
|
50
|
+
{ 2, 2, 2, 1, 1, 1 },
|
|
51
|
+
{ 1, 1, 2, 1, 2, 2 },
|
|
52
|
+
{ 1, 1, 2, 2, 2, 1 },
|
|
53
|
+
{ 1, 2, 2, 1, 2, 1 },
|
|
54
|
+
{ 1, 2, 3, 1, 1, 1 }, // 35
|
|
55
|
+
{ 1, 2, 1, 1, 3, 1 },
|
|
56
|
+
{ 3, 1, 1, 1, 1, 2 },
|
|
57
|
+
{ 3, 1, 1, 2, 1, 1 },
|
|
58
|
+
{ 3, 2, 1, 1, 1, 1 },
|
|
59
|
+
{ 1, 1, 2, 1, 3, 1 }, // 40
|
|
60
|
+
{ 1, 1, 3, 1, 2, 1 },
|
|
61
|
+
{ 2, 1, 1, 1, 3, 1 },
|
|
62
|
+
{ 1, 2, 1, 2, 2, 1 },
|
|
63
|
+
{ 3, 1, 2, 1, 1, 1 },
|
|
64
|
+
{ 3, 1, 1, 1, 2, 1 }, // 45
|
|
65
|
+
{ 1, 2, 2, 2, 1, 1 },
|
|
66
|
+
{ 1, 1, 1, 1, 4, 1 } // STOP_CODE / Asterisk
|
|
67
|
+
} };
|
|
68
|
+
|
|
69
|
+
constexpr auto E2E_PATTERNS = PatternsToE2EInts(CODE_PATTERNS);
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
// Note that 'abcd' are dummy characters in place of control characters.
|
|
73
|
+
// Control chars ($)==a, (%)==b, (/)==c, (+)==d
|
|
74
|
+
constexpr char ALPHABET[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*";
|
|
75
|
+
|
|
76
|
+
static_assert(Size(ALPHABET) == Size(CODE_PATTERNS), "table size mismatch");
|
|
77
|
+
|
|
78
|
+
constexpr int ASTERISK_ENCODING = E2E_PATTERNS[47];
|
|
79
|
+
|
|
80
|
+
} // namespace ZXing::OneD::Code93
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Nu-book Inc.
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
* Copyright 2020 Axel Waggershauser
|
|
5
|
+
*/
|
|
6
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
|
|
8
|
+
#include "ODCode93Reader.h"
|
|
9
|
+
|
|
10
|
+
#include "ODCode93Patterns.h"
|
|
11
|
+
#include "BarcodeData.h"
|
|
12
|
+
#include "SymbologyIdentifier.h"
|
|
13
|
+
#include "ZXAlgorithms.h"
|
|
14
|
+
|
|
15
|
+
#include <array>
|
|
16
|
+
#include <string>
|
|
17
|
+
|
|
18
|
+
namespace ZXing::OneD {
|
|
19
|
+
|
|
20
|
+
using namespace Code93;
|
|
21
|
+
|
|
22
|
+
static bool
|
|
23
|
+
CheckOneChecksum(const std::string& result, int checkPosition, int weightMax)
|
|
24
|
+
{
|
|
25
|
+
int weight = 1;
|
|
26
|
+
int checksum = 0;
|
|
27
|
+
for (int i = checkPosition - 1; i >= 0; i--) {
|
|
28
|
+
checksum += weight * IndexOf(ALPHABET, result[i]);
|
|
29
|
+
if (++weight > weightMax) {
|
|
30
|
+
weight = 1;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return result[checkPosition] == ALPHABET[checksum % 47];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static bool
|
|
37
|
+
CheckChecksums(const std::string& result)
|
|
38
|
+
{
|
|
39
|
+
int length = Size(result);
|
|
40
|
+
return CheckOneChecksum(result, length - 2, 20) && CheckOneChecksum(result, length - 1, 15);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// forward declare here. see ODCode39Reader.cpp. Not put in header to not pollute the public facing API
|
|
44
|
+
std::string DecodeCode39AndCode93FullASCII(std::string encoded, const char ctrl[4]);
|
|
45
|
+
|
|
46
|
+
// quiet zone is half the width of a character symbol
|
|
47
|
+
constexpr float QUIET_ZONE_SCALE = 0.5f;
|
|
48
|
+
|
|
49
|
+
static bool IsStartGuard(const PatternView& window, int spaceInPixel)
|
|
50
|
+
{
|
|
51
|
+
// The complete start pattern is FixedPattern<CHAR_LEN, CHAR_MODS>{1, 1, 1, 1, 4, 1}.
|
|
52
|
+
// Use only the first 4 elements which results in more than a 2x speedup. This is counter-intuitive since we save at
|
|
53
|
+
// most 1/3rd of the loop iterations in FindPattern. The reason might be a successful vectorization with the limited
|
|
54
|
+
// pattern size that is missed otherwise. We check for the remaining 2 slots for plausibility of the 4:1 ratio.
|
|
55
|
+
return IsPattern(window, FixedPattern<4, 4>{1, 1, 1, 1}, spaceInPixel, QUIET_ZONE_SCALE * 12) &&
|
|
56
|
+
window[4] > 3 * window[5] - 2 &&
|
|
57
|
+
ToInt(NormalizedE2EPattern<CHAR_LEN, CHAR_MODS>(window)) == ASTERISK_ENCODING;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
BarcodeData Code93Reader::decodePattern(int rowNumber, PatternView& next, std::unique_ptr<DecodingState>&) const
|
|
61
|
+
{
|
|
62
|
+
// minimal number of characters that must be present (including start, stop, checksum and 1 payload characters)
|
|
63
|
+
int minCharCount = 5;
|
|
64
|
+
|
|
65
|
+
next = FindLeftGuard<CHAR_LEN>(next, minCharCount * CHAR_LEN, IsStartGuard);
|
|
66
|
+
if (!next.isValid())
|
|
67
|
+
return {};
|
|
68
|
+
|
|
69
|
+
int xStart = next.pixelsInFront();
|
|
70
|
+
|
|
71
|
+
std::string txt;
|
|
72
|
+
txt.reserve(20);
|
|
73
|
+
|
|
74
|
+
do {
|
|
75
|
+
// check remaining input width
|
|
76
|
+
if (!next.skipSymbol())
|
|
77
|
+
return {};
|
|
78
|
+
|
|
79
|
+
txt += LookupBitPattern(ToInt(NormalizedE2EPattern<CHAR_LEN, CHAR_MODS>(next)), E2E_PATTERNS, ALPHABET);
|
|
80
|
+
|
|
81
|
+
if (txt.back() == 0)
|
|
82
|
+
return {};
|
|
83
|
+
} while (txt.back() != '*');
|
|
84
|
+
|
|
85
|
+
txt.pop_back(); // remove asterisk
|
|
86
|
+
|
|
87
|
+
if (Size(txt) < minCharCount - 2)
|
|
88
|
+
return {};
|
|
89
|
+
|
|
90
|
+
// check termination bar (is present and not wider than about 2 modules) and quiet zone
|
|
91
|
+
next = next.subView(0, CHAR_LEN + 1);
|
|
92
|
+
if (!next.isValid() || next[CHAR_LEN] > next.sum(CHAR_LEN) / 4 || !next.hasQuietZoneAfter(QUIET_ZONE_SCALE))
|
|
93
|
+
return {};
|
|
94
|
+
|
|
95
|
+
Error error;
|
|
96
|
+
if (!CheckChecksums(txt))
|
|
97
|
+
error = ChecksumError();
|
|
98
|
+
|
|
99
|
+
// Remove checksum digits
|
|
100
|
+
txt.resize(txt.size() - 2);
|
|
101
|
+
|
|
102
|
+
if (!error && (txt = DecodeCode39AndCode93FullASCII(txt, "abcd")).empty())
|
|
103
|
+
error = FormatError("ASCII decoding of Code93 failed");
|
|
104
|
+
|
|
105
|
+
// Symbology identifier ISO/IEC 15424:2008 4.4.10 no modifiers
|
|
106
|
+
SymbologyIdentifier symbologyIdentifier = {'G', '0'};
|
|
107
|
+
|
|
108
|
+
int xStop = next.pixelsTillEnd();
|
|
109
|
+
return LinearBarcode(BarcodeFormat::Code93, txt, rowNumber, xStart, xStop, symbologyIdentifier, error);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
} // namespace ZXing::OneD
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Nu-book Inc.
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#pragma once
|
|
8
|
+
|
|
9
|
+
#include "ODRowReader.h"
|
|
10
|
+
|
|
11
|
+
namespace ZXing::OneD {
|
|
12
|
+
|
|
13
|
+
class Code93Reader : public RowReader
|
|
14
|
+
{
|
|
15
|
+
public:
|
|
16
|
+
using RowReader::RowReader;
|
|
17
|
+
|
|
18
|
+
BarcodeData decodePattern(int rowNumber, PatternView& next, std::unique_ptr<DecodingState>&) const override;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
} // namespace ZXing::OneD
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Huy Cuong Nguyen
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#include "ODCode93Writer.h"
|
|
8
|
+
|
|
9
|
+
#include "ODWriterHelper.h"
|
|
10
|
+
#include "Utf.h"
|
|
11
|
+
#include "ZXAlgorithms.h"
|
|
12
|
+
#include "ZXTestSupport.h"
|
|
13
|
+
|
|
14
|
+
#include <stdexcept>
|
|
15
|
+
|
|
16
|
+
namespace ZXing::OneD {
|
|
17
|
+
|
|
18
|
+
static constexpr char ALPHABET[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* These represent the encodings of characters, as patterns of wide and narrow bars.
|
|
22
|
+
* The 9 least-significant bits of each int correspond to the pattern of wide and narrow.
|
|
23
|
+
*/
|
|
24
|
+
static constexpr int CHARACTER_ENCODINGS[] = {
|
|
25
|
+
0x114, 0x148, 0x144, 0x142, 0x128, 0x124, 0x122, 0x150, 0x112, 0x10A, // 0-9
|
|
26
|
+
0x1A8, 0x1A4, 0x1A2, 0x194, 0x192, 0x18A, 0x168, 0x164, 0x162, 0x134, // A-J
|
|
27
|
+
0x11A, 0x158, 0x14C, 0x146, 0x12C, 0x116, 0x1B4, 0x1B2, 0x1AC, 0x1A6, // K-T
|
|
28
|
+
0x196, 0x19A, 0x16C, 0x166, 0x136, 0x13A, // U-Z
|
|
29
|
+
0x12E, 0x1D4, 0x1D2, 0x1CA, 0x16E, 0x176, 0x1AE, // - - %
|
|
30
|
+
0x126, 0x1DA, 0x1D6, 0x132, 0x15E, // Control chars? $-*
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
static_assert(Size(ALPHABET) == Size(CHARACTER_ENCODINGS), "table size mismatch");
|
|
34
|
+
|
|
35
|
+
static const int ASTERISK_ENCODING = CHARACTER_ENCODINGS[47];
|
|
36
|
+
|
|
37
|
+
static int AppendPattern(std::vector<bool>& target, int pos, int a)
|
|
38
|
+
{
|
|
39
|
+
for (int i = 0; i < 9; i++) {
|
|
40
|
+
int temp = a & (1 << (8 - i));
|
|
41
|
+
target[pos + i] = temp != 0;
|
|
42
|
+
}
|
|
43
|
+
return 9;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
static int ComputeChecksumIndex(const std::string& contents, int maxWeight)
|
|
48
|
+
{
|
|
49
|
+
int weight = 1;
|
|
50
|
+
int total = 0;
|
|
51
|
+
|
|
52
|
+
for (int i = Size(contents) - 1; i >= 0; i--) {
|
|
53
|
+
int indexInString = IndexOf(ALPHABET, contents[i]);
|
|
54
|
+
total += indexInString * weight;
|
|
55
|
+
if (++weight > maxWeight) {
|
|
56
|
+
weight = 1;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return total % 47;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
ZXING_EXPORT_TEST_ONLY
|
|
64
|
+
std::string Code93ConvertToExtended(const std::wstring& contents)
|
|
65
|
+
{
|
|
66
|
+
size_t length = contents.length();
|
|
67
|
+
std::string extendedContent;
|
|
68
|
+
extendedContent.reserve(length * 2);
|
|
69
|
+
|
|
70
|
+
for (size_t i = 0; i < length; i++) {
|
|
71
|
+
int character = contents[i];
|
|
72
|
+
// ($)=a, (%)=b, (/)=c, (+)=d. see Code93Reader.ALPHABET
|
|
73
|
+
if (character == 0) {
|
|
74
|
+
// NUL: (%)U
|
|
75
|
+
extendedContent.append("bU");
|
|
76
|
+
}
|
|
77
|
+
else if (character <= 26) {
|
|
78
|
+
// SOH - SUB: ($)A - ($)Z
|
|
79
|
+
extendedContent.push_back('a');
|
|
80
|
+
extendedContent.push_back((char)('A' + character - 1));
|
|
81
|
+
}
|
|
82
|
+
else if (character <= 31) {
|
|
83
|
+
// ESC - US: (%)A - (%)E
|
|
84
|
+
extendedContent.push_back('b');
|
|
85
|
+
extendedContent.push_back((char)('A' + character - 27));
|
|
86
|
+
}
|
|
87
|
+
else if (character == ' ' || character == '$' || character == '%' || character == '+') {
|
|
88
|
+
// space $ % +
|
|
89
|
+
extendedContent.push_back(character);
|
|
90
|
+
}
|
|
91
|
+
else if (character <= ',') {
|
|
92
|
+
// ! " # & ' ( ) * ,: (/)A - (/)L
|
|
93
|
+
extendedContent.push_back('c');
|
|
94
|
+
extendedContent.push_back((char)('A' + character - '!'));
|
|
95
|
+
}
|
|
96
|
+
else if (character <= '9') {
|
|
97
|
+
extendedContent.push_back(character);
|
|
98
|
+
}
|
|
99
|
+
else if (character == ':') {
|
|
100
|
+
// :: (/)Z
|
|
101
|
+
extendedContent.append("cZ");
|
|
102
|
+
}
|
|
103
|
+
else if (character <= '?') {
|
|
104
|
+
// ; - ?: (%)F - (%)J
|
|
105
|
+
extendedContent.push_back('b');
|
|
106
|
+
extendedContent.push_back((char)('F' + character - ';'));
|
|
107
|
+
}
|
|
108
|
+
else if (character == '@') {
|
|
109
|
+
// @: (%)V
|
|
110
|
+
extendedContent.append("bV");
|
|
111
|
+
}
|
|
112
|
+
else if (character <= 'Z') {
|
|
113
|
+
// A - Z
|
|
114
|
+
extendedContent.push_back(character);
|
|
115
|
+
}
|
|
116
|
+
else if (character <= '_') {
|
|
117
|
+
// [ - _: (%)K - (%)O
|
|
118
|
+
extendedContent.push_back('b');
|
|
119
|
+
extendedContent.push_back((char)('K' + character - '['));
|
|
120
|
+
}
|
|
121
|
+
else if (character == '`') {
|
|
122
|
+
// `: (%)W
|
|
123
|
+
extendedContent.append("bW");
|
|
124
|
+
}
|
|
125
|
+
else if (character <= 'z') {
|
|
126
|
+
// a - z: (*)A - (*)Z
|
|
127
|
+
extendedContent.push_back('d');
|
|
128
|
+
extendedContent.push_back((char)('A' + character - 'a'));
|
|
129
|
+
}
|
|
130
|
+
else if (character <= 127) {
|
|
131
|
+
// { - DEL: (%)P - (%)T
|
|
132
|
+
extendedContent.push_back('b');
|
|
133
|
+
extendedContent.push_back((char)('P' + character - '{'));
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
throw std::invalid_argument(StrCat("Requested content contains a non-encodable character: '", (char)character, "'"));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return extendedContent;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
BitMatrix
|
|
143
|
+
Code93Writer::encode(const std::wstring& contents_, int width, int height) const
|
|
144
|
+
{
|
|
145
|
+
std::string contents = Code93ConvertToExtended(contents_);
|
|
146
|
+
|
|
147
|
+
size_t length = contents.length();
|
|
148
|
+
if (length == 0) {
|
|
149
|
+
throw std::invalid_argument("Found empty contents");
|
|
150
|
+
}
|
|
151
|
+
if (length > 80) {
|
|
152
|
+
throw std::invalid_argument("Requested contents should be less than 80 digits long after converting to extended encoding");
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
//length of code + 2 start/stop characters + 2 checksums, each of 9 bits, plus a termination bar
|
|
156
|
+
size_t codeWidth = (contents.length() + 2 + 2) * 9 + 1;
|
|
157
|
+
|
|
158
|
+
std::vector<bool> result(codeWidth, false);
|
|
159
|
+
|
|
160
|
+
//start character (*)
|
|
161
|
+
int pos = AppendPattern(result, 0, ASTERISK_ENCODING);
|
|
162
|
+
|
|
163
|
+
for (size_t i = 0; i < length; i++) {
|
|
164
|
+
int indexInString = IndexOf(ALPHABET, contents[i]);
|
|
165
|
+
pos += AppendPattern(result, pos, CHARACTER_ENCODINGS[indexInString]);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
//add two checksums
|
|
169
|
+
int check1 = ComputeChecksumIndex(contents, 20);
|
|
170
|
+
pos += AppendPattern(result, pos, CHARACTER_ENCODINGS[check1]);
|
|
171
|
+
|
|
172
|
+
//append the contents to reflect the first checksum added
|
|
173
|
+
contents += static_cast<wchar_t>(ALPHABET[check1]);
|
|
174
|
+
|
|
175
|
+
int check2 = ComputeChecksumIndex(contents, 15);
|
|
176
|
+
pos += AppendPattern(result, pos, CHARACTER_ENCODINGS[check2]);
|
|
177
|
+
|
|
178
|
+
//end character (*)
|
|
179
|
+
pos += AppendPattern(result, pos, ASTERISK_ENCODING);
|
|
180
|
+
|
|
181
|
+
//termination bar (single black bar)
|
|
182
|
+
result[pos] = true;
|
|
183
|
+
|
|
184
|
+
return WriterHelper::RenderResult(result, width, height, _sidesMargin >= 0 ? _sidesMargin : 10);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
BitMatrix Code93Writer::encode(const std::string& contents, int width, int height) const
|
|
188
|
+
{
|
|
189
|
+
return encode(FromUtf8(contents), width, height);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
} // namespace ZXing::OneD
|
|
@@ -0,0 +1,32 @@
|
|
|
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 BitMatrix;
|
|
14
|
+
|
|
15
|
+
namespace OneD {
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* This object renders a CODE93 code as a BitMatrix
|
|
19
|
+
*/
|
|
20
|
+
class Code93Writer
|
|
21
|
+
{
|
|
22
|
+
public:
|
|
23
|
+
Code93Writer& setMargin(int sidesMargin) { _sidesMargin = sidesMargin; return *this; }
|
|
24
|
+
BitMatrix encode(const std::wstring& contents, int width, int height) const;
|
|
25
|
+
BitMatrix encode(const std::string& contents, int width, int height) const;
|
|
26
|
+
|
|
27
|
+
private:
|
|
28
|
+
int _sidesMargin = -1;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
} // OneD
|
|
32
|
+
} // ZXing
|