-
当我们需要将Bitmap图片设置任意角为圆角时可以使用drawRoundRect(reaf,x,y,reaf)函数来设置
-
任意圆角
/***
* Parameters
* rectf The rectangular bounds of the roundRect to be drawn
* rx The x-radius of the oval used to round the corners
* ry The y-radius of the oval used to round the corners
* x,y方向上的圆角半径,个人设置200比较好
* paint The paint used to draw the roundRect
*/
public Bitmap bimapRound(Bitmap mBitmap,float index){
Bitmap bitmap = Bitmap.createBitmap(mBitmap.getWidth(), mBitmap.getHeight(), Bitmap.Config.ARGB_4444);
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint();
paint.setAntiAlias(true);
//设置矩形大小
Rect rect = new Rect(0,0,mBitmap.getWidth(),mBitmap.getHeight());
RectF rectf = new RectF(rect);
// 相当于清屏
canvas.drawARGB(0, 0, 0, 0);
//画圆角
/***
* Parameters
*