Disallow BufferedImage of type TYPE_CUSTOM -- not decoding properly, and is kind...
authorsrowen <srowen@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Mon, 3 Mar 2008 22:45:52 +0000 (22:45 +0000)
committersrowen <srowen@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Mon, 3 Mar 2008 22:45:52 +0000 (22:45 +0000)
git-svn-id: http://zxing.googlecode.com/svn/trunk@241 59b500cc-1b3d-0410-9834-0bbf25fbcc57

core/test/data/blackbox/qrcode-1/21.png [deleted file]
core/test/data/blackbox/qrcode-1/21.txt [deleted file]
javase/src/com/google/zxing/client/j2se/BufferedImageMonochromeBitmapSource.java

diff --git a/core/test/data/blackbox/qrcode-1/21.png b/core/test/data/blackbox/qrcode-1/21.png
deleted file mode 100644 (file)
index b924a35..0000000
Binary files a/core/test/data/blackbox/qrcode-1/21.png and /dev/null differ
diff --git a/core/test/data/blackbox/qrcode-1/21.txt b/core/test/data/blackbox/qrcode-1/21.txt
deleted file mode 100644 (file)
index 6bc3cf2..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-ÁRVÍZTŰRŐ TÜKÖRFÚRÓGÉP\r
-árvíztűrő tükörfúrógép
\ No newline at end of file
index 86f17fd..0196939 100644 (file)
@@ -45,6 +45,9 @@ public final class BufferedImageMonochromeBitmapSource implements MonochromeBitm
   private static final int LUMINANCE_BUCKETS = 1 << LUMINANCE_BITS;
 
   public BufferedImageMonochromeBitmapSource(BufferedImage image) {
+    if (image.getType() == BufferedImage.TYPE_CUSTOM) {
+      throw new IllegalArgumentException("Can't handle BufferedImage of type TYPE_CUSTOM");
+    }
     this.image = image;
     blackPoint = 0x7F;
     lastMethod = null;
@@ -125,9 +128,7 @@ public final class BufferedImageMonochromeBitmapSource implements MonochromeBitm
   }
 
   public boolean isRotateSupported() {
-    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
+    return true;
   }
 
   /**