Different behavior in Path fill for clockwise and counterclockwise paths
It seems the path FILL_AND_STROKE behaves differently depen开发者_如何学Pythonding on which way I draw the path.
How can I make these fill completely? First one is clockwise, second is counterclockwise.
image
Easy hack to make it work: instead of FILL_AND_STROKE, draw it twice using FILL first and then STROKE:
canvas.drawPath(mPath, paintFill);
canvas.drawPath(mPath, paintStroke);
Thanks for the hint. If there is just a single path then FILL_AND_STROKE works fine, but when adding additional paths to it then the direction matters. I've had the same problem and managed to solve it by using
Direction.CCW
when adding an additional shape to the path.
Also this is combined with
path.setFillType(FillType.EVEN_ODD)
so that one can create a "hole" in another path.
精彩评论