请帮我创建圆形角度位图创建,半径从1%到100%不等。我已经尝试过我的代码在某些密度设备中正常工作,并且在其他设备中没有100%的圆角。
final Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setShader(new BitmapShader(bitmap, Shader.TileMode.CLAMP,
Shader.TileMode.CLAMP));
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(),
Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(output);
canvas.drawRoundRect(new RectF(0, 0, output.getWidth() - margin3 - margin1,
output.getHeight() - margin3 - margin1), cornerDips, cornerDips, paint);
if (bitmap != output) {
bitmap.recycle();
}
return output;