/** * 根据原图和变长绘制圆形图片 * wyn* @param source * @param min * @return */ private static Bitmap createCircleImage(Bitmap source, int min) { Paint paint = new Paint(); paint.setAntiAlias(true); Bitmap target = Bitmap.createBitmap(min, min, Bitmap.Config.ARGB_8888); /** * 产生一个同样大小的画布 */ Canvas canvas = new Canvas(target); /** * 首先绘制圆形 */ canvas.drawCircle(min / 2, min / 2, min / 2, paint); /** * 使用SRC_IN */ paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN)); /** * 绘制图片 */ canvas.drawBitmap(source, 0, 0, paint); /***绘制圆形 *//*paint.setStyle(Paint.Style.STROKE);paint.setStrokeWidth(6);paint.setColor(Color.GRAY);canvas.drawCircle(min / 2, min / 2, min / 2, paint);*/return target; }