for (int i = 0; i <= bounds.height; i++) { for (int j = 0; j <= bounds.width; j++) { if (shape.contains(j, i)) { ((TileLayer)ml).setTileAt(j + centerx, i + centery, paintTile); } }
for(int l=0;l<numLayers;l++) { TileLayer tl = (TileLayer) mp.getLayer(initLayer - l); if(tl != null) { for (int i = 0; i <= bounds.height; i++) { for (int j = 0; j <= bounds.width; j++) { if (shape.contains(j, i)) { tl.setTileAt(j + centerx, i + centery, paintTile); } } } }
    public Rectangle commitPaint(MultilayerPlane mp, int x, int y, int start) {        Rectangle bounds = shape.getBounds();        int centerx = (int)(x - (bounds.width / 2));        int centery = (int)(y - (bounds.height / 2));        MapLayer ml = mp.getLayer(start);        // TODO: This loop does not take all edges into account        for (int i = 0; i <= bounds.height; i++) {            for (int j = 0; j <= bounds.width; j++) {                if (shape.contains(j, i)) {                    ((TileLayer)ml).setTileAt(j + centerx, i + centery, paintTile);                }            }        }        // Return affected area        return new Rectangle(centerx, centery, bounds.width, bounds.height);    }