我有一个圆形图像,我想为圆形图像应用动画,这样它应该慢慢转换成更大尺寸的圆角图像。我尝试将圆形图像转换为圆角,但无法编写类似动画的效果。
这使我将图像转换为圆角矩形,但我想要这种性能的动画。我的动画应该慢慢地将我的圆形图像转换为带圆角的矩形,并且尺寸也会增加
public Bitmap getRoundedRectBitmap(Bitmap bitmap, int pixels)
{
result = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
canvas = new Canvas(result);
color = 0xff424242;
paint = new Paint();
rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
rectF = new RectF(rect);
roundPx = pixels;
paint.setAntiAlias(true);
canvas.drawARGB(0, 0, 0, 0);
paint.setColor(color);
canvas.drawRoundRect(rectF, roundPx, roundPx, paint);
paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
canvas.drawBitmap(bitmap, rect, rect, paint);
return result;
}