开发者

Different behavior in Path fill for clockwise and counterclockwise paths

开发者 https://www.devze.com 2023-04-03 02:40 出处:网络
It seems the path FILL_AND_STROKE behaves differently depen开发者_如何学Pythonding on which way I draw the path.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消