Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to draw a transparent circle?

I'm trying to draw a transparent circle, but it just doesn't work.

when I'm drawing a bitmap it works, but a circle doesn't become transparent.

Here's my code in short:

Paint paint = new Paint();
paint.setAlpha(125);
canvas.drawBitmap(bitmap, sourceRect, destRect, paint);  // this works fine

canvas.drawCircle(x, y, radius, paint);   // the circle is drawn but not transparent
like image 478
piojo Avatar asked Oct 02 '11 17:10

piojo


People also ask

How do I make a transparent circle in Excel?

Select the shape or shapes that you want to make transparent. Right-click, and on the context menu, select Format > Fill. Set the Transparency slider to the percentage of transparency that you want.

How do I make a transparent circle in Google Slides?

Make your shape transparent by clicking on the paint can icon > Transparent, and remove the outline of the shape by going to Line Color > Transparent. Next, select your shape, right-click, insert a link, and then choose to link to another slide in the presentation.


1 Answers

I found it.

paint.setAlpha must come after paint.setColor

like image 169
piojo Avatar answered Oct 10 '22 17:10

piojo