Canvas.clipPath(Path) not clipping as expected Canvas.clipPath(Path) not clipping as expected android android

Canvas.clipPath(Path) not clipping as expected


Are you using HC or above or otherwise using hardware acceleration?

If so, clipPath is unsupported and problematic.

developer.android.com/guide/topics/graphics/hardware-accel.html.


OP's question is specifically about using a clipping region and has been answered by @Simon. Bear in mind, however, that there's a more straightforward way of drawing a filled arc:

Create a Paint:

mPaint = new Paint();mPaint.setColor(Color.BLUE);mPaint.setStyle(Style.FILL);mPaint.setAntiAlias(true);

When drawing, simply draw the path:

canvas.drawPath(path, mPaint);