MapLayer diff = new MapLayer(rect);
MapLayer diff = new MapLayer(r);
    public MapLayer createDiff(MapLayer ml) {		        if(ml == null)            return null;        Rectangle rect = new Rectangle();        boolean start=false;        for (int i = yOffset; i < heightInTiles + yOffset; i++) {            for (int j = xOffset; j < widthInTiles + xOffset; j++) {                if (ml.getTileAt(j, i) != getTileAt(j, i)) {                    if (start) {                        rect.width = Math.abs(j - rect.x);                        rect.height = Math.abs(i - rect.y);		                    } else {                        start = true;                        rect.x = j;                        rect.y = i;                    }                }            }        }        MapLayer diff = new MapLayer(rect);        diff.copyFrom(ml);		        return diff;    }