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,286 @@
1
+ /*
2
+ * Copyright 2026 Axel Waggershauser
3
+ */
4
+ // SPDX-License-Identifier: Apache-2.0
5
+
6
+ #include "BarcodeFormat.h"
7
+
8
+ #include "Version.h"
9
+ #include "ZXAlgorithms.h"
10
+
11
+ #include <algorithm>
12
+
13
+ namespace ZXing {
14
+
15
+ // =================================== BarcodeFormat =================================
16
+
17
+ static_assert(ZX_BCF_ID('\0', '\0') == 0, "BarcodeFormat encoding error");
18
+
19
+ BarcodeFormat Symbology(BarcodeFormat format)
20
+ {
21
+ return BarcodeFormat(ZX_BCF_ID(SymbologyKey(format), ' ' * (VariantKey(format) != 0)));
22
+ }
23
+
24
+ std::string_view Name(BarcodeFormat format)
25
+ {
26
+ switch (format) {
27
+ #define X(NAME, SYM, VAR, FLAGS, ZINT, ENABLED, HRI) \
28
+ case BarcodeFormat(ZX_BCF_ID(SYM, VAR)): return HRI;
29
+ ZX_BCF_LIST(X)
30
+ #undef X
31
+ default: return "Unknown";
32
+ };
33
+ }
34
+
35
+ BarcodeFormat BarcodeFormatFromString(std::string_view str)
36
+ {
37
+ if (str.size() < 3)
38
+ throw std::invalid_argument(StrCat("This is not a valid barcode format: '", str, "'"));
39
+ #define X(NAME, SYM, VAR, FLAGS, ZINT, ENABLED, HRI) \
40
+ if ((str[0] == ']' && str[1] == SYM && str[2] == VAR) || IsEqualIgnoreCase(str, #NAME) || IsEqualIgnoreCaseAnd(str, HRI, " -_/")) \
41
+ return BarcodeFormat(ZX_BCF_ID(SYM, VAR));
42
+ ZX_BCF_LIST(X)
43
+ #undef X
44
+ throw std::invalid_argument(StrCat("This is not a valid barcode format: '", str, "'"));
45
+ }
46
+
47
+ std::string ToString(BarcodeFormat format)
48
+ {
49
+ return std::string(Name(format));
50
+ }
51
+
52
+ bool operator<=(BarcodeFormat e, BarcodeFormat s)
53
+ {
54
+ return e == s || s == BarcodeFormat::All
55
+ || (SymbologyKey(s) == '*' ? SymbologyKey(e) != '*' && (e & s)
56
+ : SymbologyKey(s) == SymbologyKey(e) && VariantKey(s) == ' ');
57
+ }
58
+
59
+ bool operator&(BarcodeFormat a, BarcodeFormat b)
60
+ {
61
+ if (SymbologyKey(a) == '*' && SymbologyKey(b) == '*') {
62
+ switch (VariantKey(a)) {
63
+ case 'l': return ZXING_ENABLE_1D && !Contains("smp", VariantKey(b));
64
+ case 's': return ZXING_ENABLE_PDF417 && !Contains("lmp", VariantKey(b));
65
+ case 'p': return !Contains("lms", VariantKey(b)); // TODO: postal codes
66
+ case 'm':
67
+ return (ZXING_ENABLE_MAXICODE || ZXING_ENABLE_QRCODE || ZXING_ENABLE_DATAMATRIX || ZXING_ENABLE_AZTEC)
68
+ && !Contains("lsp", VariantKey(b));
69
+ default: return true;
70
+ }
71
+ }
72
+
73
+ if (SymbologyKey(a) == '*')
74
+ std::swap(a, b);
75
+
76
+ if (SymbologyKey(b) == '*') {
77
+ char vkb = VariantKey(b);
78
+ if (vkb == '*')
79
+ return true;
80
+
81
+ switch (a) {
82
+ #ifdef ZXING_USE_ZINT
83
+ #define USING_ZINT 1
84
+ #else
85
+ #define USING_ZINT 0
86
+ #endif
87
+ #define X(NAME, SYM, VAR, FLAGS, ZINT, ENABLED, HRI) \
88
+ case BarcodeFormat(ZX_BCF_ID(SYM, VAR)): \
89
+ return ENABLED \
90
+ && ((vkb == 'w' && USING_ZINT) ? ZINT : (FLAGS[0] == vkb || FLAGS[1] == vkb || FLAGS[2] == vkb || FLAGS[3] == vkb || FLAGS[4] == vkb));
91
+ ZX_BCF_LIST(X)
92
+ #undef X
93
+ };
94
+ }
95
+
96
+ if (a == b || Symbology(a) == b || a == Symbology(b))
97
+ return true;
98
+
99
+ return false;
100
+ }
101
+
102
+ // ==================================== BarcodeFormats =================================
103
+
104
+ inline bool operator<(BarcodeFormat a, BarcodeFormat b)
105
+ {
106
+ return SymbologyKey(a) < SymbologyKey(b) || (SymbologyKey(a) == SymbologyKey(b) && VariantKey(a) < VariantKey(b));
107
+ }
108
+
109
+ void BarcodeFormats::normalize()
110
+ {
111
+ std::erase_if(formats_, [](BarcodeFormat t) { return t == BarcodeFormat::None; });
112
+ std::sort(formats_.begin(), formats_.end());
113
+ formats_.erase(std::unique(formats_.begin(), formats_.end()), formats_.end());
114
+ }
115
+
116
+ BarcodeFormats::BarcodeFormats(std::string_view str)
117
+ {
118
+ while (str.size() >= 3 && str[0] == ']') {
119
+ formats_.push_back(BarcodeFormat(ZX_BCF_ID(str[1], str[2])));
120
+ str.remove_prefix(3);
121
+ }
122
+
123
+ ForEachToken(TrimWS(str, " []"), ",|", [this](std::string_view token) {
124
+ if (!token.empty())
125
+ formats_.push_back(BarcodeFormatFromString(token));
126
+ });
127
+
128
+ normalize();
129
+ }
130
+
131
+ BarcodeFormats BarcodeFormats::list(const BarcodeFormats& filter)
132
+ {
133
+ std::vector<BarcodeFormat> res;
134
+ res.reserve(100);
135
+ if (filter.empty()) {
136
+ #define X(NAME, SYM, VAR, FLAGS, ZINT, ENABLED, HRI) \
137
+ if (ENABLED) \
138
+ res.push_back(BarcodeFormat(ZX_BCF_ID(SYM, VAR)));
139
+ ZX_BCF_LIST(X)
140
+ #undef X
141
+ return res;
142
+ }
143
+ for (auto f : filter) {
144
+ // printf("Filter for: %s\n", IdStr(f).c_str());
145
+ #define X(NAME, SYM, VAR, FLAGS, ZINT, ENABLED, HRI) \
146
+ if (ENABLED && SYM != '*' \
147
+ && (SymbologyKey(f) == '*' ? BarcodeFormat(ZX_BCF_ID(SYM, VAR)) & f \
148
+ : SYM == SymbologyKey(f) && (VariantKey(f) == ' ' || VariantKey(f) == VAR))) \
149
+ res.push_back(BarcodeFormat(ZX_BCF_ID(SYM, VAR))); //, printf("adding: %c %c\n", SYM, VAR);
150
+ ZX_BCF_LIST(X)
151
+ #undef X
152
+ // printf("N: %d\n", (int)res.size());
153
+ }
154
+ return res;
155
+ }
156
+
157
+ // BarcodeFormats&& BarcodeFormats::operator|(BarcodeFormat bt) &&
158
+ // {
159
+ // types_.push_back(bt);
160
+ // normalize();
161
+ // return std::move(*this);
162
+ // }
163
+
164
+ // BarcodeFormats&& BarcodeFormats::operator|(const BarcodeFormats& other) &&
165
+ // {
166
+ // types_.insert(std::end(types_), other.begin(), other.end());
167
+ // normalize();
168
+ // return std::move(*this);
169
+ // }
170
+
171
+ BarcodeFormats BarcodeFormats::operator&(const BarcodeFormats& other)
172
+ {
173
+ std::vector<BarcodeFormat> res;
174
+ for (auto l : formats_)
175
+ for (auto r : other.formats_)
176
+ if (l <= r)
177
+ res.push_back(l);
178
+ else if (r <= l)
179
+ res.push_back(r);
180
+ return res;
181
+ }
182
+
183
+ BarcodeFormats BarcodeFormatsFromString(std::string_view str)
184
+ {
185
+ return BarcodeFormats(str);
186
+ }
187
+
188
+ std::string ToString(const BarcodeFormats& formats)
189
+ {
190
+ if (formats.empty())
191
+ return {};
192
+ std::string res;
193
+ for (auto f : formats)
194
+ res += std::string(Name(f)) + ", ";
195
+ return res.substr(0, res.size() - 2);
196
+ }
197
+
198
+ } // namespace ZXing
199
+
200
+ #if 0
201
+ /*
202
+ * Copyright 2016 Nu-book Inc.
203
+ * Copyright 2016 ZXing authors
204
+ */
205
+ // SPDX-License-Identifier: Apache-2.0
206
+
207
+ #include "BarcodeFormat.h"
208
+
209
+ #include "ZXAlgorithms.h"
210
+
211
+ #include <iterator>
212
+ #include <stdexcept>
213
+
214
+ namespace ZXing {
215
+
216
+ struct BarcodeFormatName
217
+ {
218
+ BarcodeFormat format;
219
+ std::string_view name;
220
+ };
221
+
222
+ static const BarcodeFormatName NAMES[] = {
223
+ {BarcodeFormat::None, "None"},
224
+ {BarcodeFormat::Aztec, "Aztec"},
225
+ {BarcodeFormat::Codabar, "Codabar"},
226
+ {BarcodeFormat::Code39, "Code39"},
227
+ {BarcodeFormat::Code93, "Code93"},
228
+ {BarcodeFormat::Code128, "Code128"},
229
+ {BarcodeFormat::DataBar, "DataBar"},
230
+ {BarcodeFormat::DataBarExpanded, "DataBarExpanded"},
231
+ {BarcodeFormat::DataBarLimited, "DataBarLimited"},
232
+ {BarcodeFormat::DataMatrix, "DataMatrix"},
233
+ {BarcodeFormat::DXFilmEdge, "DXFilmEdge"},
234
+ {BarcodeFormat::EAN8, "EAN-8"},
235
+ {BarcodeFormat::EAN13, "EAN-13"},
236
+ {BarcodeFormat::ITF, "ITF"},
237
+ {BarcodeFormat::MaxiCode, "MaxiCode"},
238
+ {BarcodeFormat::MicroPDF417, "MicroPDF417"},
239
+ {BarcodeFormat::MicroQRCode, "MicroQRCode"},
240
+ {BarcodeFormat::PDF417, "PDF417"},
241
+ {BarcodeFormat::QRCode, "QRCode"},
242
+ {BarcodeFormat::RMQRCode, "rMQRCode"},
243
+ {BarcodeFormat::UPCA, "UPC-A"},
244
+ {BarcodeFormat::UPCE, "UPC-E"},
245
+ {BarcodeFormat::LinearCodes, "Linear-Codes"},
246
+ {BarcodeFormat::MatrixCodes, "Matrix-Codes"},
247
+ };
248
+
249
+ std::string ToString(BarcodeFormat format)
250
+ {
251
+ auto i = FindIf(NAMES, [format](auto& v) { return v.format == format; });
252
+ return i == std::end(NAMES) ? std::string() : std::string(i->name);
253
+ }
254
+
255
+ std::string ToString(BarcodeFormats formats)
256
+ {
257
+ if (formats.empty())
258
+ return ToString(BarcodeFormat::None);
259
+ std::string res;
260
+ for (auto f : formats)
261
+ res += ToString(f) + "|";
262
+ return res.substr(0, res.size() - 1);
263
+ }
264
+
265
+ BarcodeFormat BarcodeFormatFromString(std::string_view str)
266
+ {
267
+ auto i = FindIf(NAMES, [str](auto& v) { return IsEqualIgnoreCaseAnd(v.name, str, "_-"); });
268
+ return i == std::end(NAMES) ? BarcodeFormat::None : i->format;
269
+ }
270
+
271
+ BarcodeFormats BarcodeFormatsFromString(std::string_view str)
272
+ {
273
+ BarcodeFormats res;
274
+ ForEachToken(TrimWS(str, " []"), " ,|", [&res](std::string_view token) {
275
+ if (!token.empty()) {
276
+ auto bc = BarcodeFormatFromString(token);
277
+ if (bc == BarcodeFormat::None)
278
+ throw std::invalid_argument("This is not a valid barcode format: '" + std::string(token) + "'");
279
+ res |= bc;
280
+ }
281
+ });
282
+ return res;
283
+ }
284
+
285
+ } // ZXing
286
+ #endif // 0
@@ -0,0 +1,272 @@
1
+ /*
2
+ * Copyright 2026 Axel Waggershauser
3
+ */
4
+ // SPDX-License-Identifier: Apache-2.0
5
+
6
+ #pragma once
7
+
8
+ #include "Version.h"
9
+
10
+ #include <stdint.h>
11
+
12
+ // FLAGS[0]: l == linear, m == matrix
13
+ // FLAGS[1]: r == readable
14
+ // FLAGS[2]: w == writable (MultiformatWriter))
15
+ // FLAGS[3]: G == GS1
16
+ // FLAGS[4]: R == Retail, I == Industrial, O == Other
17
+
18
+ // clang-format off
19
+ // NAME, SYM, VAR, FLAGS, ZINT, ENABLED, HRI
20
+ #define ZX_BCF_LIST(X) \
21
+ X(None, 0 , 0, " ", 0, 1, "None") \
22
+ X(All, '*', '*', " ", 0, 1, "All") \
23
+ X(AllReadable, '*', 'r', " ", 0, 1, "All Readable") \
24
+ X(AllCreatable, '*', 'w', " ", 0, 1, "All Creatable") \
25
+ X(AllLinear, '*', 'l', " ", 0, 1, "All Linear") \
26
+ X(AllMatrix, '*', 'm', " ", 0, 1, "All Matrix") \
27
+ X(AllGS1, '*', 'G', " ", 0, 1, "All GS1") \
28
+ X(AllRetail, '*', 'R', " ", 0, 1, "All Retail") \
29
+ X(AllIndustrial, '*', 'I', " ", 0, 1, "All Industrial") \
30
+ X(Codabar, 'F', ' ', "lrw ", 18, ZXING_ENABLE_1D, "Codabar") \
31
+ X(Code39, 'A', ' ', "lrw I", 8, ZXING_ENABLE_1D, "Code 39") \
32
+ X(Code39Std, 'A', 's', "lrw I", 8, ZXING_ENABLE_1D, "Code 39 Standard") \
33
+ X(Code39Ext, 'A', 'e', "lr I", 9, ZXING_ENABLE_1D, "Code 39 Extended") \
34
+ X(Code32, 'A', '2', "lr I", 129, ZXING_ENABLE_1D, "Code 32") \
35
+ X(PZN, 'A', 'p', "lr I", 52, ZXING_ENABLE_1D, "Pharmazentralnummer") \
36
+ X(Code93, 'G', ' ', "lrw I", 25, ZXING_ENABLE_1D, "Code 93") \
37
+ X(Code128, 'C', ' ', "lrwGI", 20, ZXING_ENABLE_1D, "Code 128") \
38
+ X(ITF, 'I', ' ', "lrw I", 3, ZXING_ENABLE_1D, "ITF") \
39
+ X(ITF14, 'I', '4', "lr I", 89, ZXING_ENABLE_1D, "ITF-14") \
40
+ X(DataBar, 'e', ' ', "lr GR", 29, ZXING_ENABLE_1D, "DataBar") \
41
+ X(DataBarOmni, 'e', 'o', "lr GR", 29, ZXING_ENABLE_1D, "DataBar Omni") \
42
+ X(DataBarStk, 'e', 's', "lr GR", 79, ZXING_ENABLE_1D, "DataBar Stacked") \
43
+ X(DataBarStkOmni, 'e', 'O', "lr GR", 80, ZXING_ENABLE_1D, "DataBar Stacked Omni") \
44
+ X(DataBarLtd, 'e', 'l', "lr GR", 30, ZXING_ENABLE_1D, "DataBar Limited") \
45
+ X(DataBarExp, 'e', 'e', "lr GR", 31, ZXING_ENABLE_1D, "DataBar Expanded") \
46
+ X(DataBarExpStk, 'e', 'E', "lr GR", 81, ZXING_ENABLE_1D, "DataBar Expanded Stacked") \
47
+ X(EANUPC, 'E', ' ', "lr R", 15, ZXING_ENABLE_1D, "EAN/UPC") \
48
+ X(EAN13, 'E', '1', "lrw R", 15, ZXING_ENABLE_1D, "EAN-13") \
49
+ X(EAN8, 'E', '8', "lrw R", 10, ZXING_ENABLE_1D, "EAN-8") \
50
+ X(EAN5, 'E', '5', "l R", 12, ZXING_ENABLE_1D, "EAN-5") \
51
+ X(EAN2, 'E', '2', "l R", 11, ZXING_ENABLE_1D, "EAN-2") \
52
+ X(ISBN, 'E', 'i', "lr R", 69, ZXING_ENABLE_1D, "ISBN") \
53
+ X(UPCA, 'E', 'a', "lrw R", 34, ZXING_ENABLE_1D, "UPC-A") \
54
+ X(UPCE, 'E', 'e', "lrw R", 37, ZXING_ENABLE_1D, "UPC-E") \
55
+ X(Telepen, 'B', ' ', "lr I", 32, ZXING_ENABLE_1D, "Telepen") \
56
+ X(TelepenAlpha, 'B', '0', "lr I", 32, ZXING_ENABLE_1D, "Telepen Alpha") \
57
+ X(TelepenNumeric, 'B', '1', "lr I", 87, ZXING_ENABLE_1D, "Telepen Numeric") \
58
+ X(OtherBarcode, 'X', ' ', " r ", 0, ZXING_ENABLE_1D, "Other barcode") /* see ISO/IEC 15424:2025 */ \
59
+ X(DXFilmEdge, 'X', 'x', "lr ", 147, ZXING_ENABLE_1D, "DX Film Edge") \
60
+ X(PDF417, 'L', ' ', "mrw ", 55, ZXING_ENABLE_PDF417, "PDF417") \
61
+ X(CompactPDF417, 'L', 'c', "mr ", 56, ZXING_ENABLE_PDF417, "Compact PDF417") \
62
+ X(MicroPDF417, 'L', 'm', "mr ", 84, ZXING_ENABLE_PDF417, "MicroPDF417") \
63
+ X(Aztec, 'z', ' ', "mrwG ", 92, ZXING_ENABLE_AZTEC, "Aztec") \
64
+ X(AztecCode, 'z', 'c', "mrwG ", 92, ZXING_ENABLE_AZTEC, "Aztec Code") \
65
+ X(AztecRune, 'z', 'r', "mr ", 128, ZXING_ENABLE_AZTEC, "Aztec Rune") \
66
+ X(QRCode, 'Q', ' ', "mrwG ", 58, ZXING_ENABLE_QRCODE, "QR Code") \
67
+ X(QRCodeModel1, 'Q', '1', "mr ", 0, ZXING_ENABLE_QRCODE, "QR Code Model 1") \
68
+ X(QRCodeModel2, 'Q', '2', "mrw ", 58, ZXING_ENABLE_QRCODE, "QR Code Model 2") \
69
+ X(MicroQRCode, 'Q', 'm', "mr ", 97, ZXING_ENABLE_QRCODE, "Micro QR Code") \
70
+ X(RMQRCode, 'Q', 'r', "mr G ", 145, ZXING_ENABLE_QRCODE, "rMQR Code") \
71
+ X(DataMatrix, 'd', ' ', "mrwG ", 71, ZXING_ENABLE_DATAMATRIX, "Data Matrix") \
72
+ X(MaxiCode, 'U', ' ', "mr ", 57, ZXING_ENABLE_MAXICODE, "MaxiCode") \
73
+ /* Add new formats here */
74
+ // clang-format on
75
+
76
+ #define ZX_BCF_ID(SYM, VAR) (((uint8_t)(SYM) << 0) | ((uint8_t)(VAR) << 8))
77
+
78
+ #ifdef __cplusplus
79
+
80
+ #include <array>
81
+ #include <algorithm>
82
+ #include <string>
83
+ #include <string_view>
84
+ #include <utility>
85
+ #include <vector>
86
+
87
+ namespace ZXing {
88
+
89
+ /**
90
+ * @brief Enumerates barcode formats known to this package.
91
+ *
92
+ * Some formats represent a symbology (e.g. EANUPC) with multiple variants (EAN13, EAN8, etc.), while others represent a specific
93
+ * symbology variant (e.g. MicroQRCode). Both can be used with ReaderOptions::formats() to select which formats to read/scan for, but
94
+ * only specific variants are returned by the library when reading barcodes.
95
+ *
96
+ * If the format name starts with "All", it is a pseudo-format representing a set of formats (e.g. AllLinear, AllGS1, etc.). These can
97
+ * be used for filtering and selection purposes, but are not returned by the library when reading barcodes and can not be used when
98
+ * creating barcodes.
99
+ */
100
+ enum class BarcodeFormat : unsigned int
101
+ {
102
+ #define ZX_(NAME, SYM, VAR, FLAGS, ZINT, ENABLED, HRI) NAME = ZX_BCF_ID(SYM, VAR),
103
+ ZX_BCF_LIST(ZX_)
104
+ #undef ZX_
105
+ /// @cond DEPRECATED
106
+ DataBarExpanded [[deprecated("Use DataBarExp instead")]] = DataBarExp,
107
+ DataBarLimited [[deprecated("Use DataBarLtd instead")]] = DataBarLtd,
108
+ LinearCodes [[deprecated("Use AllLinear instead")]] = AllLinear,
109
+ MatrixCodes [[deprecated("Use AllMatrix instead")]] = AllMatrix,
110
+ Any [[deprecated("Use All instead")]] = All,
111
+ /// @endcond
112
+ };
113
+
114
+ /// @cond INTERNAL
115
+ inline char SymbologyKey(const BarcodeFormat& format)
116
+ {
117
+ return uint32_t(format) & 0xFF;
118
+ }
119
+
120
+ inline char VariantKey(const BarcodeFormat& format)
121
+ {
122
+ return (uint32_t(format) >> 8) & 0xFF;
123
+ }
124
+
125
+ inline std::string IdStr(const BarcodeFormat& format)
126
+ {
127
+ return {']', SymbologyKey(format), VariantKey(format)};
128
+ }
129
+ /// @endcond
130
+
131
+ /// Returns the symbology (base type) of the given barcode format (e.g. EAN/UPC for EAN13, EAN8, UPCA, etc.).
132
+ BarcodeFormat Symbology(BarcodeFormat format);
133
+
134
+ /// Returns the human-readable name of the given barcode format.
135
+ std::string_view Name(BarcodeFormat format);
136
+
137
+ /// Test if left hand side (e == element) is 'inside' right hand side (s == set) (e.g. MicroQRCode <= QRCode).
138
+ bool operator<=(BarcodeFormat e, BarcodeFormat s);
139
+
140
+ /// Test if the two BarcodeFormats have a non-empty intersection (e.g. AllMatrix & QRCode).
141
+ bool operator&(BarcodeFormat a, BarcodeFormat b);
142
+
143
+ template <std::size_t N>
144
+ using BarcodeFormatArray = std::array<BarcodeFormat, N>;
145
+
146
+ constexpr BarcodeFormatArray<2> operator|(BarcodeFormat a, BarcodeFormat b)
147
+ {
148
+ return {a, b};
149
+ }
150
+
151
+ template <std::size_t N>
152
+ constexpr BarcodeFormatArray<N + 1> operator|(BarcodeFormatArray<N> bts, BarcodeFormat bt)
153
+ {
154
+ BarcodeFormatArray<N + 1> ret{};
155
+ for (std::size_t i = 0; i < N; ++i)
156
+ ret[i] = bts[i];
157
+ ret[N] = bt;
158
+ return ret;
159
+ }
160
+
161
+ template <std::size_t N>
162
+ constexpr bool operator&(BarcodeFormat lhs, const BarcodeFormatArray<N>& rhs)
163
+ {
164
+ return std::any_of(rhs.begin(), rhs.end(), [lhs](BarcodeFormat bt) { return lhs & bt; });
165
+ }
166
+
167
+ /// @brief Parse a string into a BarcodeFormat. '-', '_', '/' and ' ' are optional.
168
+ /// @throws std::invalid_parameter if the string can not be fully parsed.
169
+ BarcodeFormat BarcodeFormatFromString(std::string_view str);
170
+
171
+ std::string ToString(BarcodeFormat format);
172
+
173
+ /**
174
+ * @brief A small container representing a collection of BarcodeFormat values.
175
+ *
176
+ * BarcodeFormats encapsulates an ordered collection of BarcodeFormat values and
177
+ * provides convenient construction, iteration, and set-like operations.
178
+ *
179
+ * General behavior and invariants:
180
+ * - The internal representation is kept in a canonical form (sorted, no duplicates)
181
+ * using normalize().
182
+ * - The API exposes read-only access and iteration.
183
+ */
184
+ class BarcodeFormats
185
+ {
186
+ std::vector<BarcodeFormat> formats_;
187
+
188
+ void normalize();
189
+
190
+ public:
191
+ BarcodeFormats() = default;
192
+ BarcodeFormats(BarcodeFormat f) : formats_{f} {}
193
+
194
+ /// @brief Constructs a collection from a compile-time array of BarcodeFormat values.
195
+ /// ```c++
196
+ /// BarcodeFormats formats = BarcodeFormat::QRCode | BarcodeFormat::EAN13;
197
+ /// ```
198
+ template <std::size_t N>
199
+ BarcodeFormats(BarcodeFormatArray<N> formats) : formats_{formats.begin(), formats.end()}
200
+ {
201
+ normalize();
202
+ }
203
+
204
+ BarcodeFormats(std::vector<BarcodeFormat>&& formats) : formats_(std::move(formats)) { normalize(); }
205
+
206
+ /// Constructs a collection from a textual representation (e.g. a comma-separated list of format identifiers).
207
+ explicit BarcodeFormats(std::string_view str);
208
+
209
+ BarcodeFormats(const BarcodeFormats&) = default;
210
+ BarcodeFormats(BarcodeFormats&&) = default;
211
+ BarcodeFormats& operator=(const BarcodeFormats&) = default;
212
+ BarcodeFormats& operator=(BarcodeFormats&&) = default;
213
+ bool operator==(const BarcodeFormats& o) const noexcept { return formats_ == o.formats_; }
214
+ bool operator!=(const BarcodeFormats& o) const noexcept { return !(*this == o); }
215
+ // ~BarcodeFormats() = default;
216
+
217
+ auto begin() const noexcept { return formats_.cbegin(); }
218
+ auto end() const noexcept { return formats_.cend(); }
219
+
220
+ using value_type = typename std::vector<BarcodeFormat>::value_type;
221
+ using pointer = typename std::vector<BarcodeFormat>::pointer;
222
+ auto data() const noexcept { return formats_.data(); }
223
+
224
+ bool empty() const noexcept { return formats_.empty(); }
225
+ int size() const noexcept { return static_cast<int>(formats_.size()); }
226
+
227
+ // BarcodeFormats&& operator|(BarcodeFormat bt) &&;
228
+ // BarcodeFormats&& operator|(const BarcodeFormats& other) &&;
229
+
230
+ /// Returns a BarcodeFormats containing the intersection of this collection and other.
231
+ BarcodeFormats operator&(const BarcodeFormats& other);
232
+
233
+ /// Returns a list of available/supported barcode formats, optionally filtered by the provided formats.
234
+ /// e.g. `BarcodeFormats::list(BarcodeFormat::AllReadable);`
235
+ static BarcodeFormats list(const BarcodeFormats& filter = {});
236
+
237
+ /// @cond DEPRECATED
238
+ [[deprecated]] inline int count() const noexcept { return size(); }
239
+ [[deprecated]] inline bool testFlag(BarcodeFormat format) const noexcept
240
+ {
241
+ return std::any_of(begin(), end(), [format](BarcodeFormat f) { return f & format; });
242
+ }
243
+ [[deprecated]] inline bool testFlags(const BarcodeFormats& formats) const noexcept
244
+ {
245
+ return std::any_of(begin(), end(), [formats](BarcodeFormat fo) {
246
+ return std::any_of(formats.begin(), formats.end(), [fo](BarcodeFormat fi) { return fo & fi; });
247
+ });
248
+ }
249
+ /// @endcond
250
+ };
251
+
252
+ inline bool operator<=(BarcodeFormat lhs, const BarcodeFormats& rhs)
253
+ {
254
+ return std::any_of(rhs.begin(), rhs.end(), [lhs](BarcodeFormat bf) { return lhs <= bf; });
255
+ }
256
+
257
+ inline bool operator&(BarcodeFormat lhs, const BarcodeFormats& rhs)
258
+ {
259
+ return std::any_of(rhs.begin(), rhs.end(), [lhs](BarcodeFormat bf) { return lhs & bf; });
260
+ }
261
+
262
+ /// @brief Parses a string into a set of BarcodeFormats.
263
+ /// Separators can be (any combination of) '|' or ','. Input can be lower case and any of '-', '_', '/' or ' ' are optional,
264
+ /// e.g. "EAN-8 | qrcode, Itf" would be parsed into [EAN8, QRCode, ITF].
265
+ /// @throws std::invalid_parameter if the string can not be fully parsed.
266
+ BarcodeFormats BarcodeFormatsFromString(std::string_view str);
267
+
268
+ std::string ToString(const BarcodeFormats& formats);
269
+
270
+ } // namespace ZXing
271
+
272
+ #endif // __cplusplus
@@ -0,0 +1,111 @@
1
+ /*
2
+ * Copyright 2020 Axel Waggershauser
3
+ */
4
+ // SPDX-License-Identifier: Apache-2.0
5
+
6
+ #include "BinaryBitmap.h"
7
+
8
+ #include "BitMatrix.h"
9
+
10
+ namespace ZXing {
11
+
12
+ struct BinaryBitmap::Cache
13
+ {
14
+ std::shared_ptr<const BitMatrix> matrix, transposed;
15
+ };
16
+
17
+ BitMatrix BinaryBitmap::binarize(const uint8_t threshold) const
18
+ {
19
+ BitMatrix res(width(), height());
20
+
21
+ if (_buffer.pixStride() == 1 && _buffer.rowStride() == _buffer.width()) {
22
+ // Specialize for a packed buffer with pixStride 1 to support auto vectorization (16x speedup on AVX2)
23
+ auto dst = res.row(0).begin();
24
+ for (auto src = _buffer.data(0, 0), end = _buffer.data(0, height()); src != end; ++src, ++dst)
25
+ *dst = (*src <= threshold) * BitMatrix::SET_V;
26
+ } else {
27
+ auto processLine = [&res, threshold](int y, const auto* src, const int stride) {
28
+ for (auto& dst : res.row(y)) {
29
+ dst = (*src <= threshold) * BitMatrix::SET_V;
30
+ src += stride;
31
+ }
32
+ };
33
+ for (int y = 0; y < res.height(); ++y) {
34
+ auto src = _buffer.data(0, y) + GreenIndex(_buffer.format());
35
+ // Specialize the inner loop for strides 1 and 4 to support auto vectorization
36
+ switch (_buffer.pixStride()) {
37
+ case 1: processLine(y, src, 1); break;
38
+ case 4: processLine(y, src, 4); break;
39
+ default: processLine(y, src, _buffer.pixStride()); break;
40
+ }
41
+ }
42
+ }
43
+
44
+ return res;
45
+ }
46
+
47
+ BinaryBitmap::BinaryBitmap(const ImageView& buffer) : _cache(new Cache), _buffer(buffer) {}
48
+
49
+ BinaryBitmap::~BinaryBitmap() = default;
50
+
51
+ const BitMatrix* BinaryBitmap::getBitMatrix(bool transposed) const
52
+ {
53
+ if (!_cache->matrix) {
54
+ _cache->matrix = getBlackMatrix();
55
+ }
56
+ if (transposed) {
57
+ if (!_cache->transposed) {
58
+ auto copy = std::make_shared<BitMatrix>(_cache->matrix->copy());
59
+ copy->rotate90();
60
+ _cache->transposed = std::move(copy);
61
+ }
62
+ return _cache->transposed.get();
63
+ }
64
+ return _cache->matrix.get();
65
+ }
66
+
67
+ void BinaryBitmap::invert()
68
+ {
69
+ if (_cache->matrix)
70
+ const_cast<BitMatrix*>(_cache->matrix.get())->flipAll();
71
+
72
+ if (_cache->transposed)
73
+ const_cast<BitMatrix*>(_cache->transposed.get())->flipAll();
74
+
75
+ _inverted = !_inverted;
76
+ }
77
+
78
+ template <typename F>
79
+ void SumFilter(const BitMatrix& in, BitMatrix& out, F func)
80
+ {
81
+ assert(in.height() >= 3);
82
+
83
+ const auto* in0 = in.row(0).begin();
84
+ const auto* in1 = in.row(1).begin();
85
+ const auto* in2 = in.row(2).begin();
86
+
87
+ for (auto *out1 = out.row(1).begin() + 1, *end = out.row(out.height() - 1).begin() - 1; out1 != end; ++in0, ++in1, ++in2, ++out1) {
88
+ int sum = 0;
89
+ for (int j = 0; j < 3; ++j)
90
+ sum += in0[j] + in1[j] + in2[j];
91
+
92
+ *out1 = func(sum);
93
+ }
94
+ }
95
+
96
+ void BinaryBitmap::close()
97
+ {
98
+ if (_cache->matrix) {
99
+ auto& matrix = *const_cast<BitMatrix*>(_cache->matrix.get());
100
+ BitMatrix tmp(matrix.width(), matrix.height());
101
+
102
+ // dilate
103
+ SumFilter(matrix, tmp, [](int sum) { return (sum > 0 * BitMatrix::SET_V) * BitMatrix::SET_V; });
104
+ // erode
105
+ SumFilter(tmp, matrix, [](int sum) { return (sum == 9 * BitMatrix::SET_V) * BitMatrix::SET_V; });
106
+ }
107
+ _cache->transposed.reset();
108
+ _closed = true;
109
+ }
110
+
111
+ } // ZXing