rhodes 2.4.1 → 3.0.0.beta.1
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.
- data/CHANGELOG +7 -0
- data/Rakefile +7 -36
- data/doc/build.txt +48 -22
- data/doc/device-caps.txt +130 -1
- data/doc/rhom.txt +9 -3
- data/doc/test-log-debug.txt +5 -2
- data/lib/extensions/barcode/ext/barcode/platform/android/Rakefile +40 -20
- data/lib/extensions/barcode/ext/barcode/platform/android/ZXing_Info/AUTHORS +58 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/ZXing_Info/CHANGES +266 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/ZXing_Info/COPYING +201 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/ZXing_Info/README +11 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/ext_build.files +173 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/jni/src/barcode.cpp +34 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/BarcodeFormat.java +103 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/Binarizer.java +80 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/BinaryBitmap.java +128 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/ChecksumException.java +37 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/DecodeHintType.java +79 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/EncodeHintType.java +39 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/FormatException.java +38 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/LuminanceSource.java +113 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/MultiFormatReader.java +166 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/MultiFormatWriter.java +65 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/NotFoundException.java +37 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/Reader.java +64 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/ReaderException.java +98 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/Result.java +143 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/ResultMetadataType.java +109 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/ResultPoint.java +127 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/ResultPointCallback.java +29 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/Writer.java +54 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/WriterException.java +35 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/AbstractDoCoMoResultParser.java +39 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/AddressBookAUResultParser.java +73 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/AddressBookDoCoMoResultParser.java +85 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/AddressBookParsedResult.java +122 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/BizcardResultParser.java +94 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/BookmarkDoCoMoResultParser.java +46 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/CalendarParsedResult.java +134 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/EmailAddressParsedResult.java +61 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/EmailAddressResultParser.java +64 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/EmailDoCoMoResultParser.java +87 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ExpandedProductParsedResult.java +195 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ExpandedProductResultParser.java +199 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/GeoParsedResult.java +132 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/GeoResultParser.java +77 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ISBNParsedResult.java +39 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ISBNResultParser.java +54 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ParsedResult.java +73 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ParsedResultType.java +53 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ProductParsedResult.java +49 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ProductResultParser.java +66 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ResultParser.java +319 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/SMSMMSResultParser.java +107 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/SMSParsedResult.java +104 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/SMSTOMMSTOResultParser.java +57 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/TelParsedResult.java +54 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/TelResultParser.java +44 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/TextParsedResult.java +48 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/URIParsedResult.java +113 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/URIResultParser.java +87 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/URLTOResultParser.java +47 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/VCardResultParser.java +346 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/VEventResultParser.java +54 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/WifiParsedResult.java +53 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/WifiResultParser.java +50 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/optional/AbstractNDEFResultParser.java +45 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/optional/NDEFRecord.java +87 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/optional/NDEFSmartPosterParsedResult.java +63 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/optional/NDEFSmartPosterResultParser.java +81 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/optional/NDEFTextResultParser.java +57 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/optional/NDEFURIResultParser.java +95 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/BitArray.java +247 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/BitMatrix.java +226 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/BitSource.java +97 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/CharacterSetECI.java +110 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/Collections.java +53 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/Comparator.java +27 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/DecoderResult.java +63 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/DefaultGridSampler.java +81 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/DetectorResult.java +46 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/ECI.java +52 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/GlobalHistogramBinarizer.java +196 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/GridSampler.java +171 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/HybridBinarizer.java +185 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/PerspectiveTransform.java +148 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/StringUtils.java +191 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/detector/MonochromeRectangleDetector.java +209 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/detector/WhiteRectangleDetector.java +316 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/reedsolomon/GF256.java +139 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/reedsolomon/GF256Poly.java +263 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/reedsolomon/ReedSolomonDecoder.java +194 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/reedsolomon/ReedSolomonEncoder.java +75 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/reedsolomon/ReedSolomonException.java +31 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/datamatrix/DataMatrixReader.java +161 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/datamatrix/decoder/BitMatrixParser.java +446 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/datamatrix/decoder/DataBlock.java +118 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/datamatrix/decoder/DecodedBitStreamParser.java +462 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/datamatrix/decoder/Decoder.java +134 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/datamatrix/decoder/Version.java +242 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/datamatrix/detector/Detector.java +348 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/multi/ByQuadrantReader.java +96 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/multi/GenericMultipleBarcodeReader.java +156 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/multi/MultipleBarcodeReader.java +37 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/multi/qrcode/QRCodeMultiReader.java +80 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/multi/qrcode/detector/MultiDetector.java +72 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/multi/qrcode/detector/MultiFinderPatternFinder.java +324 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/CodaBarReader.java +263 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/Code128Reader.java +473 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/Code128Writer.java +73 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/Code39Reader.java +333 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/Code39Writer.java +82 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/Code93Reader.java +273 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/EAN13Reader.java +135 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/EAN13Writer.java +81 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/EAN8Reader.java +72 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/EAN8Writer.java +76 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/EANManufacturerOrgSupport.java +170 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/ITFReader.java +348 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/ITFWriter.java +68 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/MultiFormatOneDReader.java +109 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/MultiFormatUPCEANReader.java +113 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/OneDReader.java +297 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/UPCAReader.java +75 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/UPCEANExtensionSupport.java +186 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/UPCEANReader.java +355 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/UPCEANWriter.java +104 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/UPCEReader.java +153 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/AbstractRSSReader.java +110 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/DataCharacter.java +37 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/FinderPattern.java +48 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/Pair.java +41 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/RSS14Reader.java +494 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/RSSUtils.java +155 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/BitArrayBuilder.java +85 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/ExpandedPair.java +68 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/RSSExpandedReader.java +578 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI013103decoder.java +47 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI01320xDecoder.java +55 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI01392xDecoder.java +66 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI01393xDecoder.java +76 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI013x0x1xDecoder.java +106 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI013x0xDecoder.java +56 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI01AndOtherAIs.java +56 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI01decoder.java +81 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI01weightDecoder.java +58 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AbstractExpandedDecoder.java +85 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AnyAIDecoder.java +48 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/BlockParsedResult.java +60 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/CurrentParsingState.java +69 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/DecodedChar.java +52 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/DecodedInformation.java +63 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/DecodedNumeric.java +79 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/DecodedObject.java +44 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/FieldParser.java +285 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/GeneralAppIdDecoder.java +414 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/pdf417/PDF417Reader.java +79 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/pdf417/decoder/BitMatrixParser.java +1163 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java +629 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/pdf417/decoder/Decoder.java +150 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/pdf417/detector/Detector.java +498 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/QRCodeReader.java +166 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/QRCodeWriter.java +108 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/BitMatrixParser.java +203 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/DataBlock.java +123 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/DataMask.java +155 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/DecodedBitStreamParser.java +261 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/Decoder.java +148 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/ErrorCorrectionLevel.java +86 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/FormatInformation.java +171 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/Mode.java +112 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/Version.java +586 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/detector/AlignmentPattern.java +48 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/detector/AlignmentPatternFinder.java +279 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/detector/Detector.java +400 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/detector/FinderPattern.java +63 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/detector/FinderPatternFinder.java +585 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/detector/FinderPatternInfo.java +49 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/encoder/BlockPair.java +37 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/encoder/ByteMatrix.java +97 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/encoder/Encoder.java +557 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/encoder/MaskUtil.java +217 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/encoder/MatrixUtil.java +524 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/encoder/QRCode.java +239 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/rhomobile/barcode/Barcode.java +63 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/rhomobile/barcode/RhoLuminanceSource.java +75 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Barcode.xcodeproj/project.pbxproj +74 -318
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/barcode.m +70 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/COPYING +27 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarCaptureReader.h +105 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarHelpController.h +60 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarImage.h +69 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarImageScanner.h +51 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderController.h +142 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderView.h +118 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderViewController.h +100 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarSDK.h +33 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarSymbol.h +71 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar.h +1476 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Decoder.h +201 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Exception.h +187 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Image.h +321 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/ImageScanner.h +130 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Processor.h +223 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Scanner.h +162 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Symbol.h +529 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Video.h +170 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Window.h +136 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/LICENSE +504 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/README +59 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Resources/zbar-back.png +0 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Resources/zbar-help.html +88 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Resources/zbar-helpicons.png +0 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Resources/zbar-samples.png +0 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/libzbar.a +0 -0
- data/lib/extensions/debugger/debugger.rb +215 -67
- data/lib/extensions/nfc/ext/nfc/platform/android/AndroidManifest.xml +1 -1
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/nfc/Nfc.java +14 -2
- data/lib/extensions/timeout/timeout.rb +114 -0
- data/lib/framework/rho/render.rb +14 -16
- data/lib/framework/rho/rho.rb +38 -14
- data/lib/framework/rho/rhoapplication.rb +1 -1
- data/lib/framework/rho/rhocontroller.rb +3 -3
- data/lib/framework/rho/rhofsconnector.rb +18 -6
- data/lib/framework/rho/rhoviewhelpers.rb +1 -1
- data/lib/framework/rhoappmanifest.rb +44 -0
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/rhoframework.rb +31 -11
- data/lib/framework/rholang/localization_simplified.rb +10 -6
- data/lib/framework/rhom/rhom_object_factory.rb +3 -3
- data/lib/framework/version.rb +1 -1
- data/lib/rhodes.rb +1 -1
- data/platform/android/Rhodes/AndroidManifest.xml +2 -2
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesApplication.h +32 -8
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesService.h +21 -21
- data/platform/android/Rhodes/jni/src/rhocryptimpl.cpp +1 -0
- data/platform/android/Rhodes/jni/src/rhodes.cpp +21 -9
- data/platform/android/Rhodes/jni/src/sslimpl.cpp +1 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +7 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushReceiver.java +19 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoCryptImpl.java +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +24 -15
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +39 -47
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +113 -106
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +11 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/StatusNotification.java +49 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/socket/SSLImpl.java +5 -1
- data/platform/android/build/RhodesSRC_build.files +1 -0
- data/platform/android/build/android.rake +93 -6
- data/platform/bb/RubyVM/src/com/rho/RhodesApp.java +5 -4
- data/platform/bb/RubyVM/src/com/rho/file/RhoFile.java +10 -0
- data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +16 -15
- data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +2 -2
- data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +21 -19
- data/platform/bb/rhodes/src/com/rho/BrowserAdapter5.java +2 -2
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +6 -1
- data/platform/bb/rhodes/src/com/rho/rubyext/WebView.java +10 -3
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +21 -1
- data/platform/iphone/Classes/SimpleMainView.m +5 -5
- data/platform/iphone/Info.plist +1 -1
- data/platform/iphone/rbuild/iphone.rake +30 -1
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +12 -0
- data/platform/shared/SyncClient/SyncClient.cpp +136 -20
- data/platform/shared/SyncClient/SyncClient.h +17 -0
- data/platform/shared/common/AppMenu.cpp +6 -1
- data/platform/shared/common/RhoConf.cpp +13 -1
- data/platform/shared/common/RhoConf.h +3 -1
- data/platform/shared/common/RhoDefs.h +10 -0
- data/platform/shared/common/RhoFile.cpp +15 -0
- data/platform/shared/common/RhoFile.h +1 -0
- data/platform/shared/common/RhodesApp.cpp +16 -3
- data/platform/shared/common/RhodesApp.h +1 -0
- data/platform/shared/common/RhodesAppBase.cpp +102 -62
- data/platform/shared/common/RhodesAppBase.h +7 -1
- data/platform/shared/curl/lib/rhossl.c +1 -0
- data/platform/shared/db/DBAdapter.cpp +14 -2
- data/platform/shared/logging/RhoLogConf.cpp +21 -0
- data/platform/shared/logging/RhoLogConf.h +11 -0
- data/platform/shared/logging/RhoLogSink.cpp +24 -0
- data/platform/shared/logging/RhoLogSink.h +20 -1
- data/platform/shared/net/HttpServer.cpp +8 -6
- data/platform/shared/net/RawSocket.cpp +130 -0
- data/platform/shared/net/RawSocket.h +74 -0
- data/platform/shared/ruby/ext/rho/rhoruby.c +37 -1
- data/platform/shared/ruby/ext/rho/rhosupport.c +74 -21
- data/platform/shared/ruby/ext/sqlite3_api/sqlite3_api_wrap.c +9 -1
- data/platform/shared/ruby/vm_eval.c +4 -3
- data/platform/shared/sync/SyncEngine.cpp +11 -12
- data/platform/shared/sync/SyncEngine.h +2 -2
- data/platform/shared/sync/SyncNotify.cpp +41 -13
- data/platform/shared/sync/SyncNotify.h +20 -3
- data/platform/shared/sync/SyncSource.cpp +21 -19
- data/platform/shared/sync/SyncThread.cpp +11 -1
- data/platform/shared/sync/SyncThread.h +3 -0
- data/platform/shared/test/test_helper.cpp +7 -0
- data/platform/win32/RhoSimulator/QtCore4.dll +0 -0
- data/platform/win32/RhoSimulator/QtGui4.dll +0 -0
- data/platform/win32/RhoSimulator/QtNetwork4.dll +0 -0
- data/platform/win32/RhoSimulator/QtWebKit4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qgif4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qjpeg4.dll +0 -0
- data/platform/win32/RhoSimulator/rhosimulator.exe +0 -0
- data/platform/wm/RhoLib/RhoLib.vcproj +762 -14
- data/platform/wm/build/wm.rake +87 -10
- data/platform/wm/rhodes.sln +155 -72
- data/platform/wm/rhodes/MainWindow.cpp +5 -2
- data/platform/wm/rhodes/MainWindow.h +9 -1
- data/platform/wm/rhodes/RhoNativeViewManager.cpp +4 -0
- data/platform/wm/rhodes/Rhodes.cpp +60 -6
- data/platform/wm/rhodes/emulator/ExternalWebView.cpp +20 -0
- data/platform/wm/rhodes/emulator/ExternalWebView.h +23 -0
- data/platform/wm/rhodes/emulator/ExternalWebView.ui +46 -0
- data/platform/wm/rhodes/emulator/MainWindowCallback.h +18 -0
- data/platform/wm/rhodes/emulator/MainWindowProxy.cpp +268 -0
- data/platform/wm/rhodes/emulator/MainWindowProxy.h +34 -0
- data/platform/wm/rhodes/emulator/MainWindowQt.cpp +345 -0
- data/platform/wm/rhodes/emulator/MainWindowQt.h +118 -0
- data/platform/wm/rhodes/emulator/NativeToolbarQt.cpp +57 -0
- data/platform/wm/rhodes/emulator/NativeToolbarQt.h +52 -0
- data/platform/wm/rhodes/emulator/QtMainWindow.cpp +219 -0
- data/platform/wm/rhodes/emulator/QtMainWindow.h +62 -0
- data/platform/wm/rhodes/emulator/QtMainWindow.ui +122 -0
- data/platform/wm/rhodes/{RhoCryptImpl.cpp → rho/common/RhoCryptImpl.cpp} +0 -0
- data/platform/wm/rhodes/{RhoCryptImpl.h → rho/common/RhoCryptImpl.h} +0 -0
- data/platform/wm/rhodes/rho/rubyext/NativeToolbar.cpp +2 -86
- data/platform/wm/rhodes/rho/rubyext/NativeToolbarExt.cpp +87 -0
- data/platform/wm/rhodes/rho/rubyext/NativeToolbarExt.h +6 -0
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +60 -0
- data/platform/wm/rhodes/rhodes.vcproj +4025 -365
- data/platform/wm/rhodes/signature/Signature.cpp +29 -13
- data/platform/wm/rubylib/rubylib.vcproj +1167 -195
- data/platform/wm/shttpd/shttpd.vcproj +4 -4
- data/platform/wm/sqlite3/sqlite3.vcproj +441 -13
- data/platform/wm/syncengine/syncengine.vcproj +443 -15
- data/platform/wm/tcmalloc/tcmalloc.vcproj +0 -154
- data/platform/wm/tools/detool/LogServer.cpp +150 -0
- data/platform/wm/tools/detool/LogServer.h +23 -0
- data/platform/wm/tools/detool/detool.cpp +42 -4
- data/platform/wm/tools/detool/detool.vcproj +10 -1
- data/platform/wp7/IronRuby/Bin/Silverlight3Release/IronRuby.Libraries.dll +0 -0
- data/platform/wp7/IronRuby/Bin/Silverlight3Release/IronRuby.dll +0 -0
- data/platform/wp7/IronRuby/Bin/Silverlight3Release/Microsoft.Dynamic.dll +0 -0
- data/platform/wp7/IronRuby/Bin/Silverlight3Release/Microsoft.Scripting.Core.dll +0 -0
- data/platform/wp7/IronRuby/Bin/Silverlight3Release/Microsoft.Scripting.dll +0 -0
- data/platform/wp7/RhoAppRunner/Program.cs +20 -3
- data/platform/wp7/RhoLogServer/Program.cs +22 -0
- data/platform/wp7/RhoLogServer/Properties/AssemblyInfo.cs +36 -0
- data/platform/wp7/RhoLogServer/RhoLogServer.csproj +65 -0
- data/platform/wp7/RhoLogServer/SocketServer.cs +210 -0
- data/platform/wp7/RhoRubyExtGen/RhoAsyncHttp.cs +6 -0
- data/platform/wp7/RhoRubyLib/Initializers.Generated.cs +3 -2
- data/platform/wp7/RhoRubyLib/RhoRuby.cs +82 -0
- data/platform/wp7/RhoRubyLib/RhoRubyLib.csproj +7 -5
- data/platform/wp7/RhoRubyLib/WP_PlatformAdaptationLayer.cs +1 -1
- data/platform/wp7/RhoRubyLib/common/RhoParams.cs +1 -1
- data/platform/wp7/RhoRubyLib/common/ThreadQueue.cs +4 -1
- data/platform/wp7/RhoRubyLib/db/DBAdapter.cs +2 -2
- data/platform/wp7/RhoRubyLib/logging/IRhoLogSink.cs +1 -1
- data/platform/wp7/RhoRubyLib/logging/RhoEmptyLogger.cs +30 -0
- data/platform/wp7/RhoRubyLib/logging/RhoLogConf.cs +10 -0
- data/platform/wp7/RhoRubyLib/logging/RhoLogFileSink.cs +6 -1
- data/platform/wp7/RhoRubyLib/logging/RhoLogServerSink.cs +56 -0
- data/platform/wp7/RhoRubyLib/logging/RhoLogger.cs +24 -11
- data/platform/wp7/RhoRubyLib/net/AsyncHttp.cs +57 -14
- data/platform/wp7/RhoRubyLib/net/NetRequest.cs +32 -9
- data/platform/wp7/RhoRubyLib/rubyext/RhoAsyncHttp.cs +7 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoKernelOps.cs +6 -0
- data/platform/wp7/RhoRubyLib/sync/SyncEngine.cs +20 -16
- data/platform/wp7/RhoRubyLib/sync/SyncNotify.cs +2 -2
- data/platform/wp7/RhoRubyLib/sync/SyncSource.cs +138 -40
- data/platform/wp7/WPApplication/rho/apps/app/layout.erb +3 -1
- data/platform/wp7/build/wp.rake +151 -12
- data/platform/wp7/rhodes.sln +10 -0
- data/platform/wp7/rhodes/App.xaml.cs +6 -0
- data/platform/wp7/rhodes/MainPage.xaml +3 -0
- data/platform/wp7/rhodes/MainPage.xaml.cs +19 -0
- data/platform/wp7/rhodes/Rhodes.csproj +4 -2
- data/rakefile.rb +7 -36
- data/res/build-tools/RhoAppRunner.exe +0 -0
- data/res/build-tools/RhoLogServer.exe +0 -0
- data/res/build-tools/detool.exe +0 -0
- data/res/build-tools/wp7explorer.exe +0 -0
- data/res/generators/templates/application/app/layout.erb +3 -1
- data/res/generators/templates/application/public/jqtouch/jqtouch.js +1 -1
- data/rhodes.gemspec +1 -1
- data/spec/framework_spec/app/layout.erb +1 -1
- data/spec/framework_spec/build.yml +1 -0
- data/spec/perfomance_spec/app/layout.erb +3 -0
- data/spec/phone_spec/app/Account_s/account_s.rb +4 -1
- data/spec/phone_spec/app/spec/rhom_object_spec.rb +30 -1
- data/spec/phone_spec/app/spec_runner.rb +1 -1
- data/spec/phone_spec/build.yml +4 -1
- metadata +262 -10
- 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
|
+
}
|