Add BIZCARD support and a little refactoring
[zxing.git] / core / src / com / google / zxing / MonochromeBitmapSource.java
index 799a6e1..8dda19e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Google Inc.
+ * Copyright 2007 ZXing authors
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -58,6 +58,24 @@ public interface MonochromeBitmapSource {
    */
   int getWidth();
 
+  /**
+   * Retrieves the luminance at the pixel x,y in the bitmap. This method is only used for estimating
+   * the black point and implementing getBlackRow() - it is not meant for decoding.
+   *
+   * @param x The x coordinate in the image.
+   * @param y The y coordinate in the image.
+   * @return The luminance value between 0 and 255.
+   */
+  int getLuminance(int x, int y);
+
+  /**
+   * Some implementations can be much more efficient by fetching an entire row of luminance data at
+   * a time. This method should be called once per row before calling getLuminance().
+   *
+   * @param y The row to cache.
+   */
+  void cacheRowForLuminance(int y);
+
   /**
    * <p>Estimates black point according to the given method, which is optionally parameterized by
    * a single int argument. For {@link BlackPointEstimationMethod#ROW_SAMPLING}, this
@@ -69,7 +87,7 @@ public interface MonochromeBitmapSource {
    * @param method black point estimation method
    * @param argument method-specific argument
    */
-  void estimateBlackPoint(BlackPointEstimationMethod method, int argument);
+  void estimateBlackPoint(BlackPointEstimationMethod method, int argument) throws ReaderException;
 
   /**
    * @return {@link BlackPointEstimationMethod} representing last sampling method used
@@ -85,7 +103,7 @@ public interface MonochromeBitmapSource {
    * of this class which are only used in resource-constrained mobile environments
    * don't have a need to implement this.</p>
    *
-   * @throws IllegalStateException if not supported
+   * @throws IllegalArgumentException if not supported
    */
   MonochromeBitmapSource rotateCounterClockwise();
 
@@ -93,6 +111,6 @@ public interface MonochromeBitmapSource {
    * @return true iff rotation is supported
    * @see #rotateCounterClockwise()
    */
-  boolean isRotatedSupported();
+  boolean isRotateSupported();
 
 }