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.
Files changed (423) hide show
  1. package/README.md +34 -0
  2. package/VisionCameraZxing.podspec +48 -0
  3. package/android/CMakeLists.txt +43 -0
  4. package/android/build.gradle +150 -0
  5. package/android/fix-prefab.gradle +51 -0
  6. package/android/gradle.properties +5 -0
  7. package/android/src/main/AndroidManifest.xml +3 -0
  8. package/android/src/main/cpp/cpp-adapter.cpp +7 -0
  9. package/android/src/main/java/com/margelo/nitro/camera/zxing/VisionCameraZxingPackage.kt +21 -0
  10. package/cpp/BarcodeValueTypeClassifier.cpp +70 -0
  11. package/cpp/BarcodeValueTypeClassifier.hpp +14 -0
  12. package/cpp/FrameImageView.cpp +75 -0
  13. package/cpp/FrameImageView.hpp +34 -0
  14. package/cpp/HybridBarcode.cpp +59 -0
  15. package/cpp/HybridBarcode.hpp +26 -0
  16. package/cpp/HybridBarcodeScanner.cpp +121 -0
  17. package/cpp/HybridBarcodeScanner.hpp +26 -0
  18. package/cpp/HybridBarcodeScannerFactory.cpp +11 -0
  19. package/cpp/HybridBarcodeScannerFactory.hpp +14 -0
  20. package/cpp/ImageDownscaler.cpp +34 -0
  21. package/cpp/ImageDownscaler.hpp +21 -0
  22. package/cpp/ZXingDecoder.cpp +189 -0
  23. package/cpp/ZXingDecoder.hpp +72 -0
  24. package/cpp/zxing-core/LICENSE +202 -0
  25. package/cpp/zxing-core/README.md +156 -0
  26. package/cpp/zxing-core/core/CMakeLists.txt +784 -0
  27. package/cpp/zxing-core/core/Version.h.in +28 -0
  28. package/cpp/zxing-core/core/ZXingConfig.cmake.in +9 -0
  29. package/cpp/zxing-core/core/src/Barcode.cpp +255 -0
  30. package/cpp/zxing-core/core/src/Barcode.h +191 -0
  31. package/cpp/zxing-core/core/src/BarcodeData.h +100 -0
  32. package/cpp/zxing-core/core/src/BarcodeFormat.cpp +286 -0
  33. package/cpp/zxing-core/core/src/BarcodeFormat.h +272 -0
  34. package/cpp/zxing-core/core/src/BinaryBitmap.cpp +111 -0
  35. package/cpp/zxing-core/core/src/BinaryBitmap.h +66 -0
  36. package/cpp/zxing-core/core/src/BitArray.cpp +38 -0
  37. package/cpp/zxing-core/core/src/BitArray.h +181 -0
  38. package/cpp/zxing-core/core/src/BitMatrix.cpp +175 -0
  39. package/cpp/zxing-core/core/src/BitMatrix.h +199 -0
  40. package/cpp/zxing-core/core/src/BitMatrixCursor.h +253 -0
  41. package/cpp/zxing-core/core/src/BitMatrixIO.cpp +101 -0
  42. package/cpp/zxing-core/core/src/BitMatrixIO.h +21 -0
  43. package/cpp/zxing-core/core/src/BitSource.cpp +77 -0
  44. package/cpp/zxing-core/core/src/BitSource.h +72 -0
  45. package/cpp/zxing-core/core/src/ByteArray.h +42 -0
  46. package/cpp/zxing-core/core/src/CharacterSet.cpp +78 -0
  47. package/cpp/zxing-core/core/src/CharacterSet.h +58 -0
  48. package/cpp/zxing-core/core/src/ConcentricFinder.cpp +312 -0
  49. package/cpp/zxing-core/core/src/ConcentricFinder.h +156 -0
  50. package/cpp/zxing-core/core/src/Content.cpp +471 -0
  51. package/cpp/zxing-core/core/src/Content.h +82 -0
  52. package/cpp/zxing-core/core/src/ContentType.h +19 -0
  53. package/cpp/zxing-core/core/src/CreateBarcode.cpp +490 -0
  54. package/cpp/zxing-core/core/src/CreateBarcode.h +132 -0
  55. package/cpp/zxing-core/core/src/DecoderResult.h +92 -0
  56. package/cpp/zxing-core/core/src/DetectorResult.h +44 -0
  57. package/cpp/zxing-core/core/src/ECI.cpp +81 -0
  58. package/cpp/zxing-core/core/src/ECI.h +78 -0
  59. package/cpp/zxing-core/core/src/Error.cpp +29 -0
  60. package/cpp/zxing-core/core/src/Error.h +79 -0
  61. package/cpp/zxing-core/core/src/Flags.h +165 -0
  62. package/cpp/zxing-core/core/src/GTIN.cpp +253 -0
  63. package/cpp/zxing-core/core/src/GTIN.h +58 -0
  64. package/cpp/zxing-core/core/src/GlobalHistogramBinarizer.cpp +197 -0
  65. package/cpp/zxing-core/core/src/GlobalHistogramBinarizer.h +34 -0
  66. package/cpp/zxing-core/core/src/GridSampler.cpp +124 -0
  67. package/cpp/zxing-core/core/src/GridSampler.h +59 -0
  68. package/cpp/zxing-core/core/src/HRI.cpp +343 -0
  69. package/cpp/zxing-core/core/src/HRI.h +16 -0
  70. package/cpp/zxing-core/core/src/HybridBinarizer.cpp +315 -0
  71. package/cpp/zxing-core/core/src/HybridBinarizer.h +40 -0
  72. package/cpp/zxing-core/core/src/ImageView.h +168 -0
  73. package/cpp/zxing-core/core/src/JSON.cpp +154 -0
  74. package/cpp/zxing-core/core/src/JSON.h +66 -0
  75. package/cpp/zxing-core/core/src/LocalGrid.cpp +242 -0
  76. package/cpp/zxing-core/core/src/LocalGrid.h +91 -0
  77. package/cpp/zxing-core/core/src/LogMatrix.h +105 -0
  78. package/cpp/zxing-core/core/src/Matrix.h +125 -0
  79. package/cpp/zxing-core/core/src/MultiFormatReader.cpp +107 -0
  80. package/cpp/zxing-core/core/src/MultiFormatReader.h +34 -0
  81. package/cpp/zxing-core/core/src/MultiFormatWriter.cpp +111 -0
  82. package/cpp/zxing-core/core/src/MultiFormatWriter.h +62 -0
  83. package/cpp/zxing-core/core/src/Pattern.h +472 -0
  84. package/cpp/zxing-core/core/src/PerspectiveTransform.cpp +81 -0
  85. package/cpp/zxing-core/core/src/PerspectiveTransform.h +47 -0
  86. package/cpp/zxing-core/core/src/Point.h +185 -0
  87. package/cpp/zxing-core/core/src/Quadrilateral.h +215 -0
  88. package/cpp/zxing-core/core/src/Range.h +112 -0
  89. package/cpp/zxing-core/core/src/ReadBarcode.cpp +335 -0
  90. package/cpp/zxing-core/core/src/ReadBarcode.h +33 -0
  91. package/cpp/zxing-core/core/src/Reader.h +32 -0
  92. package/cpp/zxing-core/core/src/ReaderOptions.h +210 -0
  93. package/cpp/zxing-core/core/src/ReedSolomon.cpp +100 -0
  94. package/cpp/zxing-core/core/src/ReedSolomon.h +66 -0
  95. package/cpp/zxing-core/core/src/RegressionLine.h +161 -0
  96. package/cpp/zxing-core/core/src/ResultPoint.cpp +20 -0
  97. package/cpp/zxing-core/core/src/ResultPoint.h +35 -0
  98. package/cpp/zxing-core/core/src/StdGenerator.h +121 -0
  99. package/cpp/zxing-core/core/src/StdPrint.h +38 -0
  100. package/cpp/zxing-core/core/src/StdScope.h +55 -0
  101. package/cpp/zxing-core/core/src/StructuredAppend.h +19 -0
  102. package/cpp/zxing-core/core/src/SymbologyIdentifier.h +29 -0
  103. package/cpp/zxing-core/core/src/TextDecoder.cpp +59 -0
  104. package/cpp/zxing-core/core/src/TextDecoder.h +23 -0
  105. package/cpp/zxing-core/core/src/TextEncoder.cpp +75 -0
  106. package/cpp/zxing-core/core/src/TextEncoder.h +31 -0
  107. package/cpp/zxing-core/core/src/ThresholdBinarizer.h +58 -0
  108. package/cpp/zxing-core/core/src/TritMatrix.h +29 -0
  109. package/cpp/zxing-core/core/src/Utf.cpp +276 -0
  110. package/cpp/zxing-core/core/src/Utf.h +26 -0
  111. package/cpp/zxing-core/core/src/WhiteRectDetector.cpp +276 -0
  112. package/cpp/zxing-core/core/src/WhiteRectDetector.h +36 -0
  113. package/cpp/zxing-core/core/src/WriteBarcode.cpp +213 -0
  114. package/cpp/zxing-core/core/src/WriteBarcode.h +72 -0
  115. package/cpp/zxing-core/core/src/ZXAlgorithms.h +353 -0
  116. package/cpp/zxing-core/core/src/ZXConfig.h +17 -0
  117. package/cpp/zxing-core/core/src/ZXTestSupport.h +9 -0
  118. package/cpp/zxing-core/core/src/ZXVersion.h +14 -0
  119. package/cpp/zxing-core/core/src/ZXingC.cpp +460 -0
  120. package/cpp/zxing-core/core/src/ZXingC.h +296 -0
  121. package/cpp/zxing-core/core/src/ZXingCpp.cpp +18 -0
  122. package/cpp/zxing-core/core/src/ZXingCpp.h +76 -0
  123. package/cpp/zxing-core/core/src/ZXingQt.h +606 -0
  124. package/cpp/zxing-core/core/src/aztec/AZDecoder.cpp +376 -0
  125. package/cpp/zxing-core/core/src/aztec/AZDecoder.h +20 -0
  126. package/cpp/zxing-core/core/src/aztec/AZDetector.cpp +508 -0
  127. package/cpp/zxing-core/core/src/aztec/AZDetector.h +25 -0
  128. package/cpp/zxing-core/core/src/aztec/AZDetectorResult.h +51 -0
  129. package/cpp/zxing-core/core/src/aztec/AZEncoder.cpp +318 -0
  130. package/cpp/zxing-core/core/src/aztec/AZEncoder.h +44 -0
  131. package/cpp/zxing-core/core/src/aztec/AZEncodingState.h +40 -0
  132. package/cpp/zxing-core/core/src/aztec/AZHighLevelEncoder.cpp +377 -0
  133. package/cpp/zxing-core/core/src/aztec/AZHighLevelEncoder.h +36 -0
  134. package/cpp/zxing-core/core/src/aztec/AZReader.cpp +45 -0
  135. package/cpp/zxing-core/core/src/aztec/AZReader.h +21 -0
  136. package/cpp/zxing-core/core/src/aztec/AZToken.cpp +44 -0
  137. package/cpp/zxing-core/core/src/aztec/AZToken.h +39 -0
  138. package/cpp/zxing-core/core/src/aztec/AZWriter.cpp +38 -0
  139. package/cpp/zxing-core/core/src/aztec/AZWriter.h +55 -0
  140. package/cpp/zxing-core/core/src/datamatrix/DMBitLayout.cpp +194 -0
  141. package/cpp/zxing-core/core/src/datamatrix/DMBitLayout.h +21 -0
  142. package/cpp/zxing-core/core/src/datamatrix/DMDataBlock.cpp +63 -0
  143. package/cpp/zxing-core/core/src/datamatrix/DMDataBlock.h +41 -0
  144. package/cpp/zxing-core/core/src/datamatrix/DMDecoder.cpp +457 -0
  145. package/cpp/zxing-core/core/src/datamatrix/DMDecoder.h +19 -0
  146. package/cpp/zxing-core/core/src/datamatrix/DMDetector.cpp +1230 -0
  147. package/cpp/zxing-core/core/src/datamatrix/DMDetector.h +23 -0
  148. package/cpp/zxing-core/core/src/datamatrix/DMECEncoder.cpp +137 -0
  149. package/cpp/zxing-core/core/src/datamatrix/DMECEncoder.h +26 -0
  150. package/cpp/zxing-core/core/src/datamatrix/DMEncoderContext.h +128 -0
  151. package/cpp/zxing-core/core/src/datamatrix/DMHighLevelEncoder.cpp +919 -0
  152. package/cpp/zxing-core/core/src/datamatrix/DMHighLevelEncoder.h +29 -0
  153. package/cpp/zxing-core/core/src/datamatrix/DMReader.cpp +40 -0
  154. package/cpp/zxing-core/core/src/datamatrix/DMReader.h +21 -0
  155. package/cpp/zxing-core/core/src/datamatrix/DMSymbolInfo.cpp +141 -0
  156. package/cpp/zxing-core/core/src/datamatrix/DMSymbolInfo.h +78 -0
  157. package/cpp/zxing-core/core/src/datamatrix/DMSymbolShape.h +17 -0
  158. package/cpp/zxing-core/core/src/datamatrix/DMVersion.cpp +82 -0
  159. package/cpp/zxing-core/core/src/datamatrix/DMVersion.h +76 -0
  160. package/cpp/zxing-core/core/src/datamatrix/DMWriter.cpp +114 -0
  161. package/cpp/zxing-core/core/src/datamatrix/DMWriter.h +62 -0
  162. package/cpp/zxing-core/core/src/librscpp/README.md +65 -0
  163. package/cpp/zxing-core/core/src/librscpp/decode.h +258 -0
  164. package/cpp/zxing-core/core/src/librscpp/encode.h +124 -0
  165. package/cpp/zxing-core/core/src/librscpp/field.h +158 -0
  166. package/cpp/zxing-core/core/src/librscpp/poly.h +194 -0
  167. package/cpp/zxing-core/core/src/libzint/2of5inter.c +1 -0
  168. package/cpp/zxing-core/core/src/libzint/2of5inter_based.c +1 -0
  169. package/cpp/zxing-core/core/src/libzint/aztec.c +1 -0
  170. package/cpp/zxing-core/core/src/libzint/aztec.h +1 -0
  171. package/cpp/zxing-core/core/src/libzint/big5.h +1 -0
  172. package/cpp/zxing-core/core/src/libzint/codabar.c +1 -0
  173. package/cpp/zxing-core/core/src/libzint/code.c +1 -0
  174. package/cpp/zxing-core/core/src/libzint/code128.c +1 -0
  175. package/cpp/zxing-core/core/src/libzint/code128.h +1 -0
  176. package/cpp/zxing-core/core/src/libzint/common.c +1 -0
  177. package/cpp/zxing-core/core/src/libzint/common.h +1 -0
  178. package/cpp/zxing-core/core/src/libzint/dmatrix.c +1 -0
  179. package/cpp/zxing-core/core/src/libzint/dmatrix.h +1 -0
  180. package/cpp/zxing-core/core/src/libzint/dxfilmedge.c +1 -0
  181. package/cpp/zxing-core/core/src/libzint/eci.c +1 -0
  182. package/cpp/zxing-core/core/src/libzint/eci.h +1 -0
  183. package/cpp/zxing-core/core/src/libzint/eci_sb.h +1 -0
  184. package/cpp/zxing-core/core/src/libzint/filemem.c +1 -0
  185. package/cpp/zxing-core/core/src/libzint/filemem.h +1 -0
  186. package/cpp/zxing-core/core/src/libzint/fonts/normal_woff2.h +1 -0
  187. package/cpp/zxing-core/core/src/libzint/fonts/upcean_woff2.h +1 -0
  188. package/cpp/zxing-core/core/src/libzint/gb18030.h +1 -0
  189. package/cpp/zxing-core/core/src/libzint/gb2312.h +1 -0
  190. package/cpp/zxing-core/core/src/libzint/gbk.h +1 -0
  191. package/cpp/zxing-core/core/src/libzint/general_field.c +1 -0
  192. package/cpp/zxing-core/core/src/libzint/general_field.h +1 -0
  193. package/cpp/zxing-core/core/src/libzint/gs1.c +1 -0
  194. package/cpp/zxing-core/core/src/libzint/gs1.h +1 -0
  195. package/cpp/zxing-core/core/src/libzint/gs1_lint.h +1 -0
  196. package/cpp/zxing-core/core/src/libzint/iso3166.h +1 -0
  197. package/cpp/zxing-core/core/src/libzint/iso4217.h +1 -0
  198. package/cpp/zxing-core/core/src/libzint/ksx1001.h +1 -0
  199. package/cpp/zxing-core/core/src/libzint/large.c +1 -0
  200. package/cpp/zxing-core/core/src/libzint/large.h +1 -0
  201. package/cpp/zxing-core/core/src/libzint/library.c +1 -0
  202. package/cpp/zxing-core/core/src/libzint/maxicode.c +1 -0
  203. package/cpp/zxing-core/core/src/libzint/maxicode.h +1 -0
  204. package/cpp/zxing-core/core/src/libzint/medical.c +1 -0
  205. package/cpp/zxing-core/core/src/libzint/output.c +1 -0
  206. package/cpp/zxing-core/core/src/libzint/output.h +1 -0
  207. package/cpp/zxing-core/core/src/libzint/pdf417.c +1 -0
  208. package/cpp/zxing-core/core/src/libzint/pdf417.h +1 -0
  209. package/cpp/zxing-core/core/src/libzint/pdf417_tabs.h +1 -0
  210. package/cpp/zxing-core/core/src/libzint/qr.c +1 -0
  211. package/cpp/zxing-core/core/src/libzint/qr.h +1 -0
  212. package/cpp/zxing-core/core/src/libzint/raster.c +1 -0
  213. package/cpp/zxing-core/core/src/libzint/raster_font.h +1 -0
  214. package/cpp/zxing-core/core/src/libzint/reedsol.c +1 -0
  215. package/cpp/zxing-core/core/src/libzint/reedsol.h +1 -0
  216. package/cpp/zxing-core/core/src/libzint/reedsol_logs.h +1 -0
  217. package/cpp/zxing-core/core/src/libzint/rss.c +1 -0
  218. package/cpp/zxing-core/core/src/libzint/rss.h +1 -0
  219. package/cpp/zxing-core/core/src/libzint/sjis.h +1 -0
  220. package/cpp/zxing-core/core/src/libzint/stubs.c +137 -0
  221. package/cpp/zxing-core/core/src/libzint/svg.c +1 -0
  222. package/cpp/zxing-core/core/src/libzint/telepen.c +1 -0
  223. package/cpp/zxing-core/core/src/libzint/upcean.c +1 -0
  224. package/cpp/zxing-core/core/src/libzint/vector.c +1 -0
  225. package/cpp/zxing-core/core/src/libzint/zfiletypes.h +1 -0
  226. package/cpp/zxing-core/core/src/libzint/zint.h +1 -0
  227. package/cpp/zxing-core/core/src/libzint/zintconfig.h +1 -0
  228. package/cpp/zxing-core/core/src/libzueci/README.md +11 -0
  229. package/cpp/zxing-core/core/src/libzueci/zueci.c +1718 -0
  230. package/cpp/zxing-core/core/src/libzueci/zueci.h +179 -0
  231. package/cpp/zxing-core/core/src/libzueci/zueci_big5.h +3884 -0
  232. package/cpp/zxing-core/core/src/libzueci/zueci_common.h +31 -0
  233. package/cpp/zxing-core/core/src/libzueci/zueci_gb18030.h +264 -0
  234. package/cpp/zxing-core/core/src/libzueci/zueci_gb2312.h +2381 -0
  235. package/cpp/zxing-core/core/src/libzueci/zueci_gbk.h +4047 -0
  236. package/cpp/zxing-core/core/src/libzueci/zueci_ksx1001.h +2932 -0
  237. package/cpp/zxing-core/core/src/libzueci/zueci_sb.h +1112 -0
  238. package/cpp/zxing-core/core/src/libzueci/zueci_sjis.h +2286 -0
  239. package/cpp/zxing-core/core/src/maxicode/MCBitMatrixParser.cpp +68 -0
  240. package/cpp/zxing-core/core/src/maxicode/MCBitMatrixParser.h +30 -0
  241. package/cpp/zxing-core/core/src/maxicode/MCDecoder.cpp +329 -0
  242. package/cpp/zxing-core/core/src/maxicode/MCDecoder.h +19 -0
  243. package/cpp/zxing-core/core/src/maxicode/MCReader.cpp +65 -0
  244. package/cpp/zxing-core/core/src/maxicode/MCReader.h +21 -0
  245. package/cpp/zxing-core/core/src/oned/ODCodabarReader.cpp +102 -0
  246. package/cpp/zxing-core/core/src/oned/ODCodabarReader.h +21 -0
  247. package/cpp/zxing-core/core/src/oned/ODCodabarWriter.cpp +136 -0
  248. package/cpp/zxing-core/core/src/oned/ODCodabarWriter.h +34 -0
  249. package/cpp/zxing-core/core/src/oned/ODCode128Patterns.h +130 -0
  250. package/cpp/zxing-core/core/src/oned/ODCode128Reader.cpp +236 -0
  251. package/cpp/zxing-core/core/src/oned/ODCode128Reader.h +21 -0
  252. package/cpp/zxing-core/core/src/oned/ODCode128Writer.cpp +261 -0
  253. package/cpp/zxing-core/core/src/oned/ODCode128Writer.h +34 -0
  254. package/cpp/zxing-core/core/src/oned/ODCode39Reader.cpp +213 -0
  255. package/cpp/zxing-core/core/src/oned/ODCode39Reader.h +26 -0
  256. package/cpp/zxing-core/core/src/oned/ODCode39Writer.cpp +176 -0
  257. package/cpp/zxing-core/core/src/oned/ODCode39Writer.h +34 -0
  258. package/cpp/zxing-core/core/src/oned/ODCode93Patterns.h +80 -0
  259. package/cpp/zxing-core/core/src/oned/ODCode93Reader.cpp +112 -0
  260. package/cpp/zxing-core/core/src/oned/ODCode93Reader.h +21 -0
  261. package/cpp/zxing-core/core/src/oned/ODCode93Writer.cpp +192 -0
  262. package/cpp/zxing-core/core/src/oned/ODCode93Writer.h +32 -0
  263. package/cpp/zxing-core/core/src/oned/ODDXFilmEdgeReader.cpp +246 -0
  264. package/cpp/zxing-core/core/src/oned/ODDXFilmEdgeReader.h +26 -0
  265. package/cpp/zxing-core/core/src/oned/ODDataBarCommon.cpp +172 -0
  266. package/cpp/zxing-core/core/src/oned/ODDataBarCommon.h +204 -0
  267. package/cpp/zxing-core/core/src/oned/ODDataBarExpandedBitDecoder.cpp +253 -0
  268. package/cpp/zxing-core/core/src/oned/ODDataBarExpandedBitDecoder.h +19 -0
  269. package/cpp/zxing-core/core/src/oned/ODDataBarExpandedReader.cpp +383 -0
  270. package/cpp/zxing-core/core/src/oned/ODDataBarExpandedReader.h +25 -0
  271. package/cpp/zxing-core/core/src/oned/ODDataBarLimitedReader.cpp +163 -0
  272. package/cpp/zxing-core/core/src/oned/ODDataBarLimitedReader.h +23 -0
  273. package/cpp/zxing-core/core/src/oned/ODDataBarReader.cpp +240 -0
  274. package/cpp/zxing-core/core/src/oned/ODDataBarReader.h +25 -0
  275. package/cpp/zxing-core/core/src/oned/ODEAN13Writer.cpp +62 -0
  276. package/cpp/zxing-core/core/src/oned/ODEAN13Writer.h +34 -0
  277. package/cpp/zxing-core/core/src/oned/ODEAN8Writer.cpp +51 -0
  278. package/cpp/zxing-core/core/src/oned/ODEAN8Writer.h +34 -0
  279. package/cpp/zxing-core/core/src/oned/ODITFReader.cpp +97 -0
  280. package/cpp/zxing-core/core/src/oned/ODITFReader.h +33 -0
  281. package/cpp/zxing-core/core/src/oned/ODITFWriter.cpp +78 -0
  282. package/cpp/zxing-core/core/src/oned/ODITFWriter.h +34 -0
  283. package/cpp/zxing-core/core/src/oned/ODMultiUPCEANReader.cpp +323 -0
  284. package/cpp/zxing-core/core/src/oned/ODMultiUPCEANReader.h +32 -0
  285. package/cpp/zxing-core/core/src/oned/ODReader.cpp +259 -0
  286. package/cpp/zxing-core/core/src/oned/ODReader.h +35 -0
  287. package/cpp/zxing-core/core/src/oned/ODRowReader.h +222 -0
  288. package/cpp/zxing-core/core/src/oned/ODTelepenReader.cpp +199 -0
  289. package/cpp/zxing-core/core/src/oned/ODTelepenReader.h +25 -0
  290. package/cpp/zxing-core/core/src/oned/ODUPCAWriter.cpp +33 -0
  291. package/cpp/zxing-core/core/src/oned/ODUPCAWriter.h +34 -0
  292. package/cpp/zxing-core/core/src/oned/ODUPCEANCommon.cpp +80 -0
  293. package/cpp/zxing-core/core/src/oned/ODUPCEANCommon.h +129 -0
  294. package/cpp/zxing-core/core/src/oned/ODUPCEWriter.cpp +56 -0
  295. package/cpp/zxing-core/core/src/oned/ODUPCEWriter.h +34 -0
  296. package/cpp/zxing-core/core/src/oned/ODWriterHelper.cpp +39 -0
  297. package/cpp/zxing-core/core/src/oned/ODWriterHelper.h +48 -0
  298. package/cpp/zxing-core/core/src/pdf417/MicroPDFReader.cpp +796 -0
  299. package/cpp/zxing-core/core/src/pdf417/MicroPDFReader.h +23 -0
  300. package/cpp/zxing-core/core/src/pdf417/PDF417.cpp +85 -0
  301. package/cpp/zxing-core/core/src/pdf417/PDF417.h +81 -0
  302. package/cpp/zxing-core/core/src/pdf417/PDFBarcodeMetadata.h +53 -0
  303. package/cpp/zxing-core/core/src/pdf417/PDFBarcodeValue.cpp +48 -0
  304. package/cpp/zxing-core/core/src/pdf417/PDFBarcodeValue.h +38 -0
  305. package/cpp/zxing-core/core/src/pdf417/PDFBoundingBox.cpp +116 -0
  306. package/cpp/zxing-core/core/src/pdf417/PDFBoundingBox.h +75 -0
  307. package/cpp/zxing-core/core/src/pdf417/PDFCodeword.h +71 -0
  308. package/cpp/zxing-core/core/src/pdf417/PDFCodewordDecoder.cpp +588 -0
  309. package/cpp/zxing-core/core/src/pdf417/PDFCodewordDecoder.h +41 -0
  310. package/cpp/zxing-core/core/src/pdf417/PDFCompaction.h +20 -0
  311. package/cpp/zxing-core/core/src/pdf417/PDFCustomData.h +32 -0
  312. package/cpp/zxing-core/core/src/pdf417/PDFDecoder.cpp +725 -0
  313. package/cpp/zxing-core/core/src/pdf417/PDFDecoder.h +20 -0
  314. package/cpp/zxing-core/core/src/pdf417/PDFDetectionResult.cpp +247 -0
  315. package/cpp/zxing-core/core/src/pdf417/PDFDetectionResult.h +74 -0
  316. package/cpp/zxing-core/core/src/pdf417/PDFDetectionResultColumn.cpp +321 -0
  317. package/cpp/zxing-core/core/src/pdf417/PDFDetectionResultColumn.h +83 -0
  318. package/cpp/zxing-core/core/src/pdf417/PDFDetector.cpp +371 -0
  319. package/cpp/zxing-core/core/src/pdf417/PDFDetector.h +45 -0
  320. package/cpp/zxing-core/core/src/pdf417/PDFEncoder.cpp +570 -0
  321. package/cpp/zxing-core/core/src/pdf417/PDFEncoder.h +182 -0
  322. package/cpp/zxing-core/core/src/pdf417/PDFHighLevelEncoder.cpp +570 -0
  323. package/cpp/zxing-core/core/src/pdf417/PDFHighLevelEncoder.h +32 -0
  324. package/cpp/zxing-core/core/src/pdf417/PDFReader.cpp +333 -0
  325. package/cpp/zxing-core/core/src/pdf417/PDFReader.h +28 -0
  326. package/cpp/zxing-core/core/src/pdf417/PDFScanningDecoder.cpp +559 -0
  327. package/cpp/zxing-core/core/src/pdf417/PDFScanningDecoder.h +41 -0
  328. package/cpp/zxing-core/core/src/pdf417/PDFWriter.cpp +170 -0
  329. package/cpp/zxing-core/core/src/pdf417/PDFWriter.h +74 -0
  330. package/cpp/zxing-core/core/src/pdf417/ZXBigInteger.cpp +623 -0
  331. package/cpp/zxing-core/core/src/pdf417/ZXBigInteger.h +81 -0
  332. package/cpp/zxing-core/core/src/pdf417/ZXNullable.h +105 -0
  333. package/cpp/zxing-core/core/src/qrcode/QRBitMatrixParser.cpp +294 -0
  334. package/cpp/zxing-core/core/src/qrcode/QRBitMatrixParser.h +41 -0
  335. package/cpp/zxing-core/core/src/qrcode/QRCodecMode.cpp +95 -0
  336. package/cpp/zxing-core/core/src/qrcode/QRCodecMode.h +59 -0
  337. package/cpp/zxing-core/core/src/qrcode/QRDataBlock.cpp +93 -0
  338. package/cpp/zxing-core/core/src/qrcode/QRDataBlock.h +52 -0
  339. package/cpp/zxing-core/core/src/qrcode/QRDataMask.h +50 -0
  340. package/cpp/zxing-core/core/src/qrcode/QRDecoder.cpp +359 -0
  341. package/cpp/zxing-core/core/src/qrcode/QRDecoder.h +19 -0
  342. package/cpp/zxing-core/core/src/qrcode/QRDetector.cpp +920 -0
  343. package/cpp/zxing-core/core/src/qrcode/QRDetector.h +45 -0
  344. package/cpp/zxing-core/core/src/qrcode/QRECB.h +52 -0
  345. package/cpp/zxing-core/core/src/qrcode/QREncodeResult.h +33 -0
  346. package/cpp/zxing-core/core/src/qrcode/QREncoder.cpp +568 -0
  347. package/cpp/zxing-core/core/src/qrcode/QREncoder.h +21 -0
  348. package/cpp/zxing-core/core/src/qrcode/QRErrorCorrectionLevel.cpp +51 -0
  349. package/cpp/zxing-core/core/src/qrcode/QRErrorCorrectionLevel.h +39 -0
  350. package/cpp/zxing-core/core/src/qrcode/QRFormatInformation.cpp +160 -0
  351. package/cpp/zxing-core/core/src/qrcode/QRFormatInformation.h +61 -0
  352. package/cpp/zxing-core/core/src/qrcode/QRMaskUtil.cpp +156 -0
  353. package/cpp/zxing-core/core/src/qrcode/QRMaskUtil.h +15 -0
  354. package/cpp/zxing-core/core/src/qrcode/QRMatrixUtil.cpp +318 -0
  355. package/cpp/zxing-core/core/src/qrcode/QRMatrixUtil.h +25 -0
  356. package/cpp/zxing-core/core/src/qrcode/QRReader.cpp +149 -0
  357. package/cpp/zxing-core/core/src/qrcode/QRReader.h +21 -0
  358. package/cpp/zxing-core/core/src/qrcode/QRVersion.cpp +754 -0
  359. package/cpp/zxing-core/core/src/qrcode/QRVersion.h +127 -0
  360. package/cpp/zxing-core/core/src/qrcode/QRWriter.cpp +51 -0
  361. package/cpp/zxing-core/core/src/qrcode/QRWriter.h +74 -0
  362. package/cpp/zxing-core/core/version.rc.in +34 -0
  363. package/cpp/zxing-core/core/zxing.pc.in +8 -0
  364. package/cpp/zxing-core/wrappers/ios/README.md +25 -0
  365. package/cpp/zxing-core/wrappers/ios/Sources/Wrapper/Version.h +29 -0
  366. package/cpp/zxing-core/zxing-cpp.podspec +45 -0
  367. package/lib/factory.d.ts +10 -0
  368. package/lib/factory.js +12 -0
  369. package/lib/index.d.ts +9 -0
  370. package/lib/index.js +9 -0
  371. package/lib/specs/Barcode.nitro.d.ts +63 -0
  372. package/lib/specs/Barcode.nitro.js +1 -0
  373. package/lib/specs/BarcodeFormat.d.ts +11 -0
  374. package/lib/specs/BarcodeFormat.js +1 -0
  375. package/lib/specs/BarcodeScanner.nitro.d.ts +89 -0
  376. package/lib/specs/BarcodeScanner.nitro.js +1 -0
  377. package/lib/specs/BarcodeScannerFactory.nitro.d.ts +26 -0
  378. package/lib/specs/BarcodeScannerFactory.nitro.js +1 -0
  379. package/lib/specs/BarcodeValueType.d.ts +9 -0
  380. package/lib/specs/BarcodeValueType.js +1 -0
  381. package/lib/specs/Point.d.ts +14 -0
  382. package/lib/specs/Point.js +1 -0
  383. package/lib/specs/Rect.d.ts +22 -0
  384. package/lib/specs/Rect.js +1 -0
  385. package/lib/useBarcodeScanner.d.ts +23 -0
  386. package/lib/useBarcodeScanner.js +25 -0
  387. package/nitro.json +20 -0
  388. package/nitrogen/generated/.gitattributes +1 -0
  389. package/nitrogen/generated/android/VisionCameraZxing+autolinking.cmake +83 -0
  390. package/nitrogen/generated/android/VisionCameraZxing+autolinking.gradle +27 -0
  391. package/nitrogen/generated/android/VisionCameraZxingOnLoad.cpp +49 -0
  392. package/nitrogen/generated/android/VisionCameraZxingOnLoad.hpp +34 -0
  393. package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/zxing/VisionCameraZxingOnLoad.kt +35 -0
  394. package/nitrogen/generated/ios/VisionCameraZxing+autolinking.rb +62 -0
  395. package/nitrogen/generated/ios/VisionCameraZxing-Swift-Cxx-Bridge.cpp +17 -0
  396. package/nitrogen/generated/ios/VisionCameraZxing-Swift-Cxx-Bridge.hpp +27 -0
  397. package/nitrogen/generated/ios/VisionCameraZxing-Swift-Cxx-Umbrella.hpp +38 -0
  398. package/nitrogen/generated/ios/VisionCameraZxingAutolinking.mm +35 -0
  399. package/nitrogen/generated/ios/VisionCameraZxingAutolinking.swift +16 -0
  400. package/nitrogen/generated/shared/c++/BarcodeFormat.hpp +124 -0
  401. package/nitrogen/generated/shared/c++/BarcodeScannerOptions.hpp +85 -0
  402. package/nitrogen/generated/shared/c++/BarcodeValueType.hpp +120 -0
  403. package/nitrogen/generated/shared/c++/HybridBarcodeScannerSpec.cpp +23 -0
  404. package/nitrogen/generated/shared/c++/HybridBarcodeScannerSpec.hpp +74 -0
  405. package/nitrogen/generated/shared/c++/HybridBarcodeSpec.cpp +27 -0
  406. package/nitrogen/generated/shared/c++/HybridBarcodeSpec.hpp +82 -0
  407. package/nitrogen/generated/shared/c++/HybridZXingBarcodeScannerFactorySpec.cpp +21 -0
  408. package/nitrogen/generated/shared/c++/HybridZXingBarcodeScannerFactorySpec.hpp +67 -0
  409. package/nitrogen/generated/shared/c++/Point.hpp +87 -0
  410. package/nitrogen/generated/shared/c++/Rect.hpp +95 -0
  411. package/nitrogen/generated/shared/c++/TargetBarcodeFormat.hpp +124 -0
  412. package/package.json +108 -0
  413. package/react-native.config.js +16 -0
  414. package/src/factory.ts +26 -0
  415. package/src/index.ts +9 -0
  416. package/src/specs/Barcode.nitro.ts +70 -0
  417. package/src/specs/BarcodeFormat.ts +31 -0
  418. package/src/specs/BarcodeScanner.nitro.ts +91 -0
  419. package/src/specs/BarcodeScannerFactory.nitro.ts +27 -0
  420. package/src/specs/BarcodeValueType.ts +25 -0
  421. package/src/specs/Point.ts +14 -0
  422. package/src/specs/Rect.ts +22 -0
  423. package/src/useBarcodeScanner.ts +36 -0
@@ -0,0 +1,136 @@
1
+ /*
2
+ * Copyright 2016 Huy Cuong Nguyen
3
+ * Copyright 2016 ZXing authors
4
+ */
5
+ // SPDX-License-Identifier: Apache-2.0
6
+
7
+ #include "ODCodabarWriter.h"
8
+
9
+ #include "ODWriterHelper.h"
10
+ #include "Utf.h"
11
+ #include "ZXAlgorithms.h"
12
+
13
+ #include <stdexcept>
14
+ #include <string_view>
15
+ #include <vector>
16
+
17
+ namespace ZXing::OneD {
18
+
19
+ static constexpr std::wstring_view START_END_CHARS = L"ABCD";
20
+ static constexpr std::wstring_view ALT_START_END_CHARS = L"TN*E";
21
+ static constexpr std::wstring_view CHARS_WHICH_ARE_TEN_LENGTH_EACH_AFTER_DECODED = L"/:+.";
22
+ static constexpr wchar_t DEFAULT_GUARD = START_END_CHARS[0];
23
+
24
+ static constexpr std::wstring_view ALPHABET = L"0123456789-$:/.+ABCD";
25
+
26
+ static constexpr int WIDE_TO_NARROW_BAR_RATIO = 2; //TODO: spec says 2.25 to 3 is the valid range. So this is technically illformed.
27
+
28
+ /**
29
+ * These represent the encodings of characters, as patterns of wide and narrow bars. The 7 least-significant bits of
30
+ * each int correspond to the pattern of wide and narrow, with 1s representing "wide" and 0s representing narrow.
31
+ */
32
+ static const int CHARACTER_ENCODINGS[] = {
33
+ 0x003, 0x006, 0x009, 0x060, 0x012, 0x042, 0x021, 0x024, 0x030, 0x048, // 0-9
34
+ 0x00c, 0x018, 0x045, 0x051, 0x054, 0x015, 0x01A, 0x029, 0x00B, 0x00E, // -$:/.+ABCD
35
+ };
36
+
37
+ static_assert(Size(ALPHABET) == Size(CHARACTER_ENCODINGS), "table size mismatch");
38
+
39
+ BitMatrix
40
+ CodabarWriter::encode(const std::wstring& contents_, int width, int height) const
41
+ {
42
+ std::wstring contents = contents_;
43
+ if (contents.empty()) {
44
+ throw std::invalid_argument("Found empty contents");
45
+ }
46
+ if (contents.length() < 2) {
47
+ // Can't have a start/end guard, so tentatively add default guards
48
+ contents = DEFAULT_GUARD + contents + DEFAULT_GUARD;
49
+ }
50
+ else {
51
+ // Verify input and calculate decoded length.
52
+ bool startsNormal = Contains(START_END_CHARS, contents.front());
53
+ bool endsNormal = Contains(START_END_CHARS, contents.back());
54
+ bool startsAlt = Contains(ALT_START_END_CHARS, contents.front());
55
+ bool endsAlt = Contains(ALT_START_END_CHARS, contents.back());
56
+ if (startsNormal) {
57
+ if (!endsNormal) {
58
+ throw std::invalid_argument("Invalid start/end guards");
59
+ }
60
+ // else already has valid start/end
61
+ }
62
+ else if (startsAlt) {
63
+ if (!endsAlt) {
64
+ throw std::invalid_argument("Invalid start/end guards");
65
+ }
66
+ // else already has valid start/end
67
+
68
+ // map alt characters to normal once so they are found in the ALPHABET
69
+ auto map_alt_guard_char = [](wchar_t& c) {
70
+ switch (c) {
71
+ case 'T': c = 'A'; break;
72
+ case 'N': c = 'B'; break;
73
+ case '*': c = 'C'; break;
74
+ case 'E': c = 'D'; break;
75
+ }
76
+ };
77
+ map_alt_guard_char(contents.front());
78
+ map_alt_guard_char(contents.back());
79
+ }
80
+ else {
81
+ // Doesn't start with a guard
82
+ if (endsNormal || endsAlt) {
83
+ throw std::invalid_argument("Invalid start/end guards");
84
+ }
85
+ // else doesn't end with guard either, so add a default
86
+ contents = DEFAULT_GUARD + contents + DEFAULT_GUARD;
87
+ }
88
+ }
89
+
90
+ // The start character and the end character are decoded to 10 length each.
91
+ size_t resultLength = 20;
92
+ for (size_t i = 1; i + 1 < contents.length(); ++i) {
93
+ auto c = contents[i];
94
+ if (IsDigit(c) || c == '-' || c == '$') {
95
+ resultLength += 9;
96
+ }
97
+ else if (Contains(CHARS_WHICH_ARE_TEN_LENGTH_EACH_AFTER_DECODED, c)) {
98
+ resultLength += 10;
99
+ }
100
+ else {
101
+ throw std::invalid_argument(StrCat("Cannot encode : '", static_cast<char>(c), "'"));
102
+ }
103
+ }
104
+ // A blank is placed between each character.
105
+ resultLength += contents.length() - 1;
106
+
107
+ std::vector<bool> result(resultLength, false);
108
+ auto position = result.begin();
109
+ for (wchar_t c : contents) {
110
+ int code = CHARACTER_ENCODINGS[IndexOf(ALPHABET, c)]; // c is checked above to be in ALPHABET
111
+ bool isBlack = true;
112
+ int counter = 0; // count the width of the current bar
113
+ int bit = 0;
114
+ while (bit < 7) { // A character consists of 7 digit.
115
+ *position++ = isBlack;
116
+ ++counter;
117
+ if (((code >> (6 - bit)) & 1) == 0 || counter == WIDE_TO_NARROW_BAR_RATIO) { // if current bar is short or we
118
+ isBlack = !isBlack; // Flip the color.
119
+ bit++;
120
+ counter = 0;
121
+ }
122
+ }
123
+ if (position != result.end()) {
124
+ *position++ = false; // inter character whitespace
125
+ }
126
+ }
127
+
128
+ return WriterHelper::RenderResult(result, width, height, _sidesMargin >= 0 ? _sidesMargin : 10);
129
+ }
130
+
131
+ BitMatrix CodabarWriter::encode(const std::string& contents, int width, int height) const
132
+ {
133
+ return encode(FromUtf8(contents), width, height);
134
+ }
135
+
136
+ } // 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 class renders CodaBar as {@code boolean[]}.
19
+ *
20
+ * @author dsbnatut@gmail.com (Kazuki Nishiura)
21
+ */
22
+ class CodabarWriter
23
+ {
24
+ public:
25
+ CodabarWriter& 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,130 @@
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 "Pattern.h"
10
+
11
+ namespace ZXing::OneD::Code128 {
12
+
13
+ constexpr int CHAR_LEN = 6;
14
+ constexpr int CHAR_MODS = 11;
15
+
16
+ // See ISO/IEC 15417:2007(E) Table 1
17
+ constexpr std::array<FixedPattern<CHAR_LEN, CHAR_MODS>, 107> CODE_PATTERNS = { {
18
+ { 2, 1, 2, 2, 2, 2 }, // 0
19
+ { 2, 2, 2, 1, 2, 2 },
20
+ { 2, 2, 2, 2, 2, 1 },
21
+ { 1, 2, 1, 2, 2, 3 },
22
+ { 1, 2, 1, 3, 2, 2 },
23
+ { 1, 3, 1, 2, 2, 2 }, // 5
24
+ { 1, 2, 2, 2, 1, 3 },
25
+ { 1, 2, 2, 3, 1, 2 },
26
+ { 1, 3, 2, 2, 1, 2 },
27
+ { 2, 2, 1, 2, 1, 3 },
28
+ { 2, 2, 1, 3, 1, 2 }, // 10
29
+ { 2, 3, 1, 2, 1, 2 },
30
+ { 1, 1, 2, 2, 3, 2 },
31
+ { 1, 2, 2, 1, 3, 2 },
32
+ { 1, 2, 2, 2, 3, 1 },
33
+ { 1, 1, 3, 2, 2, 2 }, // 15
34
+ { 1, 2, 3, 1, 2, 2 },
35
+ { 1, 2, 3, 2, 2, 1 },
36
+ { 2, 2, 3, 2, 1, 1 },
37
+ { 2, 2, 1, 1, 3, 2 },
38
+ { 2, 2, 1, 2, 3, 1 }, // 20
39
+ { 2, 1, 3, 2, 1, 2 },
40
+ { 2, 2, 3, 1, 1, 2 },
41
+ { 3, 1, 2, 1, 3, 1 },
42
+ { 3, 1, 1, 2, 2, 2 },
43
+ { 3, 2, 1, 1, 2, 2 }, // 25
44
+ { 3, 2, 1, 2, 2, 1 },
45
+ { 3, 1, 2, 2, 1, 2 },
46
+ { 3, 2, 2, 1, 1, 2 },
47
+ { 3, 2, 2, 2, 1, 1 },
48
+ { 2, 1, 2, 1, 2, 3 }, // 30
49
+ { 2, 1, 2, 3, 2, 1 },
50
+ { 2, 3, 2, 1, 2, 1 },
51
+ { 1, 1, 1, 3, 2, 3 },
52
+ { 1, 3, 1, 1, 2, 3 },
53
+ { 1, 3, 1, 3, 2, 1 }, // 35
54
+ { 1, 1, 2, 3, 1, 3 },
55
+ { 1, 3, 2, 1, 1, 3 },
56
+ { 1, 3, 2, 3, 1, 1 },
57
+ { 2, 1, 1, 3, 1, 3 },
58
+ { 2, 3, 1, 1, 1, 3 }, // 40
59
+ { 2, 3, 1, 3, 1, 1 },
60
+ { 1, 1, 2, 1, 3, 3 },
61
+ { 1, 1, 2, 3, 3, 1 },
62
+ { 1, 3, 2, 1, 3, 1 },
63
+ { 1, 1, 3, 1, 2, 3 }, // 45
64
+ { 1, 1, 3, 3, 2, 1 },
65
+ { 1, 3, 3, 1, 2, 1 },
66
+ { 3, 1, 3, 1, 2, 1 },
67
+ { 2, 1, 1, 3, 3, 1 },
68
+ { 2, 3, 1, 1, 3, 1 }, // 50
69
+ { 2, 1, 3, 1, 1, 3 },
70
+ { 2, 1, 3, 3, 1, 1 },
71
+ { 2, 1, 3, 1, 3, 1 },
72
+ { 3, 1, 1, 1, 2, 3 },
73
+ { 3, 1, 1, 3, 2, 1 }, // 55
74
+ { 3, 3, 1, 1, 2, 1 },
75
+ { 3, 1, 2, 1, 1, 3 },
76
+ { 3, 1, 2, 3, 1, 1 },
77
+ { 3, 3, 2, 1, 1, 1 },
78
+ { 3, 1, 4, 1, 1, 1 }, // 60
79
+ { 2, 2, 1, 4, 1, 1 },
80
+ { 4, 3, 1, 1, 1, 1 },
81
+ { 1, 1, 1, 2, 2, 4 },
82
+ { 1, 1, 1, 4, 2, 2 },
83
+ { 1, 2, 1, 1, 2, 4 }, // 65
84
+ { 1, 2, 1, 4, 2, 1 },
85
+ { 1, 4, 1, 1, 2, 2 },
86
+ { 1, 4, 1, 2, 2, 1 },
87
+ { 1, 1, 2, 2, 1, 4 },
88
+ { 1, 1, 2, 4, 1, 2 }, // 70
89
+ { 1, 2, 2, 1, 1, 4 },
90
+ { 1, 2, 2, 4, 1, 1 },
91
+ { 1, 4, 2, 1, 1, 2 },
92
+ { 1, 4, 2, 2, 1, 1 },
93
+ { 2, 4, 1, 2, 1, 1 }, // 75
94
+ { 2, 2, 1, 1, 1, 4 },
95
+ { 4, 1, 3, 1, 1, 1 },
96
+ { 2, 4, 1, 1, 1, 2 },
97
+ { 1, 3, 4, 1, 1, 1 },
98
+ { 1, 1, 1, 2, 4, 2 }, // 80
99
+ { 1, 2, 1, 1, 4, 2 },
100
+ { 1, 2, 1, 2, 4, 1 },
101
+ { 1, 1, 4, 2, 1, 2 },
102
+ { 1, 2, 4, 1, 1, 2 },
103
+ { 1, 2, 4, 2, 1, 1 }, // 85
104
+ { 4, 1, 1, 2, 1, 2 },
105
+ { 4, 2, 1, 1, 1, 2 },
106
+ { 4, 2, 1, 2, 1, 1 },
107
+ { 2, 1, 2, 1, 4, 1 },
108
+ { 2, 1, 4, 1, 2, 1 }, // 90
109
+ { 4, 1, 2, 1, 2, 1 },
110
+ { 1, 1, 1, 1, 4, 3 },
111
+ { 1, 1, 1, 3, 4, 1 },
112
+ { 1, 3, 1, 1, 4, 1 },
113
+ { 1, 1, 4, 1, 1, 3 }, // 95
114
+ { 1, 1, 4, 3, 1, 1 },
115
+ { 4, 1, 1, 1, 1, 3 },
116
+ { 4, 1, 1, 3, 1, 1 },
117
+ { 1, 1, 3, 1, 4, 1 },
118
+ { 1, 1, 4, 1, 3, 1 }, // 100
119
+ { 3, 1, 1, 1, 4, 1 },
120
+ { 4, 1, 1, 1, 3, 1 },
121
+ { 2, 1, 1, 4, 1, 2 },
122
+ { 2, 1, 1, 2, 1, 4 },
123
+ { 2, 1, 1, 2, 3, 2 }, // 105
124
+ { 2, 3, 3, 1, 1, 1 } // STOP_CODE followed by 2-wide termination bar
125
+ } };
126
+
127
+ // See ISO/IEC 15417:2007(E) Table 2
128
+ constexpr auto E2E_PATTERNS = PatternsToE2EInts(CODE_PATTERNS);
129
+
130
+ } // namespace ZXing::OneD::Code128
@@ -0,0 +1,236 @@
1
+ /*
2
+ * Copyright 2016 Nu-book Inc.
3
+ * Copyright 2016 ZXing authors
4
+ */
5
+ // SPDX-License-Identifier: Apache-2.0
6
+
7
+ #include "ODCode128Reader.h"
8
+
9
+ #include "ODCode128Patterns.h"
10
+ #include "BarcodeData.h"
11
+ #include "ByteArray.h"
12
+ #include "JSON.h"
13
+ #include "SymbologyIdentifier.h"
14
+ #include "ZXAlgorithms.h"
15
+
16
+ #include <array>
17
+ #include <cstddef>
18
+ #include <cstdint>
19
+ #include <string>
20
+ #include <vector>
21
+
22
+ namespace ZXing::OneD {
23
+
24
+ using namespace Code128;
25
+
26
+ static const float MAX_AVG_VARIANCE = 0.25f;
27
+ static const float MAX_INDIVIDUAL_VARIANCE = 0.7f;
28
+
29
+ static const int CODE_SHIFT = 98;
30
+
31
+ static const int CODE_CODE_C = 99;
32
+ static const int CODE_CODE_B = 100;
33
+ static const int CODE_CODE_A = 101;
34
+
35
+ static const int CODE_FNC_1 = 102;
36
+ static const int CODE_FNC_2 = 97;
37
+ static const int CODE_FNC_3 = 96;
38
+
39
+ static const int CODE_START_A = 103;
40
+ static const int CODE_START_C = 105;
41
+ static const int CODE_STOP = 106;
42
+
43
+ class Raw2TxtDecoder
44
+ {
45
+ int codeSet = 0;
46
+ SymbologyIdentifier _symbologyIdentifier = {'C', '0'}; // ISO/IEC 15417:2007 Annex C Table C.1
47
+ bool _readerInit = false;
48
+ bool _havePositionFNC1 = false;
49
+ std::string txt;
50
+ size_t lastTxtSize = 0;
51
+
52
+ bool fnc4All = false;
53
+ bool fnc4Next = false;
54
+ bool shift = false;
55
+
56
+ void fnc1(const bool isCodeSetC)
57
+ {
58
+ if (!_havePositionFNC1 && txt.empty()) {
59
+ // ISO/IEC 15417:2007 Annex B.1 and GS1 General Specifications 21.0.1 Section 5.4.3.7
60
+ // If the first char after the start code is FNC1 then this is GS1-128.
61
+ _symbologyIdentifier.modifier = '1';
62
+ // GS1 General Specifications Section 5.4.6.4
63
+ // "Transmitted data ... is prefixed by the symbology identifier ]C1, if used."
64
+ // Choosing not to use symbology identifier, i.e. to not prefix to data.
65
+ _symbologyIdentifier.aiFlag = AIFlag::GS1;
66
+ _havePositionFNC1 = true;
67
+ }
68
+ else if (!_havePositionFNC1
69
+ && ((isCodeSetC && txt.size() == 2 && IsDigit(txt[0]) && IsDigit(txt[1]))
70
+ || (!isCodeSetC && txt.size() == 1 && IsAlpha(txt[0])))) {
71
+ // ISO/IEC 15417:2007 Annex B.2
72
+ // FNC1 in second position following Code Set C "00-99" or Code Set A/B "A-Za-z" - AIM
73
+ _symbologyIdentifier.modifier = '2';
74
+ _symbologyIdentifier.aiFlag = AIFlag::AIM;
75
+ _havePositionFNC1 = true;
76
+ }
77
+ else {
78
+ // ISO/IEC 15417:2007 Annex B.3. Otherwise FNC1 is returned as ASCII 29 (GS)
79
+ txt.push_back((char)29);
80
+ }
81
+ };
82
+
83
+ public:
84
+ Raw2TxtDecoder(int startCode) : codeSet(204 - startCode)
85
+ {
86
+ txt.reserve(20);
87
+ }
88
+
89
+ bool decode(int code)
90
+ {
91
+ lastTxtSize = txt.size();
92
+
93
+ if (codeSet == CODE_CODE_C) {
94
+ if (code < 100) {
95
+ txt.append(ToString(code, 2));
96
+ } else if (code == CODE_FNC_1) {
97
+ fnc1(true /*isCodeSetC*/);
98
+ } else {
99
+ codeSet = code; // CODE_A / CODE_B
100
+ }
101
+ } else { // codeSet A or B
102
+ bool unshift = shift;
103
+
104
+ switch (code) {
105
+ case CODE_FNC_1: fnc1(false /*isCodeSetC*/); break;
106
+ case CODE_FNC_2:
107
+ // Message Append - do nothing?
108
+ break;
109
+ case CODE_FNC_3:
110
+ _readerInit = true; // Can occur anywhere in the symbol (ISO/IEC 15417:2007 4.3.4.2 (c))
111
+ break;
112
+ case CODE_SHIFT:
113
+ if (shift)
114
+ return false; // two shifts in a row make no sense
115
+ shift = true;
116
+ codeSet = codeSet == CODE_CODE_A ? CODE_CODE_B : CODE_CODE_A;
117
+ break;
118
+ case CODE_CODE_A:
119
+ case CODE_CODE_B:
120
+ if (codeSet == code) {
121
+ // FNC4
122
+ if (fnc4Next)
123
+ fnc4All = !fnc4All;
124
+ fnc4Next = !fnc4Next;
125
+ } else {
126
+ codeSet = code;
127
+ }
128
+ break;
129
+ case CODE_CODE_C: codeSet = CODE_CODE_C; break;
130
+
131
+ default: {
132
+ // code < 96 at this point
133
+ int offset;
134
+ if (codeSet == CODE_CODE_A && code >= 64)
135
+ offset = fnc4All == fnc4Next ? -64 : +64;
136
+ else
137
+ offset = fnc4All == fnc4Next ? ' ' : ' ' + 128;
138
+ txt.push_back((char)(code + offset));
139
+ fnc4Next = false;
140
+ break;
141
+ }
142
+ }
143
+
144
+ // Unshift back to another code set if we were shifted
145
+ if (unshift) {
146
+ codeSet = codeSet == CODE_CODE_A ? CODE_CODE_B : CODE_CODE_A;
147
+ shift = false;
148
+ }
149
+ }
150
+
151
+ return true;
152
+ }
153
+
154
+ std::string text() const
155
+ {
156
+ // Need to pull out the check digit(s) from string (if the checksum code happened to
157
+ // be a printable character).
158
+ return txt.substr(0, lastTxtSize);
159
+ }
160
+
161
+ SymbologyIdentifier symbologyIdentifier() const { return _symbologyIdentifier; }
162
+ bool readerInit() const { return _readerInit; }
163
+ };
164
+
165
+ // all 3 start patterns share the same 2-1-1 prefix
166
+ constexpr auto START_PATTERN_PREFIX = FixedPattern<3, 4>{2, 1, 1};
167
+ constexpr float QUIET_ZONE = 5; // quiet zone spec is 10 modules, real world examples ignore that, see #138
168
+
169
+ BarcodeData Code128Reader::decodePattern(int rowNumber, PatternView& next, std::unique_ptr<DecodingState>&) const
170
+ {
171
+ int minCharCount = 4; // start + payload + checksum + stop
172
+ auto decodePattern = [](const PatternView& view, bool start = false) {
173
+ // This is basically the reference algorithm from the specification
174
+ int code = IndexOf(E2E_PATTERNS, ToInt(NormalizedE2EPattern<CHAR_LEN, CHAR_MODS>(view)));
175
+ if (code == -1 && !start) // if the reference algo fails, give the original upstream version a try (required to decode a few samples)
176
+ code = DecodeDigit(view, CODE_PATTERNS, MAX_AVG_VARIANCE, MAX_INDIVIDUAL_VARIANCE);
177
+ return code;
178
+ };
179
+
180
+ next = FindLeftGuard(next, minCharCount * CHAR_LEN, START_PATTERN_PREFIX, QUIET_ZONE);
181
+ if (!next.isValid())
182
+ return {};
183
+
184
+ next = next.subView(0, CHAR_LEN);
185
+ int startCode = decodePattern(next, true);
186
+ if (!(CODE_START_A <= startCode && startCode <= CODE_START_C))
187
+ return {};
188
+
189
+ int xStart = next.pixelsInFront();
190
+ ByteArray rawCodes;
191
+ rawCodes.reserve(20);
192
+ rawCodes.push_back(narrow_cast<uint8_t>(startCode));
193
+
194
+ Raw2TxtDecoder raw2txt(startCode);
195
+
196
+ while (true) {
197
+ if (!next.skipSymbol())
198
+ return {};
199
+
200
+ // Decode another code from image
201
+ int code = decodePattern(next);
202
+ if (code == -1)
203
+ return {};
204
+ if (code == CODE_STOP)
205
+ break;
206
+ if (code >= CODE_START_A)
207
+ return {};
208
+ if (!raw2txt.decode(code))
209
+ return {};
210
+
211
+ rawCodes.push_back(narrow_cast<uint8_t>(code));
212
+ }
213
+
214
+ if (Size(rawCodes) < minCharCount - 1) // stop code is missing in rawCodes
215
+ return {};
216
+
217
+ // check termination bar (is present and not wider than about 2 modules) and quiet zone (next is now 13 modules
218
+ // wide, require at least 8)
219
+ next = next.subView(0, CHAR_LEN + 1);
220
+ if (!next.isValid() || next[CHAR_LEN] > next.sum(CHAR_LEN) / 4 || !next.hasQuietZoneAfter(QUIET_ZONE/13))
221
+ return {};
222
+
223
+ Error error;
224
+ int checksum = rawCodes.front();
225
+ for (int i = 1; i < Size(rawCodes) - 1; ++i)
226
+ checksum += i * rawCodes[i];
227
+ // the last code is the checksum:
228
+ if (checksum % 103 != rawCodes.back())
229
+ error = ChecksumError();
230
+
231
+ int xStop = next.pixelsTillEnd();
232
+ return LinearBarcode(BarcodeFormat::Code128, raw2txt.text(), rowNumber, xStart, xStop, raw2txt.symbologyIdentifier(), error,
233
+ JsonProp(BarcodeExtra::ReaderInit, raw2txt.readerInit()));
234
+ }
235
+
236
+ } // 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 Code128Reader : 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