Hi Ratheesh Valamchuzhy,
Thanks for help.
Thanks for time.
But i have gou some error in the which you have sent to me i.e,
paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
can i know what is Mode.SRC_IN.
Thanks in advance.
Thanks
Naveen.
-- On Thu, Feb 9, 2012 at 2:06 PM, Ratheesh Valamchuzhy <androidrcn@gmail.com> wrote:
you can use the image helper class to make rounded border
package com.Skadate;import android.graphics.Bitmap;import android.graphics.Canvas;import android.graphics.Paint;import android.graphics.PorterDuffXfermode;import android.graphics.Rect;import android.graphics.RectF;import android.graphics.Bitmap.Config;import android.graphics.PorterDuff.Mode;public class ImageHelper {public static Bitmap getRoundedCornerBitmap(Bitmap bitmap, int pixels) {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 = pixels;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;}}in java filebitmap=ImageHelper.getRoundedCornerBitmap(yourbitmap);--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment