found the answer if anyone interested
http://www.ruibm.com/?p=184
public static Bitmap getRoundedCornerBitmap(Bitmap bitmap) {
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(),
bitmap.getHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(output);
final int color = 0xff424242;
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
final RectF rectF = new RectF(rect);
final float roundPx = 12;
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 output;
}
On Mon, Mar 22, 2010 at 3:27 PM, social hub <[email protected]> wrote:
> Hi,
>
> I am trying to find solution where I can apply round corners to an image.
>
> 1)
> I have tried to set android:background
> and in drawable
>
> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
> <item >
> <shape>
> <solid android:color="#50FFFFFF"/>
> <corners android:radius="11dp" />
> </shape>
> </item>
>
> </layer-list>
>
> but it applies to background of imageview but not to the image
>
> 2) are there any bitmap or drawables methods that will help me in creating
> a bitmap from a given bitmap with rounded corners.
>
>
> I did some google search on google as well as the developers group, nothing
> came up regarding this.
>
> Thanks in advance for your help
>
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
To unsubscribe from this group, send email to
android-developers+unsubscribegooglegroups.com or reply to this email with the
words "REMOVE ME" as the subject.