Draft of 'thinking' visualization for barcode scanning. Works for 1D and QR codes.
[zxing.git] / core / src / com / google / zxing / qrcode / detector / AlignmentPatternFinder.java
index c1d5c5b..df158b6 100644 (file)
@@ -17,6 +17,8 @@
 package com.google.zxing.qrcode.detector;\r
 \r
 import com.google.zxing.ReaderException;\r
+import com.google.zxing.ResultPoint;\r
+import com.google.zxing.ResultPointCallback;\r
 import com.google.zxing.common.BitMatrix;\r
 \r
 import java.util.Vector;\r
@@ -45,6 +47,7 @@ final class AlignmentPatternFinder {
   private final int height;\r
   private final float moduleSize;\r
   private final int[] crossCheckStateCount;\r
+  private final ResultPointCallback resultPointCallback;\r
 \r
   /**\r
    * <p>Creates a finder that will look in a portion of the whole image.</p>\r
@@ -61,7 +64,8 @@ final class AlignmentPatternFinder {
                          int startY,\r
                          int width,\r
                          int height,\r
-                         float moduleSize) {\r
+                         float moduleSize,\r
+                         ResultPointCallback resultPointCallback) {\r
     this.image = image;\r
     this.possibleCenters = new Vector(5);\r
     this.startX = startX;\r
@@ -70,6 +74,7 @@ final class AlignmentPatternFinder {
     this.height = height;\r
     this.moduleSize = moduleSize;\r
     this.crossCheckStateCount = new int[3];\r
+    this.resultPointCallback = resultPointCallback;\r
   }\r
 \r
   /**\r
@@ -262,7 +267,11 @@ final class AlignmentPatternFinder {
         }\r
       }\r
       // Hadn't found this before; save it\r
-      possibleCenters.addElement(new AlignmentPattern(centerJ, centerI, estimatedModuleSize));\r
+      ResultPoint point = new AlignmentPattern(centerJ, centerI, estimatedModuleSize);\r
+      possibleCenters.addElement(point);\r
+      if (resultPointCallback != null) {\r
+        resultPointCallback.foundPossibleResultPoint(point);\r
+      }\r
     }\r
     return null;\r
   }\r