mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Undo earlier change that rejects TYPE_CUSTOM -- too many images parse this way, and we can still decode them in some cases. Still can't rotate them.
git-svn-id: https://zxing.googlecode.com/svn/trunk@258 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
8c03ed9301
commit
8108ac42eb
|
@ -45,9 +45,6 @@ public final class BufferedImageMonochromeBitmapSource implements MonochromeBitm
|
||||||
private static final int LUMINANCE_BUCKETS = 1 << LUMINANCE_BITS;
|
private static final int LUMINANCE_BUCKETS = 1 << LUMINANCE_BITS;
|
||||||
|
|
||||||
public BufferedImageMonochromeBitmapSource(BufferedImage image) {
|
public BufferedImageMonochromeBitmapSource(BufferedImage image) {
|
||||||
if (image.getType() == BufferedImage.TYPE_CUSTOM) {
|
|
||||||
throw new IllegalArgumentException("Can't handle BufferedImage of type TYPE_CUSTOM");
|
|
||||||
}
|
|
||||||
this.image = image;
|
this.image = image;
|
||||||
blackPoint = 0x7F;
|
blackPoint = 0x7F;
|
||||||
lastMethod = null;
|
lastMethod = null;
|
||||||
|
@ -119,6 +116,9 @@ public final class BufferedImageMonochromeBitmapSource implements MonochromeBitm
|
||||||
}
|
}
|
||||||
|
|
||||||
public MonochromeBitmapSource rotateCounterClockwise() {
|
public MonochromeBitmapSource rotateCounterClockwise() {
|
||||||
|
if (!isRotateSupported()) {
|
||||||
|
throw new IllegalStateException("Rotate not supported");
|
||||||
|
}
|
||||||
// 90 degrees counterclockwise:
|
// 90 degrees counterclockwise:
|
||||||
AffineTransform transform = new AffineTransform(0.0, -1.0, 1.0, 0.0, 0.0, image.getHeight());
|
AffineTransform transform = new AffineTransform(0.0, -1.0, 1.0, 0.0, 0.0, image.getHeight());
|
||||||
BufferedImageOp op = new AffineTransformOp(transform, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
|
BufferedImageOp op = new AffineTransformOp(transform, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
|
||||||
|
@ -128,7 +128,8 @@ public final class BufferedImageMonochromeBitmapSource implements MonochromeBitm
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRotateSupported() {
|
public boolean isRotateSupported() {
|
||||||
return true;
|
// Can't run AffineTransforms on images of unknown format
|
||||||
|
return image.getType() != BufferedImage.TYPE_CUSTOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue