X-Git-Url: http://git.rot13.org/?p=zxing.git;a=blobdiff_plain;f=core%2Fsrc%2Fcom%2Fgoogle%2Fzxing%2Fqrcode%2FQRCodeReader.java;fp=core%2Fsrc%2Fcom%2Fgoogle%2Fzxing%2Fqrcode%2FQRCodeReader.java;h=2c9c5f212c587da1832f7aacc23c09ab87e21d0d;hp=18c19018d6a21b1fa95dcd61a2e82b7ca7427912;hb=88e5e1bed654d322da10c394d7f6ce6944528189;hpb=3981b4c2a3d17bc5f2d452effb557553837c008a diff --git a/core/src/com/google/zxing/qrcode/QRCodeReader.java b/core/src/com/google/zxing/qrcode/QRCodeReader.java index 18c19018..2c9c5f21 100644 --- a/core/src/com/google/zxing/qrcode/QRCodeReader.java +++ b/core/src/com/google/zxing/qrcode/QRCodeReader.java @@ -62,11 +62,11 @@ public class QRCodeReader implements Reader { DecoderResult decoderResult; ResultPoint[] points; if (hints != null && hints.containsKey(DecodeHintType.PURE_BARCODE)) { - BitMatrix bits = extractPureBits(image); + BitMatrix bits = extractPureBits(image.getBlackMatrix()); decoderResult = decoder.decode(bits); points = NO_POINTS; } else { - DetectorResult detectorResult = new Detector(image).detect(hints); + DetectorResult detectorResult = new Detector(image.getBlackMatrix()).detect(hints); decoderResult = decoder.decode(detectorResult.getBits()); points = detectorResult.getPoints(); } @@ -84,7 +84,7 @@ public class QRCodeReader implements Reader { * around it. This is a specialized method that works exceptionally fast in this special * case. */ - private static BitMatrix extractPureBits(BinaryBitmap image) throws ReaderException { + private static BitMatrix extractPureBits(BitMatrix image) throws ReaderException { // Now need to determine module size in pixels int height = image.getHeight(); @@ -93,7 +93,7 @@ public class QRCodeReader implements Reader { // First, skip white border by tracking diagonally from the top left down and to the right: int borderWidth = 0; - while (borderWidth < minDimension && !image.isBlack(borderWidth, borderWidth)) { + while (borderWidth < minDimension && !image.get(borderWidth, borderWidth)) { borderWidth++; } if (borderWidth == minDimension) { @@ -102,7 +102,7 @@ public class QRCodeReader implements Reader { // And then keep tracking across the top-left black module to determine module size int moduleEnd = borderWidth; - while (moduleEnd < minDimension && image.isBlack(moduleEnd, moduleEnd)) { + while (moduleEnd < minDimension && image.get(moduleEnd, moduleEnd)) { moduleEnd++; } if (moduleEnd == minDimension) { @@ -113,7 +113,7 @@ public class QRCodeReader implements Reader { // And now find where the rightmost black module on the first row ends int rowEndOfSymbol = width - 1; - while (rowEndOfSymbol >= 0 && !image.isBlack(rowEndOfSymbol, borderWidth)) { + while (rowEndOfSymbol >= 0 && !image.get(rowEndOfSymbol, borderWidth)) { rowEndOfSymbol--; } if (rowEndOfSymbol < 0) { @@ -142,7 +142,7 @@ public class QRCodeReader implements Reader { for (int i = 0; i < dimension; i++) { int iOffset = borderWidth + i * moduleSize; for (int j = 0; j < dimension; j++) { - if (image.isBlack(borderWidth + j * moduleSize, iOffset)) { + if (image.get(borderWidth + j * moduleSize, iOffset)) { bits.set(j, i); } }