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.
- 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
data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/EAN8Reader.java
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2008 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.oned;
|
18
|
+
|
19
|
+
import com.google.zxing.BarcodeFormat;
|
20
|
+
import com.google.zxing.NotFoundException;
|
21
|
+
import com.google.zxing.common.BitArray;
|
22
|
+
|
23
|
+
/**
|
24
|
+
* <p>Implements decoding of the EAN-8 format.</p>
|
25
|
+
*
|
26
|
+
* @author Sean Owen
|
27
|
+
*/
|
28
|
+
public final class EAN8Reader extends UPCEANReader {
|
29
|
+
|
30
|
+
private final int[] decodeMiddleCounters;
|
31
|
+
|
32
|
+
public EAN8Reader() {
|
33
|
+
decodeMiddleCounters = new int[4];
|
34
|
+
}
|
35
|
+
|
36
|
+
protected int decodeMiddle(BitArray row, int[] startRange, StringBuffer result)
|
37
|
+
throws NotFoundException {
|
38
|
+
int[] counters = decodeMiddleCounters;
|
39
|
+
counters[0] = 0;
|
40
|
+
counters[1] = 0;
|
41
|
+
counters[2] = 0;
|
42
|
+
counters[3] = 0;
|
43
|
+
int end = row.getSize();
|
44
|
+
int rowOffset = startRange[1];
|
45
|
+
|
46
|
+
for (int x = 0; x < 4 && rowOffset < end; x++) {
|
47
|
+
int bestMatch = decodeDigit(row, counters, rowOffset, L_PATTERNS);
|
48
|
+
result.append((char) ('0' + bestMatch));
|
49
|
+
for (int i = 0; i < counters.length; i++) {
|
50
|
+
rowOffset += counters[i];
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
int[] middleRange = findGuardPattern(row, rowOffset, true, MIDDLE_PATTERN);
|
55
|
+
rowOffset = middleRange[1];
|
56
|
+
|
57
|
+
for (int x = 0; x < 4 && rowOffset < end; x++) {
|
58
|
+
int bestMatch = decodeDigit(row, counters, rowOffset, L_PATTERNS);
|
59
|
+
result.append((char) ('0' + bestMatch));
|
60
|
+
for (int i = 0; i < counters.length; i++) {
|
61
|
+
rowOffset += counters[i];
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
return rowOffset;
|
66
|
+
}
|
67
|
+
|
68
|
+
BarcodeFormat getBarcodeFormat() {
|
69
|
+
return BarcodeFormat.EAN_8;
|
70
|
+
}
|
71
|
+
|
72
|
+
}
|
data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/EAN8Writer.java
ADDED
@@ -0,0 +1,76 @@
|
|
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.oned;
|
18
|
+
|
19
|
+
import com.google.zxing.BarcodeFormat;
|
20
|
+
import com.google.zxing.WriterException;
|
21
|
+
import com.google.zxing.common.BitMatrix;
|
22
|
+
|
23
|
+
import java.util.Hashtable;
|
24
|
+
|
25
|
+
/**
|
26
|
+
* This object renders an EAN8 code as a {@link BitMatrix}.
|
27
|
+
*
|
28
|
+
* @author aripollak@gmail.com (Ari Pollak)
|
29
|
+
*/
|
30
|
+
public final class EAN8Writer extends UPCEANWriter {
|
31
|
+
|
32
|
+
private static final int codeWidth = 3 + // start guard
|
33
|
+
(7 * 4) + // left bars
|
34
|
+
5 + // middle guard
|
35
|
+
(7 * 4) + // right bars
|
36
|
+
3; // end guard
|
37
|
+
|
38
|
+
public BitMatrix encode(String contents, BarcodeFormat format, int width, int height,
|
39
|
+
Hashtable hints) throws WriterException {
|
40
|
+
if (format != BarcodeFormat.EAN_8) {
|
41
|
+
throw new IllegalArgumentException("Can only encode EAN_8, but got "
|
42
|
+
+ format);
|
43
|
+
}
|
44
|
+
|
45
|
+
return super.encode(contents, format, width, height, hints);
|
46
|
+
}
|
47
|
+
|
48
|
+
/** @return a byte array of horizontal pixels (0 = white, 1 = black) */
|
49
|
+
public byte[] encode(String contents) {
|
50
|
+
if (contents.length() != 8) {
|
51
|
+
throw new IllegalArgumentException(
|
52
|
+
"Requested contents should be 8 digits long, but got " + contents.length());
|
53
|
+
}
|
54
|
+
|
55
|
+
byte[] result = new byte[codeWidth];
|
56
|
+
int pos = 0;
|
57
|
+
|
58
|
+
pos += appendPattern(result, pos, UPCEANReader.START_END_PATTERN, 1);
|
59
|
+
|
60
|
+
for (int i = 0; i <= 3; i++) {
|
61
|
+
int digit = Integer.parseInt(contents.substring(i, i + 1));
|
62
|
+
pos += appendPattern(result, pos, UPCEANReader.L_PATTERNS[digit], 0);
|
63
|
+
}
|
64
|
+
|
65
|
+
pos += appendPattern(result, pos, UPCEANReader.MIDDLE_PATTERN, 0);
|
66
|
+
|
67
|
+
for (int i = 4; i <= 7; i++) {
|
68
|
+
int digit = Integer.parseInt(contents.substring(i, i + 1));
|
69
|
+
pos += appendPattern(result, pos, UPCEANReader.L_PATTERNS[digit], 1);
|
70
|
+
}
|
71
|
+
pos += appendPattern(result, pos, UPCEANReader.START_END_PATTERN, 1);
|
72
|
+
|
73
|
+
return result;
|
74
|
+
}
|
75
|
+
|
76
|
+
}
|
@@ -0,0 +1,170 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) 2010 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.oned;
|
18
|
+
|
19
|
+
import java.util.Vector;
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Records EAN prefix to GS1 Member Organization, where the member organization
|
23
|
+
* correlates strongly with a country. This is an imperfect means of identifying
|
24
|
+
* a country of origin by EAN-13 barcode value. See
|
25
|
+
* <a href="http://en.wikipedia.org/wiki/List_of_GS1_country_codes">
|
26
|
+
* http://en.wikipedia.org/wiki/List_of_GS1_country_codes</a>.
|
27
|
+
*
|
28
|
+
* @author Sean Owen
|
29
|
+
*/
|
30
|
+
final class EANManufacturerOrgSupport {
|
31
|
+
|
32
|
+
private final Vector ranges = new Vector();
|
33
|
+
private final Vector countryIdentifiers = new Vector();
|
34
|
+
|
35
|
+
String lookupCountryIdentifier(String productCode) {
|
36
|
+
initIfNeeded();
|
37
|
+
int prefix = Integer.parseInt(productCode.substring(0, 3));
|
38
|
+
int max = ranges.size();
|
39
|
+
for (int i = 0; i < max; i++) {
|
40
|
+
int[] range = (int[]) ranges.elementAt(i);
|
41
|
+
int start = range[0];
|
42
|
+
if (prefix < start) {
|
43
|
+
return null;
|
44
|
+
}
|
45
|
+
int end = range.length == 1 ? start : range[1];
|
46
|
+
if (prefix <= end) {
|
47
|
+
return (String) countryIdentifiers.elementAt(i);
|
48
|
+
}
|
49
|
+
}
|
50
|
+
return null;
|
51
|
+
}
|
52
|
+
|
53
|
+
private void add(int[] range, String id) {
|
54
|
+
ranges.addElement(range);
|
55
|
+
countryIdentifiers.addElement(id);
|
56
|
+
}
|
57
|
+
|
58
|
+
private synchronized void initIfNeeded() {
|
59
|
+
if (!ranges.isEmpty()) {
|
60
|
+
return;
|
61
|
+
}
|
62
|
+
add(new int[] {0,19}, "US/CA");
|
63
|
+
add(new int[] {30,39}, "US");
|
64
|
+
add(new int[] {60,139}, "US/CA");
|
65
|
+
add(new int[] {300,379}, "FR");
|
66
|
+
add(new int[] {380}, "BG");
|
67
|
+
add(new int[] {383}, "SI");
|
68
|
+
add(new int[] {385}, "HR");
|
69
|
+
add(new int[] {387}, "BA");
|
70
|
+
add(new int[] {400,440}, "DE");
|
71
|
+
add(new int[] {450,459}, "JP");
|
72
|
+
add(new int[] {460,469}, "RU");
|
73
|
+
add(new int[] {471}, "TW");
|
74
|
+
add(new int[] {474}, "EE");
|
75
|
+
add(new int[] {475}, "LV");
|
76
|
+
add(new int[] {476}, "AZ");
|
77
|
+
add(new int[] {477}, "LT");
|
78
|
+
add(new int[] {478}, "UZ");
|
79
|
+
add(new int[] {479}, "LK");
|
80
|
+
add(new int[] {480}, "PH");
|
81
|
+
add(new int[] {481}, "BY");
|
82
|
+
add(new int[] {482}, "UA");
|
83
|
+
add(new int[] {484}, "MD");
|
84
|
+
add(new int[] {485}, "AM");
|
85
|
+
add(new int[] {486}, "GE");
|
86
|
+
add(new int[] {487}, "KZ");
|
87
|
+
add(new int[] {489}, "HK");
|
88
|
+
add(new int[] {490,499}, "JP");
|
89
|
+
add(new int[] {500,509}, "GB");
|
90
|
+
add(new int[] {520}, "GR");
|
91
|
+
add(new int[] {528}, "LB");
|
92
|
+
add(new int[] {529}, "CY");
|
93
|
+
add(new int[] {531}, "MK");
|
94
|
+
add(new int[] {535}, "MT");
|
95
|
+
add(new int[] {539}, "IE");
|
96
|
+
add(new int[] {540,549}, "BE/LU");
|
97
|
+
add(new int[] {560}, "PT");
|
98
|
+
add(new int[] {569}, "IS");
|
99
|
+
add(new int[] {570,579}, "DK");
|
100
|
+
add(new int[] {590}, "PL");
|
101
|
+
add(new int[] {594}, "RO");
|
102
|
+
add(new int[] {599}, "HU");
|
103
|
+
add(new int[] {600,601}, "ZA");
|
104
|
+
add(new int[] {603}, "GH");
|
105
|
+
add(new int[] {608}, "BH");
|
106
|
+
add(new int[] {609}, "MU");
|
107
|
+
add(new int[] {611}, "MA");
|
108
|
+
add(new int[] {613}, "DZ");
|
109
|
+
add(new int[] {616}, "KE");
|
110
|
+
add(new int[] {618}, "CI");
|
111
|
+
add(new int[] {619}, "TN");
|
112
|
+
add(new int[] {621}, "SY");
|
113
|
+
add(new int[] {622}, "EG");
|
114
|
+
add(new int[] {624}, "LY");
|
115
|
+
add(new int[] {625}, "JO");
|
116
|
+
add(new int[] {626}, "IR");
|
117
|
+
add(new int[] {627}, "KW");
|
118
|
+
add(new int[] {628}, "SA");
|
119
|
+
add(new int[] {629}, "AE");
|
120
|
+
add(new int[] {640,649}, "FI");
|
121
|
+
add(new int[] {690,695}, "CN");
|
122
|
+
add(new int[] {700,709}, "NO");
|
123
|
+
add(new int[] {729}, "IL");
|
124
|
+
add(new int[] {730,739}, "SE");
|
125
|
+
add(new int[] {740}, "GT");
|
126
|
+
add(new int[] {741}, "SV");
|
127
|
+
add(new int[] {742}, "HN");
|
128
|
+
add(new int[] {743}, "NI");
|
129
|
+
add(new int[] {744}, "CR");
|
130
|
+
add(new int[] {745}, "PA");
|
131
|
+
add(new int[] {746}, "DO");
|
132
|
+
add(new int[] {750}, "MX");
|
133
|
+
add(new int[] {754,755}, "CA");
|
134
|
+
add(new int[] {759}, "VE");
|
135
|
+
add(new int[] {760,769}, "CH");
|
136
|
+
add(new int[] {770}, "CO");
|
137
|
+
add(new int[] {773}, "UY");
|
138
|
+
add(new int[] {775}, "PE");
|
139
|
+
add(new int[] {777}, "BO");
|
140
|
+
add(new int[] {779}, "AR");
|
141
|
+
add(new int[] {780}, "CL");
|
142
|
+
add(new int[] {784}, "PY");
|
143
|
+
add(new int[] {785}, "PE");
|
144
|
+
add(new int[] {786}, "EC");
|
145
|
+
add(new int[] {789,790}, "BR");
|
146
|
+
add(new int[] {800,839}, "IT");
|
147
|
+
add(new int[] {840,849}, "ES");
|
148
|
+
add(new int[] {850}, "CU");
|
149
|
+
add(new int[] {858}, "SK");
|
150
|
+
add(new int[] {859}, "CZ");
|
151
|
+
add(new int[] {860}, "YU");
|
152
|
+
add(new int[] {865}, "MN");
|
153
|
+
add(new int[] {867}, "KP");
|
154
|
+
add(new int[] {868,869}, "TR");
|
155
|
+
add(new int[] {870,879}, "NL");
|
156
|
+
add(new int[] {880}, "KR");
|
157
|
+
add(new int[] {885}, "TH");
|
158
|
+
add(new int[] {888}, "SG");
|
159
|
+
add(new int[] {890}, "IN");
|
160
|
+
add(new int[] {893}, "VN");
|
161
|
+
add(new int[] {896}, "PK");
|
162
|
+
add(new int[] {899}, "ID");
|
163
|
+
add(new int[] {900,919}, "AT");
|
164
|
+
add(new int[] {930,939}, "AU");
|
165
|
+
add(new int[] {940,949}, "AZ");
|
166
|
+
add(new int[] {955}, "MY");
|
167
|
+
add(new int[] {958}, "MO");
|
168
|
+
}
|
169
|
+
|
170
|
+
}
|
data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/ITFReader.java
ADDED
@@ -0,0 +1,348 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2008 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.oned;
|
18
|
+
|
19
|
+
import com.google.zxing.BarcodeFormat;
|
20
|
+
import com.google.zxing.DecodeHintType;
|
21
|
+
import com.google.zxing.FormatException;
|
22
|
+
import com.google.zxing.NotFoundException;
|
23
|
+
import com.google.zxing.Result;
|
24
|
+
import com.google.zxing.ResultPoint;
|
25
|
+
import com.google.zxing.common.BitArray;
|
26
|
+
|
27
|
+
import java.util.Hashtable;
|
28
|
+
|
29
|
+
/**
|
30
|
+
* <p>Implements decoding of the ITF format.</p>
|
31
|
+
*
|
32
|
+
* <p>"ITF" stands for Interleaved Two of Five. This Reader will scan ITF barcode with 6, 10 or 14
|
33
|
+
* digits. The checksum is optional and is not applied by this Reader. The consumer of the decoded
|
34
|
+
* value will have to apply a checksum if required.</p>
|
35
|
+
*
|
36
|
+
* <p><a href="http://en.wikipedia.org/wiki/Interleaved_2_of_5">http://en.wikipedia.org/wiki/Interleaved_2_of_5</a>
|
37
|
+
* is a great reference for Interleaved 2 of 5 information.</p>
|
38
|
+
*
|
39
|
+
* @author kevin.osullivan@sita.aero, SITA Lab.
|
40
|
+
*/
|
41
|
+
public final class ITFReader extends OneDReader {
|
42
|
+
|
43
|
+
private static final int MAX_AVG_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.42f);
|
44
|
+
private static final int MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.8f);
|
45
|
+
|
46
|
+
private static final int W = 3; // Pixel width of a wide line
|
47
|
+
private static final int N = 1; // Pixed width of a narrow line
|
48
|
+
|
49
|
+
private static final int[] DEFAULT_ALLOWED_LENGTHS = { 6, 10, 12, 14, 44 };
|
50
|
+
|
51
|
+
// Stores the actual narrow line width of the image being decoded.
|
52
|
+
private int narrowLineWidth = -1;
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Start/end guard pattern.
|
56
|
+
*
|
57
|
+
* Note: The end pattern is reversed because the row is reversed before
|
58
|
+
* searching for the END_PATTERN
|
59
|
+
*/
|
60
|
+
private static final int[] START_PATTERN = {N, N, N, N};
|
61
|
+
private static final int[] END_PATTERN_REVERSED = {N, N, W};
|
62
|
+
|
63
|
+
/**
|
64
|
+
* Patterns of Wide / Narrow lines to indicate each digit
|
65
|
+
*/
|
66
|
+
static final int[][] PATTERNS = {
|
67
|
+
{N, N, W, W, N}, // 0
|
68
|
+
{W, N, N, N, W}, // 1
|
69
|
+
{N, W, N, N, W}, // 2
|
70
|
+
{W, W, N, N, N}, // 3
|
71
|
+
{N, N, W, N, W}, // 4
|
72
|
+
{W, N, W, N, N}, // 5
|
73
|
+
{N, W, W, N, N}, // 6
|
74
|
+
{N, N, N, W, W}, // 7
|
75
|
+
{W, N, N, W, N}, // 8
|
76
|
+
{N, W, N, W, N} // 9
|
77
|
+
};
|
78
|
+
|
79
|
+
public Result decodeRow(int rowNumber, BitArray row, Hashtable hints) throws FormatException, NotFoundException {
|
80
|
+
|
81
|
+
// Find out where the Middle section (payload) starts & ends
|
82
|
+
int[] startRange = decodeStart(row);
|
83
|
+
int[] endRange = decodeEnd(row);
|
84
|
+
|
85
|
+
StringBuffer result = new StringBuffer(20);
|
86
|
+
decodeMiddle(row, startRange[1], endRange[0], result);
|
87
|
+
String resultString = result.toString();
|
88
|
+
|
89
|
+
int[] allowedLengths = null;
|
90
|
+
if (hints != null) {
|
91
|
+
allowedLengths = (int[]) hints.get(DecodeHintType.ALLOWED_LENGTHS);
|
92
|
+
|
93
|
+
}
|
94
|
+
if (allowedLengths == null) {
|
95
|
+
allowedLengths = DEFAULT_ALLOWED_LENGTHS;
|
96
|
+
}
|
97
|
+
|
98
|
+
// To avoid false positives with 2D barcodes (and other patterns), make
|
99
|
+
// an assumption that the decoded string must be 6, 10 or 14 digits.
|
100
|
+
int length = resultString.length();
|
101
|
+
boolean lengthOK = false;
|
102
|
+
for (int i = 0; i < allowedLengths.length; i++) {
|
103
|
+
if (length == allowedLengths[i]) {
|
104
|
+
lengthOK = true;
|
105
|
+
break;
|
106
|
+
}
|
107
|
+
|
108
|
+
}
|
109
|
+
if (!lengthOK) {
|
110
|
+
throw FormatException.getFormatInstance();
|
111
|
+
}
|
112
|
+
|
113
|
+
return new Result(
|
114
|
+
resultString,
|
115
|
+
null, // no natural byte representation for these barcodes
|
116
|
+
new ResultPoint[] { new ResultPoint(startRange[1], (float) rowNumber),
|
117
|
+
new ResultPoint(endRange[0], (float) rowNumber)},
|
118
|
+
BarcodeFormat.ITF);
|
119
|
+
}
|
120
|
+
|
121
|
+
/**
|
122
|
+
* @param row row of black/white values to search
|
123
|
+
* @param payloadStart offset of start pattern
|
124
|
+
* @param resultString {@link StringBuffer} to append decoded chars to
|
125
|
+
* @throws NotFoundException if decoding could not complete successfully
|
126
|
+
*/
|
127
|
+
private static void decodeMiddle(BitArray row, int payloadStart, int payloadEnd,
|
128
|
+
StringBuffer resultString) throws NotFoundException {
|
129
|
+
|
130
|
+
// Digits are interleaved in pairs - 5 black lines for one digit, and the
|
131
|
+
// 5
|
132
|
+
// interleaved white lines for the second digit.
|
133
|
+
// Therefore, need to scan 10 lines and then
|
134
|
+
// split these into two arrays
|
135
|
+
int[] counterDigitPair = new int[10];
|
136
|
+
int[] counterBlack = new int[5];
|
137
|
+
int[] counterWhite = new int[5];
|
138
|
+
|
139
|
+
while (payloadStart < payloadEnd) {
|
140
|
+
|
141
|
+
// Get 10 runs of black/white.
|
142
|
+
recordPattern(row, payloadStart, counterDigitPair);
|
143
|
+
// Split them into each array
|
144
|
+
for (int k = 0; k < 5; k++) {
|
145
|
+
int twoK = k << 1;
|
146
|
+
counterBlack[k] = counterDigitPair[twoK];
|
147
|
+
counterWhite[k] = counterDigitPair[twoK + 1];
|
148
|
+
}
|
149
|
+
|
150
|
+
int bestMatch = decodeDigit(counterBlack);
|
151
|
+
resultString.append((char) ('0' + bestMatch));
|
152
|
+
bestMatch = decodeDigit(counterWhite);
|
153
|
+
resultString.append((char) ('0' + bestMatch));
|
154
|
+
|
155
|
+
for (int i = 0; i < counterDigitPair.length; i++) {
|
156
|
+
payloadStart += counterDigitPair[i];
|
157
|
+
}
|
158
|
+
}
|
159
|
+
}
|
160
|
+
|
161
|
+
/**
|
162
|
+
* Identify where the start of the middle / payload section starts.
|
163
|
+
*
|
164
|
+
* @param row row of black/white values to search
|
165
|
+
* @return Array, containing index of start of 'start block' and end of
|
166
|
+
* 'start block'
|
167
|
+
* @throws NotFoundException
|
168
|
+
*/
|
169
|
+
int[] decodeStart(BitArray row) throws NotFoundException {
|
170
|
+
int endStart = skipWhiteSpace(row);
|
171
|
+
int[] startPattern = findGuardPattern(row, endStart, START_PATTERN);
|
172
|
+
|
173
|
+
// Determine the width of a narrow line in pixels. We can do this by
|
174
|
+
// getting the width of the start pattern and dividing by 4 because its
|
175
|
+
// made up of 4 narrow lines.
|
176
|
+
this.narrowLineWidth = (startPattern[1] - startPattern[0]) >> 2;
|
177
|
+
|
178
|
+
validateQuietZone(row, startPattern[0]);
|
179
|
+
|
180
|
+
return startPattern;
|
181
|
+
}
|
182
|
+
|
183
|
+
/**
|
184
|
+
* The start & end patterns must be pre/post fixed by a quiet zone. This
|
185
|
+
* zone must be at least 10 times the width of a narrow line. Scan back until
|
186
|
+
* we either get to the start of the barcode or match the necessary number of
|
187
|
+
* quiet zone pixels.
|
188
|
+
*
|
189
|
+
* Note: Its assumed the row is reversed when using this method to find
|
190
|
+
* quiet zone after the end pattern.
|
191
|
+
*
|
192
|
+
* ref: http://www.barcode-1.net/i25code.html
|
193
|
+
*
|
194
|
+
* @param row bit array representing the scanned barcode.
|
195
|
+
* @param startPattern index into row of the start or end pattern.
|
196
|
+
* @throws NotFoundException if the quiet zone cannot be found, a ReaderException is thrown.
|
197
|
+
*/
|
198
|
+
private void validateQuietZone(BitArray row, int startPattern) throws NotFoundException {
|
199
|
+
|
200
|
+
int quietCount = this.narrowLineWidth * 10; // expect to find this many pixels of quiet zone
|
201
|
+
|
202
|
+
for (int i = startPattern - 1; quietCount > 0 && i >= 0; i--) {
|
203
|
+
if (row.get(i)) {
|
204
|
+
break;
|
205
|
+
}
|
206
|
+
quietCount--;
|
207
|
+
}
|
208
|
+
if (quietCount != 0) {
|
209
|
+
// Unable to find the necessary number of quiet zone pixels.
|
210
|
+
throw NotFoundException.getNotFoundInstance();
|
211
|
+
}
|
212
|
+
}
|
213
|
+
|
214
|
+
/**
|
215
|
+
* Skip all whitespace until we get to the first black line.
|
216
|
+
*
|
217
|
+
* @param row row of black/white values to search
|
218
|
+
* @return index of the first black line.
|
219
|
+
* @throws NotFoundException Throws exception if no black lines are found in the row
|
220
|
+
*/
|
221
|
+
private static int skipWhiteSpace(BitArray row) throws NotFoundException {
|
222
|
+
int width = row.getSize();
|
223
|
+
int endStart = 0;
|
224
|
+
while (endStart < width) {
|
225
|
+
if (row.get(endStart)) {
|
226
|
+
break;
|
227
|
+
}
|
228
|
+
endStart++;
|
229
|
+
}
|
230
|
+
if (endStart == width) {
|
231
|
+
throw NotFoundException.getNotFoundInstance();
|
232
|
+
}
|
233
|
+
|
234
|
+
return endStart;
|
235
|
+
}
|
236
|
+
|
237
|
+
/**
|
238
|
+
* Identify where the end of the middle / payload section ends.
|
239
|
+
*
|
240
|
+
* @param row row of black/white values to search
|
241
|
+
* @return Array, containing index of start of 'end block' and end of 'end
|
242
|
+
* block'
|
243
|
+
* @throws NotFoundException
|
244
|
+
*/
|
245
|
+
|
246
|
+
int[] decodeEnd(BitArray row) throws NotFoundException {
|
247
|
+
|
248
|
+
// For convenience, reverse the row and then
|
249
|
+
// search from 'the start' for the end block
|
250
|
+
row.reverse();
|
251
|
+
try {
|
252
|
+
int endStart = skipWhiteSpace(row);
|
253
|
+
int[] endPattern = findGuardPattern(row, endStart, END_PATTERN_REVERSED);
|
254
|
+
|
255
|
+
// The start & end patterns must be pre/post fixed by a quiet zone. This
|
256
|
+
// zone must be at least 10 times the width of a narrow line.
|
257
|
+
// ref: http://www.barcode-1.net/i25code.html
|
258
|
+
validateQuietZone(row, endPattern[0]);
|
259
|
+
|
260
|
+
// Now recalculate the indices of where the 'endblock' starts & stops to
|
261
|
+
// accommodate
|
262
|
+
// the reversed nature of the search
|
263
|
+
int temp = endPattern[0];
|
264
|
+
endPattern[0] = row.getSize() - endPattern[1];
|
265
|
+
endPattern[1] = row.getSize() - temp;
|
266
|
+
|
267
|
+
return endPattern;
|
268
|
+
} finally {
|
269
|
+
// Put the row back the right way.
|
270
|
+
row.reverse();
|
271
|
+
}
|
272
|
+
}
|
273
|
+
|
274
|
+
/**
|
275
|
+
* @param row row of black/white values to search
|
276
|
+
* @param rowOffset position to start search
|
277
|
+
* @param pattern pattern of counts of number of black and white pixels that are
|
278
|
+
* being searched for as a pattern
|
279
|
+
* @return start/end horizontal offset of guard pattern, as an array of two
|
280
|
+
* ints
|
281
|
+
* @throws NotFoundException if pattern is not found
|
282
|
+
*/
|
283
|
+
private static int[] findGuardPattern(BitArray row, int rowOffset, int[] pattern) throws NotFoundException {
|
284
|
+
|
285
|
+
// TODO: This is very similar to implementation in UPCEANReader. Consider if they can be
|
286
|
+
// merged to a single method.
|
287
|
+
int patternLength = pattern.length;
|
288
|
+
int[] counters = new int[patternLength];
|
289
|
+
int width = row.getSize();
|
290
|
+
boolean isWhite = false;
|
291
|
+
|
292
|
+
int counterPosition = 0;
|
293
|
+
int patternStart = rowOffset;
|
294
|
+
for (int x = rowOffset; x < width; x++) {
|
295
|
+
boolean pixel = row.get(x);
|
296
|
+
if (pixel ^ isWhite) {
|
297
|
+
counters[counterPosition]++;
|
298
|
+
} else {
|
299
|
+
if (counterPosition == patternLength - 1) {
|
300
|
+
if (patternMatchVariance(counters, pattern, MAX_INDIVIDUAL_VARIANCE) < MAX_AVG_VARIANCE) {
|
301
|
+
return new int[]{patternStart, x};
|
302
|
+
}
|
303
|
+
patternStart += counters[0] + counters[1];
|
304
|
+
for (int y = 2; y < patternLength; y++) {
|
305
|
+
counters[y - 2] = counters[y];
|
306
|
+
}
|
307
|
+
counters[patternLength - 2] = 0;
|
308
|
+
counters[patternLength - 1] = 0;
|
309
|
+
counterPosition--;
|
310
|
+
} else {
|
311
|
+
counterPosition++;
|
312
|
+
}
|
313
|
+
counters[counterPosition] = 1;
|
314
|
+
isWhite = !isWhite;
|
315
|
+
}
|
316
|
+
}
|
317
|
+
throw NotFoundException.getNotFoundInstance();
|
318
|
+
}
|
319
|
+
|
320
|
+
/**
|
321
|
+
* Attempts to decode a sequence of ITF black/white lines into single
|
322
|
+
* digit.
|
323
|
+
*
|
324
|
+
* @param counters the counts of runs of observed black/white/black/... values
|
325
|
+
* @return The decoded digit
|
326
|
+
* @throws NotFoundException if digit cannot be decoded
|
327
|
+
*/
|
328
|
+
private static int decodeDigit(int[] counters) throws NotFoundException {
|
329
|
+
|
330
|
+
int bestVariance = MAX_AVG_VARIANCE; // worst variance we'll accept
|
331
|
+
int bestMatch = -1;
|
332
|
+
int max = PATTERNS.length;
|
333
|
+
for (int i = 0; i < max; i++) {
|
334
|
+
int[] pattern = PATTERNS[i];
|
335
|
+
int variance = patternMatchVariance(counters, pattern, MAX_INDIVIDUAL_VARIANCE);
|
336
|
+
if (variance < bestVariance) {
|
337
|
+
bestVariance = variance;
|
338
|
+
bestMatch = i;
|
339
|
+
}
|
340
|
+
}
|
341
|
+
if (bestMatch >= 0) {
|
342
|
+
return bestMatch;
|
343
|
+
} else {
|
344
|
+
throw NotFoundException.getNotFoundInstance();
|
345
|
+
}
|
346
|
+
}
|
347
|
+
|
348
|
+
}
|