I override Android ImageView to make the corners of my image transparent. I can do this cropping the canvas in my onDraw (canvas canvas):
@Override protected void onDraw(Canvas canvas) { Path clipPath = new Path(); int w = this.getWidth(); int h = this.getHeight(); clipPath.addRoundRect(new RectF(0,0,w,h), 10.0f, 10.0f, Path.Direction.CW); canvas.clipPath(clipPath); super.onDraw(canvas); }
Unfortunately, it is not possible to smooth this round rectangle, and the result is ugly corners:

I know that I can clear parts of my canvas with anti-aliasing using Paint and PorterDuff.Mode.CLEAR , which I donβt know is to specify the round corners as the area to be erased. I am looking for something like this:
@Override protected void onDraw(Canvas canvas) {
Is there a way to "erase" not a round rectangle, but rather, that is, round corners? But what if I just want to erase one of the corners?
Pedro source share