Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 * This software and related documentation ("CK-Telecom Software") are
 * protected under relevant copyright laws. The information contained herein
 * is confidential and proprietary to CK-Telecom. and/or its licensors.
 * Without the prior written permission of CK-Telecom. and/or its licensors,
 * any reproduction, modification, use or disclosure of CK-Telecom Software,
 * and information contained herein, in whole or in part, shall be strictly              
 * prohibited.
 * CK-Telecom (C) 2012. All rights reserved.
 */

import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.RectF;

public class Main {
    public static Bitmap getRoundBitmap(Bitmap bmp, float roundDP) {
        //      roundDP *= Constants.screen_density;
        Bitmap bmpOut = Bitmap.createBitmap(bmp.getWidth(), bmp.getHeight(), Config.ARGB_8888);
        Canvas c = new Canvas(bmpOut);
        final Paint p = new Paint();
        final RectF rectF = new RectF(0, 0, bmp.getWidth(), bmp.getHeight());

        p.setAntiAlias(true);
        c.drawARGB(0, 0, 0, 0);
        p.setColor(Color.BLACK);
        c.drawRoundRect(rectF, roundDP, roundDP, p);
        p.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
        c.drawBitmap(bmp, 0, 0, p);
        return bmpOut;
    }
}