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 86f17fd..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);
@@ -125,9 +128,8 @@ public final class BufferedImageMonochromeBitmapSource implements MonochromeBitm
   }
 
   public boolean isRotateSupported() {
+    // Can't run AffineTransforms on images of unknown format
     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
   }
 
   /**