internal virtual bool[][] GetQRCodeMatrix(bool[][] image, SamplingGrid gridLines) { int totalWidth = gridLines.TotalWidth; this.canvas.Print("gridSize=" + (object)totalWidth); Point point = (Point)null; bool[][] flagArray = new bool[totalWidth][]; for (int index = 0; index < totalWidth; ++index) { flagArray[index] = new bool[totalWidth]; } for (int ay = 0; ay < gridLines.GetHeight(); ++ay) { for (int ax = 0; ax < gridLines.GetWidth(); ++ax) { ArrayList.Synchronized(new ArrayList(10)); for (int y1 = 0; y1 < gridLines.GetHeight(ax, ay); ++y1) { for (int x1 = 0; x1 < gridLines.GetWidth(ax, ay); ++x1) { int x2 = gridLines.GetXLine(ax, ay, x1).GetP1().X; int y2 = gridLines.GetXLine(ax, ay, x1).GetP1().Y; int x3 = gridLines.GetXLine(ax, ay, x1).GetP2().X; int y3 = gridLines.GetXLine(ax, ay, x1).GetP2().Y; int x4 = gridLines.GetYLine(ax, ay, y1).GetP1().X; int y4 = gridLines.GetYLine(ax, ay, y1).GetP1().Y; int x5 = gridLines.GetYLine(ax, ay, y1).GetP2().X; int y5 = gridLines.GetYLine(ax, ay, y1).GetP2().Y; int num1 = (y3 - y2) * (x4 - x5) - (y5 - y4) * (x2 - x3); int num2 = (x2 * y3 - x3 * y2) * (x4 - x5) - (x4 * y5 - x5 * y4) * (x2 - x3); int num3 = (x4 * y5 - x5 * y4) * (y3 - y2) - (x2 * y3 - x3 * y2) * (y5 - y4); flagArray[gridLines.GetX(ax, x1)][gridLines.GetY(ay, y1)] = image[num2 / num1][num3 / num1]; if (ay == gridLines.GetHeight() - 1 && ax == gridLines.GetWidth() - 1 && y1 == gridLines.GetHeight(ax, ay) - 1 && x1 == gridLines.GetWidth(ax, ay) - 1) { point = new Point(num2 / num1, num3 / num1); } } } } } if (point.X > image.Length - 1 || point.Y > image[0].Length - 1) { throw new IndexOutOfRangeException("Sampling grid pointed out of image"); } this.canvas.DrawPoint(point, Color_Fields.BLUE); return(flagArray); }