我希望在黑色矩形内绘制透明圆圈,并且圆圈部分重叠。我成功地通过使用PorterDuffXfermode(Mode.SRC_OUT)从黑色矩形中裁剪出两个透明圆圈,但现在我想在边缘上添加径向渐变(从透明到黑色) 有人能告诉我怎么做吗?请注意,这不仅仅是一个圆圈。我至少有两个圆圈重叠
非常感谢!我的代码的作用:https://www.dropbox.com/s/xbr2abgb4esorrj/img1.jpg?dl=0
我想要的是什么:https://www.dropbox.com/s/7ihsz77ukbsj1wf/img2.jpg?dl=0
Bitmap bitmap = Bitmap.createBitmap(mDimension, mDimension, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
canvas.setMatrix(matrix);
Paint paint = new Paint();
paint.setColor(Color.BLACK);
paint.setAlpha(200);
paint.setColorFilter(createDimFilter());
canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), paint);
for (Point p : mPoints) {
Paint transparentPaint = new Paint();
transparentPaint.setColor(Color.TRANSPARENT);
transparentPaint.setXfermode(new PorterDuffXfermode(Mode.SRC_OUT));
transparentPaint.setAntiAlias(true);
canvas.drawCircle((float) p.x, (float) p.y, radius, transparentPaint);//
transparentPaint.setXfermode(null);
}