Undo earlier change that rejects TYPE_CUSTOM -- too many images parse this way, and...
[zxing.git] / javase / src / com / google / zxing / client / j2se / BufferedImageMonochromeBitmapSource.java
index 92174bb..5030d7b 100644 (file)
@@ -116,6 +116,9 @@ public final class BufferedImageMonochromeBitmapSource implements MonochromeBitm
   }
 
   public MonochromeBitmapSource rotateCounterClockwise() {
+    if (!isRotateSupported()) {
+      throw new IllegalStateException("Rotate not supported");
+    }
     // 90 degrees counterclockwise:
     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);
@@ -124,8 +127,9 @@ public final class BufferedImageMonochromeBitmapSource implements MonochromeBitm
     return new BufferedImageMonochromeBitmapSource(rotatedImage);
   }
 
-  public boolean isRotatedSupported() {
-    return true;
+  public boolean isRotateSupported() {
+    // Can't run AffineTransforms on images of unknown format
+    return image.getType() != BufferedImage.TYPE_CUSTOM;
   }
 
   /**