android - Crop images in circle shape with border around it -


i want have image in circle shape , stroke around it.

i use code crop bitmap in circle, don't know how put border/stroke around it.

    public static bitmap getcroppedbitmap(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());      paint.setantialias(true);     canvas.drawargb(0, 0, 0, 0);     paint.setcolor(color);     // canvas.drawroundrect(rectf, roundpx, roundpx, paint);     canvas.drawcircle(bitmap.getwidth() / 2, bitmap.getheight() / 2,             bitmap.getwidth() / 2, paint);     paint.setxfermode(new porterduffxfermode(mode.src_in));     canvas.drawbitmap(bitmap, rect, rect, paint);     //bitmap _bmp = bitmap.createscaledbitmap(output, 60, 60, false);     //return _bmp;     return output; } 

paint paintstroke = new paint(paint.anti_alias_flag); // create anti-aliased paint paintstroke.setstyle(paint.style.stroke);             // define paint style stroke paintstroke.setstrokewidth(1f);                       // set stroke widht 1 px paintstroke.setcolor(0xff00ff00);                     // set color canvas.drawarc(rect, 0f, 360f, true, paintstroke);    // draw arch 0 360 degrees (i. e. closed circle) 

Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -