/**
* 两张图片合成一张图片圆角的图片 . <br>
* @author liulongzhenhai 2013-10-28 上午11:24:15 <br>
* @param outBitmap1 背景图片
* @param bitmap 要生成圆角的图片
* @return Bitmap Bitmap
*/
public static Bitmap getRoundedCornerBitmap(final Bitmap outBitmap1, final Bitmap bitmap) {
final int sm = 0;
// Log.w("outHeight",outBitmap.getHeight()+","+outBitmap.getWidth());
final Bitmap outBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888);
final Canvas canvas = new Canvas(outBitmap);
final int color = 0xff424242;
final Paint paint = new Paint();
final Rect rect = new Rect(sm, sm, bitmap.getWidth() - sm, bitmap.getHeight() - sm);
final RectF rectF = new RectF(rect);
final float roundPX = bitmap.getWidth() / 2;
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 outBitmap;
}
BitmapUtil.java 文件源码
java
阅读 41
收藏 0
点赞 0
评论 0
项目:AppCommonFrame
作者:
评论列表
文章目录