From d7eccf7bb9fd04b40c22cfba0d98c636102e4e98 Mon Sep 17 00:00:00 2001 From: srowen Date: Fri, 13 Nov 2009 10:46:04 +0000 Subject: [PATCH] More fixes, to cropping BufferedImages git-svn-id: http://zxing.googlecode.com/svn/trunk@1109 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- .../zxing/multi/GenericMultipleBarcodeReader.java | 10 ++++++---- .../client/j2se/BufferedImageLuminanceSource.java | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/src/com/google/zxing/multi/GenericMultipleBarcodeReader.java b/core/src/com/google/zxing/multi/GenericMultipleBarcodeReader.java index b25a688c..87605283 100644 --- a/core/src/com/google/zxing/multi/GenericMultipleBarcodeReader.java +++ b/core/src/com/google/zxing/multi/GenericMultipleBarcodeReader.java @@ -121,21 +121,23 @@ public final class GenericMultipleBarcodeReader implements MultipleBarcodeReader // Decode left of barcode if (minX > MIN_DIMENSION_TO_RECUR) { - doDecodeMultiple(image.crop(0, 0, (int) minX, height), hints, results, 0, 0); + doDecodeMultiple(image.crop(0, 0, (int) minX, height), + hints, results, xOffset, yOffset); } // Decode above barcode if (minY > MIN_DIMENSION_TO_RECUR) { - doDecodeMultiple(image.crop(0, 0, width, (int) minY), hints, results, 0, 0); + doDecodeMultiple(image.crop(0, 0, width, (int) minY), + hints, results, xOffset, yOffset); } // Decode right of barcode if (maxX < width - MIN_DIMENSION_TO_RECUR) { doDecodeMultiple(image.crop((int) maxX, 0, width - (int) maxX, height), - hints, results, (int) maxX, 0); + hints, results, xOffset + (int) maxX, yOffset); } // Decode below barcode if (maxY < height - MIN_DIMENSION_TO_RECUR) { doDecodeMultiple(image.crop(0, (int) maxY, width, height - (int) maxY), - hints, results, 0, (int) maxY); + hints, results, xOffset, yOffset + (int) maxY); } } diff --git a/javase/src/com/google/zxing/client/j2se/BufferedImageLuminanceSource.java b/javase/src/com/google/zxing/client/j2se/BufferedImageLuminanceSource.java index d9e61a3b..e60d3e26 100644 --- a/javase/src/com/google/zxing/client/j2se/BufferedImageLuminanceSource.java +++ b/javase/src/com/google/zxing/client/j2se/BufferedImageLuminanceSource.java @@ -110,7 +110,7 @@ public final class BufferedImageLuminanceSource extends LuminanceSource { @Override public LuminanceSource crop(int left, int top, int width, int height) { - return new BufferedImageLuminanceSource(image, left, top, width, height); + return new BufferedImageLuminanceSource(image, this.left + left, this.top + top, width, height); } // Can't run AffineTransforms on images of unknown format. -- 2.20.1