Using spaces to show unused area in shape.

This commit is contained in:
Rob Greene 2018-06-18 20:47:51 -05:00
parent 37683e1852
commit 55434b6f53

View File

@ -113,12 +113,16 @@ public class TextShapeExporter implements ShapeExporter {
private void drawRowLine(PrintWriter pw, BitmapShape bshape, int width, int y) { private void drawRowLine(PrintWriter pw, BitmapShape bshape, int width, int y) {
List<Boolean> row = bshape.grid.size() > y ? bshape.grid.get(y) : new ArrayList<>(); List<Boolean> row = bshape.grid.size() > y ? bshape.grid.get(y) : new ArrayList<>();
for (int x=0; x<width; x++) { for (int x=0; x<width; x++) {
Boolean plot = row.size() > x ? row.get(x) : Boolean.FALSE; if (row.size() > x) {
Boolean plot = row.get(x);
if (bshape.origin.x == x && bshape.origin.y == y) { if (bshape.origin.x == x && bshape.origin.y == y) {
pw.printf("%c", plot ? '*' : '+'); pw.printf("%c", plot ? '*' : '+');
} else { } else {
pw.printf("%c", plot ? 'X' : '.'); pw.printf("%c", plot ? 'X' : '.');
} }
} else {
pw.print(" ");
}
} }
} }