Fix typo in method "isRotate*d*Supported"; don't attempt to rotate images of unknown format

git-svn-id: https://zxing.googlecode.com/svn/trunk@238 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2008-03-03 21:36:03 +00:00
parent 7c475c5cad
commit 905b1f7676
5 changed files with 8 additions and 6 deletions

View file

@ -118,7 +118,7 @@ final class YUVMonochromeBitmapSource implements MonochromeBitmapSource {
throw new IllegalStateException("Rotate not supported"); throw new IllegalStateException("Rotate not supported");
} }
public boolean isRotatedSupported() { public boolean isRotateSupported() {
return false; return false;
} }

View file

@ -93,6 +93,6 @@ public interface MonochromeBitmapSource {
* @return true iff rotation is supported * @return true iff rotation is supported
* @see #rotateCounterClockwise() * @see #rotateCounterClockwise()
*/ */
boolean isRotatedSupported(); boolean isRotateSupported();
} }

View file

@ -43,7 +43,7 @@ public abstract class AbstractOneDReader implements OneDReader {
try { try {
return doDecode(image, hints, tryHarder); return doDecode(image, hints, tryHarder);
} catch (ReaderException re) { } catch (ReaderException re) {
if (tryHarder && image.isRotatedSupported()) { if (tryHarder && image.isRotateSupported()) {
MonochromeBitmapSource rotatedImage = image.rotateCounterClockwise(); MonochromeBitmapSource rotatedImage = image.rotateCounterClockwise();
return doDecode(rotatedImage, hints, tryHarder); return doDecode(rotatedImage, hints, tryHarder);
} else { } else {

View file

@ -112,7 +112,7 @@ public final class LCDUIImageMonochromeBitmapSource implements MonochromeBitmapS
throw new IllegalStateException("Rotate not supported"); throw new IllegalStateException("Rotate not supported");
} }
public boolean isRotatedSupported() { public boolean isRotateSupported() {
return false; return false;
} }

View file

@ -124,8 +124,10 @@ public final class BufferedImageMonochromeBitmapSource implements MonochromeBitm
return new BufferedImageMonochromeBitmapSource(rotatedImage); return new BufferedImageMonochromeBitmapSource(rotatedImage);
} }
public boolean isRotatedSupported() { public boolean isRotateSupported() {
return true; return image.getType() != BufferedImage.TYPE_CUSTOM;
// Not sure what to make of the situation where a BufferedImage is parsed, but its format is not known
// In any event an AffineTransformOp on it will fail, so say it's not supported
} }
/** /**