Zhang-Suen thinning algorithm: Difference between revisions

Content added Content deleted
(→‎{{header|Java}}: added Java)
m (→‎{{header|Java}}: small change)
Line 819: Line 819:
=={{header|Java}}==
=={{header|Java}}==
{{works with|Java|7}}
{{works with|Java|7}}
<lang java>import java.util.*;
<lang java>import java.awt.Point;
import java.util.*;


public class ZhangSuen {
public class ZhangSuen {
Line 849: Line 850:
{0, 4, 6}}};
{0, 4, 6}}};


static List<Integer[]> toWhite = new ArrayList<>();
static List<Point> toWhite = new ArrayList<>();
static char[][] grid;
static char[][] grid;


Line 884: Line 885:
continue;
continue;


toWhite.add(new Integer[]{r, c});
toWhite.add(new Point(r, c));
hasChanged = true;
hasChanged = true;
}
}
}
}


for (Integer[] coords : toWhite)
for (Point p : toWhite)
grid[coords[0]][coords[1]] = ' ';
grid[p.x][p.y] = ' ';
toWhite.clear();
toWhite.clear();