I am drawing a filled polygon on a canvas in android.
canvas.drawPath(path,myPaint);
Now I want to do exactly the opposite: Fill the area outside of the polygon.
how can I tell the paint to fill the outer region - the region which is not covered by the polygon?
simply use
path.setFillType(FillType.INVERSE_EVEN_ODD);
This can be complicated or very simple.
The complicated way:
Create a path exactly like your polygon, except don't close it. The continue that path to the nearest wall. Draw around the walls. Close and fill. In code, this isn't too fun.
The simple way:
Color the canvas. Draw the polygon.
Good luck.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With