rhodes 2.4.1 → 3.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (395) hide show
  1. data/CHANGELOG +7 -0
  2. data/Rakefile +7 -36
  3. data/doc/build.txt +48 -22
  4. data/doc/device-caps.txt +130 -1
  5. data/doc/rhom.txt +9 -3
  6. data/doc/test-log-debug.txt +5 -2
  7. data/lib/extensions/barcode/ext/barcode/platform/android/Rakefile +40 -20
  8. data/lib/extensions/barcode/ext/barcode/platform/android/ZXing_Info/AUTHORS +58 -0
  9. data/lib/extensions/barcode/ext/barcode/platform/android/ZXing_Info/CHANGES +266 -0
  10. data/lib/extensions/barcode/ext/barcode/platform/android/ZXing_Info/COPYING +201 -0
  11. data/lib/extensions/barcode/ext/barcode/platform/android/ZXing_Info/README +11 -0
  12. data/lib/extensions/barcode/ext/barcode/platform/android/ext_build.files +173 -0
  13. data/lib/extensions/barcode/ext/barcode/platform/android/jni/src/barcode.cpp +34 -0
  14. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/BarcodeFormat.java +103 -0
  15. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/Binarizer.java +80 -0
  16. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/BinaryBitmap.java +128 -0
  17. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/ChecksumException.java +37 -0
  18. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/DecodeHintType.java +79 -0
  19. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/EncodeHintType.java +39 -0
  20. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/FormatException.java +38 -0
  21. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/LuminanceSource.java +113 -0
  22. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/MultiFormatReader.java +166 -0
  23. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/MultiFormatWriter.java +65 -0
  24. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/NotFoundException.java +37 -0
  25. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/Reader.java +64 -0
  26. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/ReaderException.java +98 -0
  27. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/Result.java +143 -0
  28. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/ResultMetadataType.java +109 -0
  29. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/ResultPoint.java +127 -0
  30. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/ResultPointCallback.java +29 -0
  31. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/Writer.java +54 -0
  32. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/WriterException.java +35 -0
  33. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/AbstractDoCoMoResultParser.java +39 -0
  34. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/AddressBookAUResultParser.java +73 -0
  35. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/AddressBookDoCoMoResultParser.java +85 -0
  36. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/AddressBookParsedResult.java +122 -0
  37. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/BizcardResultParser.java +94 -0
  38. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/BookmarkDoCoMoResultParser.java +46 -0
  39. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/CalendarParsedResult.java +134 -0
  40. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/EmailAddressParsedResult.java +61 -0
  41. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/EmailAddressResultParser.java +64 -0
  42. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/EmailDoCoMoResultParser.java +87 -0
  43. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ExpandedProductParsedResult.java +195 -0
  44. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ExpandedProductResultParser.java +199 -0
  45. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/GeoParsedResult.java +132 -0
  46. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/GeoResultParser.java +77 -0
  47. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ISBNParsedResult.java +39 -0
  48. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ISBNResultParser.java +54 -0
  49. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ParsedResult.java +73 -0
  50. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ParsedResultType.java +53 -0
  51. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ProductParsedResult.java +49 -0
  52. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ProductResultParser.java +66 -0
  53. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ResultParser.java +319 -0
  54. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/SMSMMSResultParser.java +107 -0
  55. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/SMSParsedResult.java +104 -0
  56. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/SMSTOMMSTOResultParser.java +57 -0
  57. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/TelParsedResult.java +54 -0
  58. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/TelResultParser.java +44 -0
  59. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/TextParsedResult.java +48 -0
  60. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/URIParsedResult.java +113 -0
  61. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/URIResultParser.java +87 -0
  62. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/URLTOResultParser.java +47 -0
  63. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/VCardResultParser.java +346 -0
  64. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/VEventResultParser.java +54 -0
  65. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/WifiParsedResult.java +53 -0
  66. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/WifiResultParser.java +50 -0
  67. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/optional/AbstractNDEFResultParser.java +45 -0
  68. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/optional/NDEFRecord.java +87 -0
  69. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/optional/NDEFSmartPosterParsedResult.java +63 -0
  70. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/optional/NDEFSmartPosterResultParser.java +81 -0
  71. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/optional/NDEFTextResultParser.java +57 -0
  72. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/optional/NDEFURIResultParser.java +95 -0
  73. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/BitArray.java +247 -0
  74. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/BitMatrix.java +226 -0
  75. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/BitSource.java +97 -0
  76. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/CharacterSetECI.java +110 -0
  77. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/Collections.java +53 -0
  78. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/Comparator.java +27 -0
  79. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/DecoderResult.java +63 -0
  80. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/DefaultGridSampler.java +81 -0
  81. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/DetectorResult.java +46 -0
  82. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/ECI.java +52 -0
  83. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/GlobalHistogramBinarizer.java +196 -0
  84. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/GridSampler.java +171 -0
  85. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/HybridBinarizer.java +185 -0
  86. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/PerspectiveTransform.java +148 -0
  87. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/StringUtils.java +191 -0
  88. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/detector/MonochromeRectangleDetector.java +209 -0
  89. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/detector/WhiteRectangleDetector.java +316 -0
  90. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/reedsolomon/GF256.java +139 -0
  91. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/reedsolomon/GF256Poly.java +263 -0
  92. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/reedsolomon/ReedSolomonDecoder.java +194 -0
  93. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/reedsolomon/ReedSolomonEncoder.java +75 -0
  94. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/reedsolomon/ReedSolomonException.java +31 -0
  95. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/datamatrix/DataMatrixReader.java +161 -0
  96. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/datamatrix/decoder/BitMatrixParser.java +446 -0
  97. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/datamatrix/decoder/DataBlock.java +118 -0
  98. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/datamatrix/decoder/DecodedBitStreamParser.java +462 -0
  99. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/datamatrix/decoder/Decoder.java +134 -0
  100. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/datamatrix/decoder/Version.java +242 -0
  101. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/datamatrix/detector/Detector.java +348 -0
  102. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/multi/ByQuadrantReader.java +96 -0
  103. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/multi/GenericMultipleBarcodeReader.java +156 -0
  104. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/multi/MultipleBarcodeReader.java +37 -0
  105. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/multi/qrcode/QRCodeMultiReader.java +80 -0
  106. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/multi/qrcode/detector/MultiDetector.java +72 -0
  107. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/multi/qrcode/detector/MultiFinderPatternFinder.java +324 -0
  108. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/CodaBarReader.java +263 -0
  109. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/Code128Reader.java +473 -0
  110. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/Code128Writer.java +73 -0
  111. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/Code39Reader.java +333 -0
  112. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/Code39Writer.java +82 -0
  113. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/Code93Reader.java +273 -0
  114. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/EAN13Reader.java +135 -0
  115. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/EAN13Writer.java +81 -0
  116. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/EAN8Reader.java +72 -0
  117. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/EAN8Writer.java +76 -0
  118. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/EANManufacturerOrgSupport.java +170 -0
  119. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/ITFReader.java +348 -0
  120. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/ITFWriter.java +68 -0
  121. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/MultiFormatOneDReader.java +109 -0
  122. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/MultiFormatUPCEANReader.java +113 -0
  123. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/OneDReader.java +297 -0
  124. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/UPCAReader.java +75 -0
  125. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/UPCEANExtensionSupport.java +186 -0
  126. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/UPCEANReader.java +355 -0
  127. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/UPCEANWriter.java +104 -0
  128. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/UPCEReader.java +153 -0
  129. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/AbstractRSSReader.java +110 -0
  130. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/DataCharacter.java +37 -0
  131. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/FinderPattern.java +48 -0
  132. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/Pair.java +41 -0
  133. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/RSS14Reader.java +494 -0
  134. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/RSSUtils.java +155 -0
  135. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/BitArrayBuilder.java +85 -0
  136. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/ExpandedPair.java +68 -0
  137. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/RSSExpandedReader.java +578 -0
  138. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI013103decoder.java +47 -0
  139. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI01320xDecoder.java +55 -0
  140. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI01392xDecoder.java +66 -0
  141. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI01393xDecoder.java +76 -0
  142. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI013x0x1xDecoder.java +106 -0
  143. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI013x0xDecoder.java +56 -0
  144. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI01AndOtherAIs.java +56 -0
  145. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI01decoder.java +81 -0
  146. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI01weightDecoder.java +58 -0
  147. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AbstractExpandedDecoder.java +85 -0
  148. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AnyAIDecoder.java +48 -0
  149. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/BlockParsedResult.java +60 -0
  150. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/CurrentParsingState.java +69 -0
  151. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/DecodedChar.java +52 -0
  152. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/DecodedInformation.java +63 -0
  153. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/DecodedNumeric.java +79 -0
  154. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/DecodedObject.java +44 -0
  155. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/FieldParser.java +285 -0
  156. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/GeneralAppIdDecoder.java +414 -0
  157. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/pdf417/PDF417Reader.java +79 -0
  158. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/pdf417/decoder/BitMatrixParser.java +1163 -0
  159. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java +629 -0
  160. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/pdf417/decoder/Decoder.java +150 -0
  161. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/pdf417/detector/Detector.java +498 -0
  162. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/QRCodeReader.java +166 -0
  163. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/QRCodeWriter.java +108 -0
  164. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/BitMatrixParser.java +203 -0
  165. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/DataBlock.java +123 -0
  166. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/DataMask.java +155 -0
  167. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/DecodedBitStreamParser.java +261 -0
  168. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/Decoder.java +148 -0
  169. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/ErrorCorrectionLevel.java +86 -0
  170. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/FormatInformation.java +171 -0
  171. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/Mode.java +112 -0
  172. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/Version.java +586 -0
  173. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/detector/AlignmentPattern.java +48 -0
  174. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/detector/AlignmentPatternFinder.java +279 -0
  175. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/detector/Detector.java +400 -0
  176. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/detector/FinderPattern.java +63 -0
  177. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/detector/FinderPatternFinder.java +585 -0
  178. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/detector/FinderPatternInfo.java +49 -0
  179. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/encoder/BlockPair.java +37 -0
  180. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/encoder/ByteMatrix.java +97 -0
  181. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/encoder/Encoder.java +557 -0
  182. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/encoder/MaskUtil.java +217 -0
  183. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/encoder/MatrixUtil.java +524 -0
  184. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/encoder/QRCode.java +239 -0
  185. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/rhomobile/barcode/Barcode.java +63 -0
  186. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/rhomobile/barcode/RhoLuminanceSource.java +75 -0
  187. data/lib/extensions/barcode/ext/barcode/platform/iphone/Barcode.xcodeproj/project.pbxproj +74 -318
  188. data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/barcode.m +70 -0
  189. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/COPYING +27 -0
  190. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarCaptureReader.h +105 -0
  191. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarHelpController.h +60 -0
  192. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarImage.h +69 -0
  193. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarImageScanner.h +51 -0
  194. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderController.h +142 -0
  195. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderView.h +118 -0
  196. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderViewController.h +100 -0
  197. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarSDK.h +33 -0
  198. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarSymbol.h +71 -0
  199. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar.h +1476 -0
  200. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Decoder.h +201 -0
  201. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Exception.h +187 -0
  202. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Image.h +321 -0
  203. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/ImageScanner.h +130 -0
  204. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Processor.h +223 -0
  205. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Scanner.h +162 -0
  206. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Symbol.h +529 -0
  207. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Video.h +170 -0
  208. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Window.h +136 -0
  209. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/LICENSE +504 -0
  210. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/README +59 -0
  211. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Resources/zbar-back.png +0 -0
  212. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Resources/zbar-help.html +88 -0
  213. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Resources/zbar-helpicons.png +0 -0
  214. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Resources/zbar-samples.png +0 -0
  215. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/libzbar.a +0 -0
  216. data/lib/extensions/debugger/debugger.rb +215 -67
  217. data/lib/extensions/nfc/ext/nfc/platform/android/AndroidManifest.xml +1 -1
  218. data/lib/extensions/nfc/ext/nfc/platform/android/src/com/nfc/Nfc.java +14 -2
  219. data/lib/extensions/timeout/timeout.rb +114 -0
  220. data/lib/framework/rho/render.rb +14 -16
  221. data/lib/framework/rho/rho.rb +38 -14
  222. data/lib/framework/rho/rhoapplication.rb +1 -1
  223. data/lib/framework/rho/rhocontroller.rb +3 -3
  224. data/lib/framework/rho/rhofsconnector.rb +18 -6
  225. data/lib/framework/rho/rhoviewhelpers.rb +1 -1
  226. data/lib/framework/rhoappmanifest.rb +44 -0
  227. data/lib/framework/rhodes.rb +1 -1
  228. data/lib/framework/rhoframework.rb +31 -11
  229. data/lib/framework/rholang/localization_simplified.rb +10 -6
  230. data/lib/framework/rhom/rhom_object_factory.rb +3 -3
  231. data/lib/framework/version.rb +1 -1
  232. data/lib/rhodes.rb +1 -1
  233. data/platform/android/Rhodes/AndroidManifest.xml +2 -2
  234. data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesApplication.h +32 -8
  235. data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesService.h +21 -21
  236. data/platform/android/Rhodes/jni/src/rhocryptimpl.cpp +1 -0
  237. data/platform/android/Rhodes/jni/src/rhodes.cpp +21 -9
  238. data/platform/android/Rhodes/jni/src/sslimpl.cpp +1 -0
  239. data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +7 -6
  240. data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushReceiver.java +19 -1
  241. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoCryptImpl.java +2 -2
  242. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +24 -15
  243. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +39 -47
  244. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +113 -106
  245. data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +11 -0
  246. data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/StatusNotification.java +49 -0
  247. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +1 -1
  248. data/platform/android/Rhodes/src/com/rhomobile/rhodes/socket/SSLImpl.java +5 -1
  249. data/platform/android/build/RhodesSRC_build.files +1 -0
  250. data/platform/android/build/android.rake +93 -6
  251. data/platform/bb/RubyVM/src/com/rho/RhodesApp.java +5 -4
  252. data/platform/bb/RubyVM/src/com/rho/file/RhoFile.java +10 -0
  253. data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +16 -15
  254. data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +2 -2
  255. data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +21 -19
  256. data/platform/bb/rhodes/src/com/rho/BrowserAdapter5.java +2 -2
  257. data/platform/bb/rhodes/src/com/rho/rubyext/System.java +6 -1
  258. data/platform/bb/rhodes/src/com/rho/rubyext/WebView.java +10 -3
  259. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +21 -1
  260. data/platform/iphone/Classes/SimpleMainView.m +5 -5
  261. data/platform/iphone/Info.plist +1 -1
  262. data/platform/iphone/rbuild/iphone.rake +30 -1
  263. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +12 -0
  264. data/platform/shared/SyncClient/SyncClient.cpp +136 -20
  265. data/platform/shared/SyncClient/SyncClient.h +17 -0
  266. data/platform/shared/common/AppMenu.cpp +6 -1
  267. data/platform/shared/common/RhoConf.cpp +13 -1
  268. data/platform/shared/common/RhoConf.h +3 -1
  269. data/platform/shared/common/RhoDefs.h +10 -0
  270. data/platform/shared/common/RhoFile.cpp +15 -0
  271. data/platform/shared/common/RhoFile.h +1 -0
  272. data/platform/shared/common/RhodesApp.cpp +16 -3
  273. data/platform/shared/common/RhodesApp.h +1 -0
  274. data/platform/shared/common/RhodesAppBase.cpp +102 -62
  275. data/platform/shared/common/RhodesAppBase.h +7 -1
  276. data/platform/shared/curl/lib/rhossl.c +1 -0
  277. data/platform/shared/db/DBAdapter.cpp +14 -2
  278. data/platform/shared/logging/RhoLogConf.cpp +21 -0
  279. data/platform/shared/logging/RhoLogConf.h +11 -0
  280. data/platform/shared/logging/RhoLogSink.cpp +24 -0
  281. data/platform/shared/logging/RhoLogSink.h +20 -1
  282. data/platform/shared/net/HttpServer.cpp +8 -6
  283. data/platform/shared/net/RawSocket.cpp +130 -0
  284. data/platform/shared/net/RawSocket.h +74 -0
  285. data/platform/shared/ruby/ext/rho/rhoruby.c +37 -1
  286. data/platform/shared/ruby/ext/rho/rhosupport.c +74 -21
  287. data/platform/shared/ruby/ext/sqlite3_api/sqlite3_api_wrap.c +9 -1
  288. data/platform/shared/ruby/vm_eval.c +4 -3
  289. data/platform/shared/sync/SyncEngine.cpp +11 -12
  290. data/platform/shared/sync/SyncEngine.h +2 -2
  291. data/platform/shared/sync/SyncNotify.cpp +41 -13
  292. data/platform/shared/sync/SyncNotify.h +20 -3
  293. data/platform/shared/sync/SyncSource.cpp +21 -19
  294. data/platform/shared/sync/SyncThread.cpp +11 -1
  295. data/platform/shared/sync/SyncThread.h +3 -0
  296. data/platform/shared/test/test_helper.cpp +7 -0
  297. data/platform/win32/RhoSimulator/QtCore4.dll +0 -0
  298. data/platform/win32/RhoSimulator/QtGui4.dll +0 -0
  299. data/platform/win32/RhoSimulator/QtNetwork4.dll +0 -0
  300. data/platform/win32/RhoSimulator/QtWebKit4.dll +0 -0
  301. data/platform/win32/RhoSimulator/imageformats/qgif4.dll +0 -0
  302. data/platform/win32/RhoSimulator/imageformats/qjpeg4.dll +0 -0
  303. data/platform/win32/RhoSimulator/rhosimulator.exe +0 -0
  304. data/platform/wm/RhoLib/RhoLib.vcproj +762 -14
  305. data/platform/wm/build/wm.rake +87 -10
  306. data/platform/wm/rhodes.sln +155 -72
  307. data/platform/wm/rhodes/MainWindow.cpp +5 -2
  308. data/platform/wm/rhodes/MainWindow.h +9 -1
  309. data/platform/wm/rhodes/RhoNativeViewManager.cpp +4 -0
  310. data/platform/wm/rhodes/Rhodes.cpp +60 -6
  311. data/platform/wm/rhodes/emulator/ExternalWebView.cpp +20 -0
  312. data/platform/wm/rhodes/emulator/ExternalWebView.h +23 -0
  313. data/platform/wm/rhodes/emulator/ExternalWebView.ui +46 -0
  314. data/platform/wm/rhodes/emulator/MainWindowCallback.h +18 -0
  315. data/platform/wm/rhodes/emulator/MainWindowProxy.cpp +268 -0
  316. data/platform/wm/rhodes/emulator/MainWindowProxy.h +34 -0
  317. data/platform/wm/rhodes/emulator/MainWindowQt.cpp +345 -0
  318. data/platform/wm/rhodes/emulator/MainWindowQt.h +118 -0
  319. data/platform/wm/rhodes/emulator/NativeToolbarQt.cpp +57 -0
  320. data/platform/wm/rhodes/emulator/NativeToolbarQt.h +52 -0
  321. data/platform/wm/rhodes/emulator/QtMainWindow.cpp +219 -0
  322. data/platform/wm/rhodes/emulator/QtMainWindow.h +62 -0
  323. data/platform/wm/rhodes/emulator/QtMainWindow.ui +122 -0
  324. data/platform/wm/rhodes/{RhoCryptImpl.cpp → rho/common/RhoCryptImpl.cpp} +0 -0
  325. data/platform/wm/rhodes/{RhoCryptImpl.h → rho/common/RhoCryptImpl.h} +0 -0
  326. data/platform/wm/rhodes/rho/rubyext/NativeToolbar.cpp +2 -86
  327. data/platform/wm/rhodes/rho/rubyext/NativeToolbarExt.cpp +87 -0
  328. data/platform/wm/rhodes/rho/rubyext/NativeToolbarExt.h +6 -0
  329. data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +60 -0
  330. data/platform/wm/rhodes/rhodes.vcproj +4025 -365
  331. data/platform/wm/rhodes/signature/Signature.cpp +29 -13
  332. data/platform/wm/rubylib/rubylib.vcproj +1167 -195
  333. data/platform/wm/shttpd/shttpd.vcproj +4 -4
  334. data/platform/wm/sqlite3/sqlite3.vcproj +441 -13
  335. data/platform/wm/syncengine/syncengine.vcproj +443 -15
  336. data/platform/wm/tcmalloc/tcmalloc.vcproj +0 -154
  337. data/platform/wm/tools/detool/LogServer.cpp +150 -0
  338. data/platform/wm/tools/detool/LogServer.h +23 -0
  339. data/platform/wm/tools/detool/detool.cpp +42 -4
  340. data/platform/wm/tools/detool/detool.vcproj +10 -1
  341. data/platform/wp7/IronRuby/Bin/Silverlight3Release/IronRuby.Libraries.dll +0 -0
  342. data/platform/wp7/IronRuby/Bin/Silverlight3Release/IronRuby.dll +0 -0
  343. data/platform/wp7/IronRuby/Bin/Silverlight3Release/Microsoft.Dynamic.dll +0 -0
  344. data/platform/wp7/IronRuby/Bin/Silverlight3Release/Microsoft.Scripting.Core.dll +0 -0
  345. data/platform/wp7/IronRuby/Bin/Silverlight3Release/Microsoft.Scripting.dll +0 -0
  346. data/platform/wp7/RhoAppRunner/Program.cs +20 -3
  347. data/platform/wp7/RhoLogServer/Program.cs +22 -0
  348. data/platform/wp7/RhoLogServer/Properties/AssemblyInfo.cs +36 -0
  349. data/platform/wp7/RhoLogServer/RhoLogServer.csproj +65 -0
  350. data/platform/wp7/RhoLogServer/SocketServer.cs +210 -0
  351. data/platform/wp7/RhoRubyExtGen/RhoAsyncHttp.cs +6 -0
  352. data/platform/wp7/RhoRubyLib/Initializers.Generated.cs +3 -2
  353. data/platform/wp7/RhoRubyLib/RhoRuby.cs +82 -0
  354. data/platform/wp7/RhoRubyLib/RhoRubyLib.csproj +7 -5
  355. data/platform/wp7/RhoRubyLib/WP_PlatformAdaptationLayer.cs +1 -1
  356. data/platform/wp7/RhoRubyLib/common/RhoParams.cs +1 -1
  357. data/platform/wp7/RhoRubyLib/common/ThreadQueue.cs +4 -1
  358. data/platform/wp7/RhoRubyLib/db/DBAdapter.cs +2 -2
  359. data/platform/wp7/RhoRubyLib/logging/IRhoLogSink.cs +1 -1
  360. data/platform/wp7/RhoRubyLib/logging/RhoEmptyLogger.cs +30 -0
  361. data/platform/wp7/RhoRubyLib/logging/RhoLogConf.cs +10 -0
  362. data/platform/wp7/RhoRubyLib/logging/RhoLogFileSink.cs +6 -1
  363. data/platform/wp7/RhoRubyLib/logging/RhoLogServerSink.cs +56 -0
  364. data/platform/wp7/RhoRubyLib/logging/RhoLogger.cs +24 -11
  365. data/platform/wp7/RhoRubyLib/net/AsyncHttp.cs +57 -14
  366. data/platform/wp7/RhoRubyLib/net/NetRequest.cs +32 -9
  367. data/platform/wp7/RhoRubyLib/rubyext/RhoAsyncHttp.cs +7 -0
  368. data/platform/wp7/RhoRubyLib/rubyext/RhoKernelOps.cs +6 -0
  369. data/platform/wp7/RhoRubyLib/sync/SyncEngine.cs +20 -16
  370. data/platform/wp7/RhoRubyLib/sync/SyncNotify.cs +2 -2
  371. data/platform/wp7/RhoRubyLib/sync/SyncSource.cs +138 -40
  372. data/platform/wp7/WPApplication/rho/apps/app/layout.erb +3 -1
  373. data/platform/wp7/build/wp.rake +151 -12
  374. data/platform/wp7/rhodes.sln +10 -0
  375. data/platform/wp7/rhodes/App.xaml.cs +6 -0
  376. data/platform/wp7/rhodes/MainPage.xaml +3 -0
  377. data/platform/wp7/rhodes/MainPage.xaml.cs +19 -0
  378. data/platform/wp7/rhodes/Rhodes.csproj +4 -2
  379. data/rakefile.rb +7 -36
  380. data/res/build-tools/RhoAppRunner.exe +0 -0
  381. data/res/build-tools/RhoLogServer.exe +0 -0
  382. data/res/build-tools/detool.exe +0 -0
  383. data/res/build-tools/wp7explorer.exe +0 -0
  384. data/res/generators/templates/application/app/layout.erb +3 -1
  385. data/res/generators/templates/application/public/jqtouch/jqtouch.js +1 -1
  386. data/rhodes.gemspec +1 -1
  387. data/spec/framework_spec/app/layout.erb +1 -1
  388. data/spec/framework_spec/build.yml +1 -0
  389. data/spec/perfomance_spec/app/layout.erb +3 -0
  390. data/spec/phone_spec/app/Account_s/account_s.rb +4 -1
  391. data/spec/phone_spec/app/spec/rhom_object_spec.rb +30 -1
  392. data/spec/phone_spec/app/spec_runner.rb +1 -1
  393. data/spec/phone_spec/build.yml +4 -1
  394. metadata +262 -10
  395. data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Builtins/ConsoleStream.cs +0 -107
@@ -0,0 +1,96 @@
1
+ /*
2
+ * Copyright 2009 ZXing authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package com.google.zxing.multi;
18
+
19
+ import com.google.zxing.BinaryBitmap;
20
+ import com.google.zxing.ChecksumException;
21
+ import com.google.zxing.FormatException;
22
+ import com.google.zxing.NotFoundException;
23
+ import com.google.zxing.Reader;
24
+ import com.google.zxing.Result;
25
+
26
+ import java.util.Hashtable;
27
+
28
+ /**
29
+ * This class attempts to decode a barcode from an image, not by scanning the whole image,
30
+ * but by scanning subsets of the image. This is important when there may be multiple barcodes in
31
+ * an image, and detecting a barcode may find parts of multiple barcode and fail to decode
32
+ * (e.g. QR Codes). Instead this scans the four quadrants of the image -- and also the center
33
+ * 'quadrant' to cover the case where a barcode is found in the center.
34
+ *
35
+ * @see GenericMultipleBarcodeReader
36
+ */
37
+ public final class ByQuadrantReader implements Reader {
38
+
39
+ private final Reader delegate;
40
+
41
+ public ByQuadrantReader(Reader delegate) {
42
+ this.delegate = delegate;
43
+ }
44
+
45
+ public Result decode(BinaryBitmap image)
46
+ throws NotFoundException, ChecksumException, FormatException {
47
+ return decode(image, null);
48
+ }
49
+
50
+ public Result decode(BinaryBitmap image, Hashtable hints)
51
+ throws NotFoundException, ChecksumException, FormatException {
52
+
53
+ int width = image.getWidth();
54
+ int height = image.getHeight();
55
+ int halfWidth = width / 2;
56
+ int halfHeight = height / 2;
57
+
58
+ BinaryBitmap topLeft = image.crop(0, 0, halfWidth, halfHeight);
59
+ try {
60
+ return delegate.decode(topLeft, hints);
61
+ } catch (NotFoundException re) {
62
+ // continue
63
+ }
64
+
65
+ BinaryBitmap topRight = image.crop(halfWidth, 0, halfWidth, halfHeight);
66
+ try {
67
+ return delegate.decode(topRight, hints);
68
+ } catch (NotFoundException re) {
69
+ // continue
70
+ }
71
+
72
+ BinaryBitmap bottomLeft = image.crop(0, halfHeight, halfWidth, halfHeight);
73
+ try {
74
+ return delegate.decode(bottomLeft, hints);
75
+ } catch (NotFoundException re) {
76
+ // continue
77
+ }
78
+
79
+ BinaryBitmap bottomRight = image.crop(halfWidth, halfHeight, halfWidth, halfHeight);
80
+ try {
81
+ return delegate.decode(bottomRight, hints);
82
+ } catch (NotFoundException re) {
83
+ // continue
84
+ }
85
+
86
+ int quarterWidth = halfWidth / 2;
87
+ int quarterHeight = halfHeight / 2;
88
+ BinaryBitmap center = image.crop(quarterWidth, quarterHeight, halfWidth, halfHeight);
89
+ return delegate.decode(center, hints);
90
+ }
91
+
92
+ public void reset() {
93
+ delegate.reset();
94
+ }
95
+
96
+ }
@@ -0,0 +1,156 @@
1
+ /*
2
+ * Copyright 2009 ZXing authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package com.google.zxing.multi;
18
+
19
+ import com.google.zxing.BinaryBitmap;
20
+ import com.google.zxing.NotFoundException;
21
+ import com.google.zxing.Reader;
22
+ import com.google.zxing.ReaderException;
23
+ import com.google.zxing.Result;
24
+ import com.google.zxing.ResultPoint;
25
+
26
+ import java.util.Hashtable;
27
+ import java.util.Vector;
28
+
29
+ /**
30
+ * <p>Attempts to locate multiple barcodes in an image by repeatedly decoding portion of the image.
31
+ * After one barcode is found, the areas left, above, right and below the barcode's
32
+ * {@link com.google.zxing.ResultPoint}s are scanned, recursively.</p>
33
+ *
34
+ * <p>A caller may want to also employ {@link ByQuadrantReader} when attempting to find multiple
35
+ * 2D barcodes, like QR Codes, in an image, where the presence of multiple barcodes might prevent
36
+ * detecting any one of them.</p>
37
+ *
38
+ * <p>That is, instead of passing a {@link Reader} a caller might pass
39
+ * <code>new ByQuadrantReader(reader)</code>.</p>
40
+ *
41
+ * @author Sean Owen
42
+ */
43
+ public final class GenericMultipleBarcodeReader implements MultipleBarcodeReader {
44
+
45
+ private static final int MIN_DIMENSION_TO_RECUR = 100;
46
+
47
+ private final Reader delegate;
48
+
49
+ public GenericMultipleBarcodeReader(Reader delegate) {
50
+ this.delegate = delegate;
51
+ }
52
+
53
+ public Result[] decodeMultiple(BinaryBitmap image) throws NotFoundException {
54
+ return decodeMultiple(image, null);
55
+ }
56
+
57
+ public Result[] decodeMultiple(BinaryBitmap image, Hashtable hints)
58
+ throws NotFoundException {
59
+ Vector results = new Vector();
60
+ doDecodeMultiple(image, hints, results, 0, 0);
61
+ if (results.isEmpty()) {
62
+ throw NotFoundException.getNotFoundInstance();
63
+ }
64
+ int numResults = results.size();
65
+ Result[] resultArray = new Result[numResults];
66
+ for (int i = 0; i < numResults; i++) {
67
+ resultArray[i] = (Result) results.elementAt(i);
68
+ }
69
+ return resultArray;
70
+ }
71
+
72
+ private void doDecodeMultiple(BinaryBitmap image,
73
+ Hashtable hints,
74
+ Vector results,
75
+ int xOffset,
76
+ int yOffset) {
77
+ Result result;
78
+ try {
79
+ result = delegate.decode(image, hints);
80
+ } catch (ReaderException re) {
81
+ return;
82
+ }
83
+ boolean alreadyFound = false;
84
+ for (int i = 0; i < results.size(); i++) {
85
+ Result existingResult = (Result) results.elementAt(i);
86
+ if (existingResult.getText().equals(result.getText())) {
87
+ alreadyFound = true;
88
+ break;
89
+ }
90
+ }
91
+ if (alreadyFound) {
92
+ return;
93
+ }
94
+ results.addElement(translateResultPoints(result, xOffset, yOffset));
95
+ ResultPoint[] resultPoints = result.getResultPoints();
96
+ if (resultPoints == null || resultPoints.length == 0) {
97
+ return;
98
+ }
99
+ int width = image.getWidth();
100
+ int height = image.getHeight();
101
+ float minX = width;
102
+ float minY = height;
103
+ float maxX = 0.0f;
104
+ float maxY = 0.0f;
105
+ for (int i = 0; i < resultPoints.length; i++) {
106
+ ResultPoint point = resultPoints[i];
107
+ float x = point.getX();
108
+ float y = point.getY();
109
+ if (x < minX) {
110
+ minX = x;
111
+ }
112
+ if (y < minY) {
113
+ minY = y;
114
+ }
115
+ if (x > maxX) {
116
+ maxX = x;
117
+ }
118
+ if (y > maxY) {
119
+ maxY = y;
120
+ }
121
+ }
122
+
123
+ // Decode left of barcode
124
+ if (minX > MIN_DIMENSION_TO_RECUR) {
125
+ doDecodeMultiple(image.crop(0, 0, (int) minX, height),
126
+ hints, results, xOffset, yOffset);
127
+ }
128
+ // Decode above barcode
129
+ if (minY > MIN_DIMENSION_TO_RECUR) {
130
+ doDecodeMultiple(image.crop(0, 0, width, (int) minY),
131
+ hints, results, xOffset, yOffset);
132
+ }
133
+ // Decode right of barcode
134
+ if (maxX < width - MIN_DIMENSION_TO_RECUR) {
135
+ doDecodeMultiple(image.crop((int) maxX, 0, width - (int) maxX, height),
136
+ hints, results, xOffset + (int) maxX, yOffset);
137
+ }
138
+ // Decode below barcode
139
+ if (maxY < height - MIN_DIMENSION_TO_RECUR) {
140
+ doDecodeMultiple(image.crop(0, (int) maxY, width, height - (int) maxY),
141
+ hints, results, xOffset, yOffset + (int) maxY);
142
+ }
143
+ }
144
+
145
+ private static Result translateResultPoints(Result result, int xOffset, int yOffset) {
146
+ ResultPoint[] oldResultPoints = result.getResultPoints();
147
+ ResultPoint[] newResultPoints = new ResultPoint[oldResultPoints.length];
148
+ for (int i = 0; i < oldResultPoints.length; i++) {
149
+ ResultPoint oldPoint = oldResultPoints[i];
150
+ newResultPoints[i] = new ResultPoint(oldPoint.getX() + xOffset, oldPoint.getY() + yOffset);
151
+ }
152
+ return new Result(result.getText(), result.getRawBytes(), newResultPoints,
153
+ result.getBarcodeFormat());
154
+ }
155
+
156
+ }
@@ -0,0 +1,37 @@
1
+ /*
2
+ * Copyright 2009 ZXing authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package com.google.zxing.multi;
18
+
19
+ import com.google.zxing.BinaryBitmap;
20
+ import com.google.zxing.NotFoundException;
21
+ import com.google.zxing.Result;
22
+
23
+ import java.util.Hashtable;
24
+
25
+ /**
26
+ * Implementation of this interface attempt to read several barcodes from one image.
27
+ *
28
+ * @see com.google.zxing.Reader
29
+ * @author Sean Owen
30
+ */
31
+ public interface MultipleBarcodeReader {
32
+
33
+ Result[] decodeMultiple(BinaryBitmap image) throws NotFoundException;
34
+
35
+ Result[] decodeMultiple(BinaryBitmap image, Hashtable hints) throws NotFoundException;
36
+
37
+ }
@@ -0,0 +1,80 @@
1
+ /*
2
+ * Copyright 2009 ZXing authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package com.google.zxing.multi.qrcode;
18
+
19
+ import com.google.zxing.BarcodeFormat;
20
+ import com.google.zxing.BinaryBitmap;
21
+ import com.google.zxing.NotFoundException;
22
+ import com.google.zxing.ReaderException;
23
+ import com.google.zxing.Result;
24
+ import com.google.zxing.ResultMetadataType;
25
+ import com.google.zxing.ResultPoint;
26
+ import com.google.zxing.common.DecoderResult;
27
+ import com.google.zxing.common.DetectorResult;
28
+ import com.google.zxing.multi.MultipleBarcodeReader;
29
+ import com.google.zxing.multi.qrcode.detector.MultiDetector;
30
+ import com.google.zxing.qrcode.QRCodeReader;
31
+
32
+ import java.util.Hashtable;
33
+ import java.util.Vector;
34
+
35
+ /**
36
+ * This implementation can detect and decode multiple QR Codes in an image.
37
+ *
38
+ * @author Sean Owen
39
+ * @author Hannes Erven
40
+ */
41
+ public final class QRCodeMultiReader extends QRCodeReader implements MultipleBarcodeReader {
42
+
43
+ private static final Result[] EMPTY_RESULT_ARRAY = new Result[0];
44
+
45
+ public Result[] decodeMultiple(BinaryBitmap image) throws NotFoundException {
46
+ return decodeMultiple(image, null);
47
+ }
48
+
49
+ public Result[] decodeMultiple(BinaryBitmap image, Hashtable hints) throws NotFoundException {
50
+ Vector results = new Vector();
51
+ DetectorResult[] detectorResult = new MultiDetector(image.getBlackMatrix()).detectMulti(hints);
52
+ for (int i = 0; i < detectorResult.length; i++) {
53
+ try {
54
+ DecoderResult decoderResult = getDecoder().decode(detectorResult[i].getBits());
55
+ ResultPoint[] points = detectorResult[i].getPoints();
56
+ Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points,
57
+ BarcodeFormat.QR_CODE);
58
+ if (decoderResult.getByteSegments() != null) {
59
+ result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, decoderResult.getByteSegments());
60
+ }
61
+ if (decoderResult.getECLevel() != null) {
62
+ result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, decoderResult.getECLevel().toString());
63
+ }
64
+ results.addElement(result);
65
+ } catch (ReaderException re) {
66
+ // ignore and continue
67
+ }
68
+ }
69
+ if (results.isEmpty()) {
70
+ return EMPTY_RESULT_ARRAY;
71
+ } else {
72
+ Result[] resultArray = new Result[results.size()];
73
+ for (int i = 0; i < results.size(); i++) {
74
+ resultArray[i] = (Result) results.elementAt(i);
75
+ }
76
+ return resultArray;
77
+ }
78
+ }
79
+
80
+ }
@@ -0,0 +1,72 @@
1
+ /*
2
+ * Copyright 2009 ZXing authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package com.google.zxing.multi.qrcode.detector;
18
+
19
+ import com.google.zxing.NotFoundException;
20
+ import com.google.zxing.ReaderException;
21
+ import com.google.zxing.common.BitMatrix;
22
+ import com.google.zxing.common.DetectorResult;
23
+ import com.google.zxing.qrcode.detector.Detector;
24
+ import com.google.zxing.qrcode.detector.FinderPatternInfo;
25
+
26
+ import java.util.Hashtable;
27
+ import java.util.Vector;
28
+
29
+ /**
30
+ * <p>Encapsulates logic that can detect one or more QR Codes in an image, even if the QR Code
31
+ * is rotated or skewed, or partially obscured.</p>
32
+ *
33
+ * @author Sean Owen
34
+ * @author Hannes Erven
35
+ */
36
+ public final class MultiDetector extends Detector {
37
+
38
+ private static final DetectorResult[] EMPTY_DETECTOR_RESULTS = new DetectorResult[0];
39
+
40
+ public MultiDetector(BitMatrix image) {
41
+ super(image);
42
+ }
43
+
44
+ public DetectorResult[] detectMulti(Hashtable hints) throws NotFoundException {
45
+ BitMatrix image = getImage();
46
+ MultiFinderPatternFinder finder = new MultiFinderPatternFinder(image);
47
+ FinderPatternInfo[] info = finder.findMulti(hints);
48
+
49
+ if (info == null || info.length == 0) {
50
+ throw NotFoundException.getNotFoundInstance();
51
+ }
52
+
53
+ Vector result = new Vector();
54
+ for (int i = 0; i < info.length; i++) {
55
+ try {
56
+ result.addElement(processFinderPatternInfo(info[i]));
57
+ } catch (ReaderException e) {
58
+ // ignore
59
+ }
60
+ }
61
+ if (result.isEmpty()) {
62
+ return EMPTY_DETECTOR_RESULTS;
63
+ } else {
64
+ DetectorResult[] resultArray = new DetectorResult[result.size()];
65
+ for (int i = 0; i < result.size(); i++) {
66
+ resultArray[i] = (DetectorResult) result.elementAt(i);
67
+ }
68
+ return resultArray;
69
+ }
70
+ }
71
+
72
+ }
@@ -0,0 +1,324 @@
1
+ /*
2
+ * Copyright 2009 ZXing authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package com.google.zxing.multi.qrcode.detector;
18
+
19
+ import com.google.zxing.DecodeHintType;
20
+ import com.google.zxing.NotFoundException;
21
+ import com.google.zxing.ResultPoint;
22
+ import com.google.zxing.ResultPointCallback;
23
+ import com.google.zxing.common.BitMatrix;
24
+ import com.google.zxing.common.Collections;
25
+ import com.google.zxing.common.Comparator;
26
+ import com.google.zxing.qrcode.detector.FinderPattern;
27
+ import com.google.zxing.qrcode.detector.FinderPatternFinder;
28
+ import com.google.zxing.qrcode.detector.FinderPatternInfo;
29
+
30
+ import java.util.Hashtable;
31
+ import java.util.Vector;
32
+
33
+ /**
34
+ * <p>This class attempts to find finder patterns in a QR Code. Finder patterns are the square
35
+ * markers at three corners of a QR Code.</p>
36
+ *
37
+ * <p>This class is thread-safe but not reentrant. Each thread must allocate its own object.
38
+ *
39
+ * <p>In contrast to {@link FinderPatternFinder}, this class will return an array of all possible
40
+ * QR code locations in the image.</p>
41
+ *
42
+ * <p>Use the TRY_HARDER hint to ask for a more thorough detection.</p>
43
+ *
44
+ * @author Sean Owen
45
+ * @author Hannes Erven
46
+ */
47
+ final class MultiFinderPatternFinder extends FinderPatternFinder {
48
+
49
+ private static final FinderPatternInfo[] EMPTY_RESULT_ARRAY = new FinderPatternInfo[0];
50
+
51
+ // TODO MIN_MODULE_COUNT and MAX_MODULE_COUNT would be great hints to ask the user for
52
+ // since it limits the number of regions to decode
53
+
54
+ // max. legal count of modules per QR code edge (177)
55
+ private static final float MAX_MODULE_COUNT_PER_EDGE = 180;
56
+ // min. legal count per modules per QR code edge (11)
57
+ private static final float MIN_MODULE_COUNT_PER_EDGE = 9;
58
+
59
+ /**
60
+ * More or less arbitrary cutoff point for determining if two finder patterns might belong
61
+ * to the same code if they differ less than DIFF_MODSIZE_CUTOFF_PERCENT percent in their
62
+ * estimated modules sizes.
63
+ */
64
+ private static final float DIFF_MODSIZE_CUTOFF_PERCENT = 0.05f;
65
+
66
+ /**
67
+ * More or less arbitrary cutoff point for determining if two finder patterns might belong
68
+ * to the same code if they differ less than DIFF_MODSIZE_CUTOFF pixels/module in their
69
+ * estimated modules sizes.
70
+ */
71
+ private static final float DIFF_MODSIZE_CUTOFF = 0.5f;
72
+
73
+
74
+ /**
75
+ * A comparator that orders FinderPatterns by their estimated module size.
76
+ */
77
+ private static class ModuleSizeComparator implements Comparator {
78
+ public int compare(Object center1, Object center2) {
79
+ float value = ((FinderPattern) center2).getEstimatedModuleSize() -
80
+ ((FinderPattern) center1).getEstimatedModuleSize();
81
+ return value < 0.0 ? -1 : value > 0.0 ? 1 : 0;
82
+ }
83
+ }
84
+
85
+ /**
86
+ * <p>Creates a finder that will search the image for three finder patterns.</p>
87
+ *
88
+ * @param image image to search
89
+ */
90
+ MultiFinderPatternFinder(BitMatrix image) {
91
+ super(image);
92
+ }
93
+
94
+ MultiFinderPatternFinder(BitMatrix image, ResultPointCallback resultPointCallback) {
95
+ super(image, resultPointCallback);
96
+ }
97
+
98
+ /**
99
+ * @return the 3 best {@link FinderPattern}s from our list of candidates. The "best" are
100
+ * those that have been detected at least {@link #CENTER_QUORUM} times, and whose module
101
+ * size differs from the average among those patterns the least
102
+ * @throws NotFoundException if 3 such finder patterns do not exist
103
+ */
104
+ private FinderPattern[][] selectBestPatterns() throws NotFoundException {
105
+ Vector possibleCenters = getPossibleCenters();
106
+ int size = possibleCenters.size();
107
+
108
+ if (size < 3) {
109
+ // Couldn't find enough finder patterns
110
+ throw NotFoundException.getNotFoundInstance();
111
+ }
112
+
113
+ /*
114
+ * Begin HE modifications to safely detect multiple codes of equal size
115
+ */
116
+ if (size == 3) {
117
+ return new FinderPattern[][]{
118
+ new FinderPattern[]{
119
+ (FinderPattern) possibleCenters.elementAt(0),
120
+ (FinderPattern) possibleCenters.elementAt(1),
121
+ (FinderPattern) possibleCenters.elementAt(2)
122
+ }
123
+ };
124
+ }
125
+
126
+ // Sort by estimated module size to speed up the upcoming checks
127
+ Collections.insertionSort(possibleCenters, new ModuleSizeComparator());
128
+
129
+ /*
130
+ * Now lets start: build a list of tuples of three finder locations that
131
+ * - feature similar module sizes
132
+ * - are placed in a distance so the estimated module count is within the QR specification
133
+ * - have similar distance between upper left/right and left top/bottom finder patterns
134
+ * - form a triangle with 90° angle (checked by comparing top right/bottom left distance
135
+ * with pythagoras)
136
+ *
137
+ * Note: we allow each point to be used for more than one code region: this might seem
138
+ * counterintuitive at first, but the performance penalty is not that big. At this point,
139
+ * we cannot make a good quality decision whether the three finders actually represent
140
+ * a QR code, or are just by chance layouted so it looks like there might be a QR code there.
141
+ * So, if the layout seems right, lets have the decoder try to decode.
142
+ */
143
+
144
+ Vector results = new Vector(); // holder for the results
145
+
146
+ for (int i1 = 0; i1 < (size - 2); i1++) {
147
+ FinderPattern p1 = (FinderPattern) possibleCenters.elementAt(i1);
148
+ if (p1 == null) {
149
+ continue;
150
+ }
151
+
152
+ for (int i2 = i1 + 1; i2 < (size - 1); i2++) {
153
+ FinderPattern p2 = (FinderPattern) possibleCenters.elementAt(i2);
154
+ if (p2 == null) {
155
+ continue;
156
+ }
157
+
158
+ // Compare the expected module sizes; if they are really off, skip
159
+ float vModSize12 = (p1.getEstimatedModuleSize() - p2.getEstimatedModuleSize()) /
160
+ (Math.min(p1.getEstimatedModuleSize(), p2.getEstimatedModuleSize()));
161
+ float vModSize12A = Math.abs(p1.getEstimatedModuleSize() - p2.getEstimatedModuleSize());
162
+ if (vModSize12A > DIFF_MODSIZE_CUTOFF && vModSize12 >= DIFF_MODSIZE_CUTOFF_PERCENT) {
163
+ // break, since elements are ordered by the module size deviation there cannot be
164
+ // any more interesting elements for the given p1.
165
+ break;
166
+ }
167
+
168
+ for (int i3 = i2 + 1; i3 < size; i3++) {
169
+ FinderPattern p3 = (FinderPattern) possibleCenters.elementAt(i3);
170
+ if (p3 == null) {
171
+ continue;
172
+ }
173
+
174
+ // Compare the expected module sizes; if they are really off, skip
175
+ float vModSize23 = (p2.getEstimatedModuleSize() - p3.getEstimatedModuleSize()) /
176
+ (Math.min(p2.getEstimatedModuleSize(), p3.getEstimatedModuleSize()));
177
+ float vModSize23A = Math.abs(p2.getEstimatedModuleSize() - p3.getEstimatedModuleSize());
178
+ if (vModSize23A > DIFF_MODSIZE_CUTOFF && vModSize23 >= DIFF_MODSIZE_CUTOFF_PERCENT) {
179
+ // break, since elements are ordered by the module size deviation there cannot be
180
+ // any more interesting elements for the given p1.
181
+ break;
182
+ }
183
+
184
+ FinderPattern[] test = {p1, p2, p3};
185
+ ResultPoint.orderBestPatterns(test);
186
+
187
+ // Calculate the distances: a = topleft-bottomleft, b=topleft-topright, c = diagonal
188
+ FinderPatternInfo info = new FinderPatternInfo(test);
189
+ float dA = ResultPoint.distance(info.getTopLeft(), info.getBottomLeft());
190
+ float dC = ResultPoint.distance(info.getTopRight(), info.getBottomLeft());
191
+ float dB = ResultPoint.distance(info.getTopLeft(), info.getTopRight());
192
+
193
+ // Check the sizes
194
+ float estimatedModuleCount = ((dA + dB) / p1.getEstimatedModuleSize()) / 2;
195
+ if (estimatedModuleCount > MAX_MODULE_COUNT_PER_EDGE ||
196
+ estimatedModuleCount < MIN_MODULE_COUNT_PER_EDGE) {
197
+ continue;
198
+ }
199
+
200
+ // Calculate the difference of the edge lengths in percent
201
+ float vABBC = Math.abs(((dA - dB) / Math.min(dA, dB)));
202
+ if (vABBC >= 0.1f) {
203
+ continue;
204
+ }
205
+
206
+ // Calculate the diagonal length by assuming a 90° angle at topleft
207
+ float dCpy = (float) Math.sqrt(dA * dA + dB * dB);
208
+ // Compare to the real distance in %
209
+ float vPyC = Math.abs(((dC - dCpy) / Math.min(dC, dCpy)));
210
+
211
+ if (vPyC >= 0.1f) {
212
+ continue;
213
+ }
214
+
215
+ // All tests passed!
216
+ results.addElement(test);
217
+ } // end iterate p3
218
+ } // end iterate p2
219
+ } // end iterate p1
220
+
221
+ if (!results.isEmpty()) {
222
+ FinderPattern[][] resultArray = new FinderPattern[results.size()][];
223
+ for (int i = 0; i < results.size(); i++) {
224
+ resultArray[i] = (FinderPattern[]) results.elementAt(i);
225
+ }
226
+ return resultArray;
227
+ }
228
+
229
+ // Nothing found!
230
+ throw NotFoundException.getNotFoundInstance();
231
+ }
232
+
233
+ public FinderPatternInfo[] findMulti(Hashtable hints) throws NotFoundException {
234
+ boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER);
235
+ BitMatrix image = getImage();
236
+ int maxI = image.getHeight();
237
+ int maxJ = image.getWidth();
238
+ // We are looking for black/white/black/white/black modules in
239
+ // 1:1:3:1:1 ratio; this tracks the number of such modules seen so far
240
+
241
+ // Let's assume that the maximum version QR Code we support takes up 1/4 the height of the
242
+ // image, and then account for the center being 3 modules in size. This gives the smallest
243
+ // number of pixels the center could be, so skip this often. When trying harder, look for all
244
+ // QR versions regardless of how dense they are.
245
+ int iSkip = (int) (maxI / (MAX_MODULES * 4.0f) * 3);
246
+ if (iSkip < MIN_SKIP || tryHarder) {
247
+ iSkip = MIN_SKIP;
248
+ }
249
+
250
+ int[] stateCount = new int[5];
251
+ for (int i = iSkip - 1; i < maxI; i += iSkip) {
252
+ // Get a row of black/white values
253
+ stateCount[0] = 0;
254
+ stateCount[1] = 0;
255
+ stateCount[2] = 0;
256
+ stateCount[3] = 0;
257
+ stateCount[4] = 0;
258
+ int currentState = 0;
259
+ for (int j = 0; j < maxJ; j++) {
260
+ if (image.get(j, i)) {
261
+ // Black pixel
262
+ if ((currentState & 1) == 1) { // Counting white pixels
263
+ currentState++;
264
+ }
265
+ stateCount[currentState]++;
266
+ } else { // White pixel
267
+ if ((currentState & 1) == 0) { // Counting black pixels
268
+ if (currentState == 4) { // A winner?
269
+ if (foundPatternCross(stateCount)) { // Yes
270
+ boolean confirmed = handlePossibleCenter(stateCount, i, j);
271
+ if (!confirmed) {
272
+ do { // Advance to next black pixel
273
+ j++;
274
+ } while (j < maxJ && !image.get(j, i));
275
+ j--; // back up to that last white pixel
276
+ }
277
+ // Clear state to start looking again
278
+ currentState = 0;
279
+ stateCount[0] = 0;
280
+ stateCount[1] = 0;
281
+ stateCount[2] = 0;
282
+ stateCount[3] = 0;
283
+ stateCount[4] = 0;
284
+ } else { // No, shift counts back by two
285
+ stateCount[0] = stateCount[2];
286
+ stateCount[1] = stateCount[3];
287
+ stateCount[2] = stateCount[4];
288
+ stateCount[3] = 1;
289
+ stateCount[4] = 0;
290
+ currentState = 3;
291
+ }
292
+ } else {
293
+ stateCount[++currentState]++;
294
+ }
295
+ } else { // Counting white pixels
296
+ stateCount[currentState]++;
297
+ }
298
+ }
299
+ } // for j=...
300
+
301
+ if (foundPatternCross(stateCount)) {
302
+ handlePossibleCenter(stateCount, i, maxJ);
303
+ } // end if foundPatternCross
304
+ } // for i=iSkip-1 ...
305
+ FinderPattern[][] patternInfo = selectBestPatterns();
306
+ Vector result = new Vector();
307
+ for (int i = 0; i < patternInfo.length; i++) {
308
+ FinderPattern[] pattern = patternInfo[i];
309
+ ResultPoint.orderBestPatterns(pattern);
310
+ result.addElement(new FinderPatternInfo(pattern));
311
+ }
312
+
313
+ if (result.isEmpty()) {
314
+ return EMPTY_RESULT_ARRAY;
315
+ } else {
316
+ FinderPatternInfo[] resultArray = new FinderPatternInfo[result.size()];
317
+ for (int i = 0; i < result.size(); i++) {
318
+ resultArray[i] = (FinderPatternInfo) result.elementAt(i);
319
+ }
320
+ return resultArray;
321
+ }
322
+ }
323
+
324
+ }