Android Utililty Methods Bitmap Corner Round

List of utility methods to do Bitmap Corner Round

Description

The list of methods to do Bitmap Corner Round are organized into topic(s).

Method

BitmapDrawabletoRoundCorner( BitmapDrawable bitmapDrawable, int pixels)
to Round Corner
Bitmap bitmap = bitmapDrawable.getBitmap();
bitmapDrawable = new BitmapDrawable(toRoundCorner(bitmap, pixels));
return bitmapDrawable;
BitmapgetRoundedCornerBitmap(Bitmap bitmap, float roundPx)
get Rounded Corner Bitmap
int w = bitmap.getWidth();
int h = bitmap.getHeight();
Bitmap output = Bitmap.createBitmap(w, h, Config.ARGB_8888);
Canvas canvas = new Canvas(output);
final int color = 0xff424242;
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, w, h);
final RectF rectF = new RectF(rect);
...
BitmapgetRoundedCornerBitmap(Bitmap bitmap, int maxHeight, int pixels)
get Rounded Corner Bitmap
if (bitmap == null)
    return bitmap;
maxHeight = (int) (getApplicationContext().getResources()
        .getDisplayMetrics().density * maxHeight);
float scale = bitmap.getHeight() * 1.0f / maxHeight;
int newWidth = (int) (bitmap.getWidth() / scale);
Bitmap output = Bitmap.createBitmap(newWidth, maxHeight,
        Bitmap.Config.ARGB_8888);
...
BitmapgetRoundedRectBitmap(Bitmap bitmap, int pixels)
get Rounded Rect Bitmap
Bitmap result = null;
try {
    result = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(result);
    int color = 0xFF33B5E5;
    Paint paint = new Paint();
    Rect rect = new Rect(0, 0, 98, 98);
    paint.setAntiAlias(true);
...
BitmaptoRoundBitmap(Bitmap bitmap)
to Round Bitmap
if (bitmap == null) {
    return null;
int width = bitmap.getWidth();
int height = bitmap.getHeight();
float roundPx;
float left, top, right, bottom, dst_left, dst_top, dst_right, dst_bottom;
if (width <= height) {
...
BitmaptoRoundBitmap(Bitmap bitmap)
to Round Bitmap
if (bitmap == null) {
    return null;
int width = bitmap.getWidth();
int height = bitmap.getHeight();
float roundPx;
float left, top, right, bottom, dst_left, dst_top, dst_right, dst_bottom;
if (width <= height) {
...
BitmapgetCircleBitmap(Uri uri, Context context)
get Circle Bitmap
Bitmap bm = null;
try {
    bm = MediaStore.Images.Media.getBitmap(
            context.getContentResolver(), uri);
    Bitmap resized = Bitmap.createScaledBitmap(bm, 104, 104, true);
    Bitmap conv_bm = getRoundedRectBitmap(resized, 100);
    return conv_bm;
} catch (IOException e) {
...