Android examples for Graphics:Bitmap Paint
get Radius Bitmap
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.PorterDuff.Mode; import android.graphics.PorterDuffXfermode; import android.graphics.RectF; public class Main { public static Bitmap getRadiusBitmap(Bitmap bitmap) { Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setColor(0xffffffff);/*from ww w.j av a 2 s. c o m*/ Bitmap radiusBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888); Canvas canvas = new Canvas(radiusBitmap); RectF rectF = new RectF(0, 0, bitmap.getWidth(), bitmap.getHeight()); canvas.drawRoundRect(rectF, 7, 7, paint); paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN)); canvas.drawBitmap(bitmap, 0, 0, paint); if (bitmap != null && !bitmap.isRecycled()) { bitmap.recycle(); } return radiusBitmap; } }