I have created a custom shape, essentially it is a collection of four Arc2D objects.
When these arcs are drawn they form what could be considered a four point rounded star shape, kind of like a clover. Where one arc ends, the other begins. They form a square in the center. So imagine, taking a square and drawing half circles on every side.
I can draw this shape to a Graphics2D object, but when I fill it, it will only fill the arcs and not the center square. Filling this internal square is my problem.
I have implemented the getPathIterator()
method, below. I have implemented the contains()
methods as well. But it will still only fill the arcs.
I tried to add a Rectangle
. When filling the shape, the rectangle/square would be filled properly, however it draws the rectangle as well, which obviously should be expected, but definitely not the desired result.
So, does anyone have any ideas on how to "fill" such a shape?
public PathIterator getPathIterator(AffineTransform at) {
GeneralPath gp = new GeneralPath
for (Arc2D arcs : this.arcs) {
gp.append(arc, false);
}
return gp.getPathIterator(at);
}
Arc2D
instances? – Flax