Search code examples
androidpathfill

Different behavior in Path fill for clockwise and counterclockwise paths


It seems the path FILL_AND_STROKE behaves differently depending on which way I draw the path.

How can I make these fill completely? First one is clockwise, second is counterclockwise.

image


Solution

  • 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);