开发者

How to draw a transparent circle?

开发者 https://www.devze.com 2023-04-10 07:00 出处:网络
I\'m trying to draw a tra开发者_开发问答nsparent circle, but it just doesn\'t work. when I\'m drawing a bitmap it works, but a circle doesn\'t become transparent.

I'm trying to draw a tra开发者_开发问答nsparent 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


I found it.

paint.setAlpha must come after paint.setColor

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号