I've seen multiple posts about drawing a hole over a bitmap, however that doesn't seem to work when trying to draw over a filled area, such as a rectangle.
For example:
- I'm drawing a background with
canvas.drawRect()
andcanvas.drawText()
- I'm drawing a red rectangle over the background with
canvas.drawPaint()
orcanvas.drawRect()
- What I'm trying to achieve: Draw a circle that will reveal the background (hole)
Any suggestions? Thanks in advance!
Similar questions: Android canvas - Draw a hole & Erase bitmap parts using PorterDuff mode however the proposed solutions do not work when trying to draw over a rectangle instead of a bitmap. (i.e. I create the background dynamically using canvas.drawRect()
, canvas.drawLines()
, etc., I do not have a static bitmap).