I have looked into using the EVEN-ODD Winding rule in order to create holes in an area. The thing is on the forum all I could come up with was a Path2D.Double() appending a hole within itself. I want to create a whole in an already existing Path2D much like the Area class has the Area.subtract(new Shape()); does. I am desperate. I know Path2D has the ability to improve the performance of my game.
Path2D.Double d = new Path2D.Double(Path2D.WIND_EVEN_ODD);// this is a much larger circle which I will be using to subtract from the tile...
d.append(current_draw_area.createTransformedArea(mouse_point), false);//Note that this is an area without a winding rule...
Path2D.Double shape= new Path2D.Double();//this is actually a empty tile which is simply a rectangle, but will eventually have something in it to subtract from...
shape.append(d, false);
Note: Output should be either an empty square because the much larger circle covers the tile completely or a tile that has the result of the intersection of the circle and existing tile shape removed leaving what was left of the tile...
Research Link StackOverflow Thread
EDIT:
for (int i = 0; i < paint_textures.size(); i++) {
if (!current_paint.equals(paint_textures.get(i))) {
paint_regions.get(paint_textures.get(i)).subtract(new Area(current_draw_area.createTransformedArea(mouse_point)));
for (int y = adjY - 100; y < adjY + current_draw_area.getBounds().height + 100; y += 100) {
for (int x = adjX - 100; x < adjX + current_draw_area.getBounds().width + 100; x += 100) {
try {
if (paint_tiles.get(paint_textures.get(i)).get(new Point(x, y)).intersects(new Rectangle(x, y, 100, 100))) {
Area a = (Area) paint_regions.get(paint_textures.get(i)).clone();
a.intersect(new Area(new Rectangle(x, y, 100, 100)));
Path2D.Double d = new Path2D.Double(a.getPathIterator(null).getWindingRule());
d.append(a.getPathIterator(null), false);//This Causes painting to be Jumpy...
paint_tiles.get(paint_textures.get(i)).replace(new Point(x, y), d);
}
} catch (NullPointerException e) {
}
}
}
}
}