/**
* 비트맵의 라운드 처리
* @param bitmap
* @param pixel
* @return
*/
public static Bitmap setRoundCornerBitmap(Bitmap bitmap, int pixel) {
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(output);
int color = 0xff424242;
Paint paint = new Paint();
Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
RectF rectF = new RectF(rect);
paint.setAntiAlias(true);
paint.setColor(color);
canvas.drawARGB(0, 0, 0, 0);
canvas.drawRoundRect(rectF, pixel, pixel, paint);
paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
canvas.drawBitmap(bitmap, rect, rect, paint);
return output;
}
'프로그래밍 > Android' 카테고리의 다른 글
Android ViewPager PageAdapter notifyDataSetChanged (0) | 2015.02.25 |
---|---|
Android Task Summary (0) | 2015.02.22 |
Android intent ACTION_VIEW valid url check (0) | 2015.02.17 |
Android Load More ListView (0) | 2015.02.12 |
Android ExpandableListView (0) | 2015.02.05 |
댓글