private void drawBitmapWithStroke(Canvas canvas,Bitmap bitmap,int centerX,int centerY,float radius,Paint drawPaint){
  drawPaint.setStyle(Paint.Style.FILL);
  float strokeRadius=radius + mRadiusStrokeWidth;
  drawPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
  canvas.drawCircle(centerX,centerY,strokeRadius,drawPaint);
  drawPaint.setXfermode(null);
  final int halfBitmapWidth=bitmap.getWidth() / 2;
  final int halfBitmapHeight=bitmap.getHeight() / 2;
  BitmapShader bitmapShader=new BitmapShader(bitmap,Shader.TileMode.REPEAT,Shader.TileMode.REPEAT);
  Matrix shaderMatrix=new Matrix();
  float minSize=bitmap.getWidth() > bitmap.getHeight() ? bitmap.getHeight() : bitmap.getWidth();
  float scale=radius * 2 / minSize;
  shaderMatrix.setScale(scale,scale);
  shaderMatrix.postTranslate(centerX - (halfBitmapWidth * scale),centerY - (halfBitmapHeight * scale));
  bitmapShader.setLocalMatrix(shaderMatrix);
  drawPaint.setShader(bitmapShader);
  canvas.drawCircle(centerX,centerY,radius,drawPaint);
  drawPaint.setShader(null);
}

private void drawBitmapWithStroke ( Canvas canvas , Bitmap bitmap , int centerX , int centerY , float radius , Paint drawPaint ) { drawPaint . setStyle ( Paint . Style . FILL ) ; float strokeRadius = radius + mRadiusStrokeWidth ; drawPaint . setXfermode ( new PorterDuffXfermode ( PorterDuff . Mode . CLEAR ) ) ; canvas . drawCircle ( centerX , centerY , strokeRadius , drawPaint ) ; drawPaint . setXfermode ( null ) ; final int halfBitmapWidth = bitmap . getWidth ( ) / 2 ; final int halfBitmapHeight = bitmap . getHeight ( ) / 2 ; BitmapShader bitmapShader = new BitmapShader ( bitmap , Shader . TileMode . REPEAT , Shader . TileMode . REPEAT ) ; Matrix shaderMatrix = new Matrix ( ) ; float minSize = bitmap . getWidth ( ) > bitmap . getHeight ( ) ? bitmap . getHeight ( ) : bitmap . getWidth ( ) ; float scale = radius * 2 / minSize ; shaderMatrix . setScale ( scale , scale ) ; shaderMatrix . postTranslate ( centerX - ( halfBitmapWidth * scale ) , centerY - ( halfBitmapHeight * scale ) ) ; bitmapShader . setLocalMatrix ( shaderMatrix ) ; drawPaint . setShader ( bitmapShader ) ; canvas . drawCircle ( centerX , centerY , radius , drawPaint ) ; drawPaint . setShader ( null ) ; }
draw single bitmap with the giving centerx , centery and radius
