public Bitmap takeBite(Bitmap bitmap,float cx,float cy,float radius,int rotationDegrees){
  Canvas c=new Canvas(bitmap);
  Paint paint=new Paint();
  paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
  RectF bounds=new RectF(cx - radius,cy - radius,cx + radius,cy + radius);
  rectF.set(bounds);
  c.drawArc(rectF,rotationDegrees,360,true,paint);
  int numTeeth=9;
  int angleSlice=180 / numTeeth;
  for (int i=0; i < numTeeth; i++) {
    int angleStart=(angleSlice * i) + rotationDegrees;
    double angleStartRadian=angleStart * Math.PI / 180;
    float xStart=(float)(cx + radius * Math.cos(angleStartRadian));
    float yStart=(float)(cy + radius * Math.sin(angleStartRadian));
    int angleEnd=(angleSlice * (i + 1)) + rotationDegrees;
    double angleEndRadian=angleEnd * Math.PI / 180;
    float xEnd=(float)(cx + radius * Math.cos(angleEndRadian));
    float yEnd=(float)(cy + radius * Math.sin(angleEndRadian));
    float circleCenterX=DrawUtils.getPointBetweenTwoPoints(xStart,xEnd,0.5);
    float circleCenterY=DrawUtils.getPointBetweenTwoPoints(yStart,yEnd,0.5);
    double circumference=DrawUtils.getDistanceBetweenTwoPoints(xStart,yStart,xEnd,yEnd);
    int num=i + 1;
    if (num > (numTeeth / 2) + 0.5) {
      if (num == 6)       num-=2;
      if (num == 7)       num-=4;
      if (num == 8)       num-=6;
      if (num == 9)       num-=8;
    }
    double angleOfSmallSemiCircle=((180 / numTeeth) * num) - 10;
    float radiusSmall=(float)(circumference / 2);
    RectF bounds2=new RectF(circleCenterX - radiusSmall,circleCenterY - radiusSmall,circleCenterX + radiusSmall,circleCenterY + radiusSmall);
    RectF rectTooth=new RectF();
    rectTooth.set(bounds2);
    int baseSmallCircleAngleStart=rotationDegrees - 90;
    if (i > numTeeth / 2) {
      angleOfSmallSemiCircle=90 + (90 - angleOfSmallSemiCircle);
    }
    float startAngle=(float)(baseSmallCircleAngleStart + angleOfSmallSemiCircle);
    c.drawArc(rectTooth,(float)startAngle,180,true,paint);
  }
  return bitmap;
}

public Bitmap takeBite ( Bitmap bitmap , float cx , float cy , float radius , int rotationDegrees ) { Canvas c = new Canvas ( bitmap ) ; Paint paint = new Paint ( ) ; paint . setXfermode ( new PorterDuffXfermode ( PorterDuff . Mode . CLEAR ) ) ; RectF bounds = new RectF ( cx - radius , cy - radius , cx + radius , cy + radius ) ; rectF . set ( bounds ) ; c . drawArc ( rectF , rotationDegrees , 360 , true , paint ) ; int numTeeth = 9 ; int angleSlice = 180 / numTeeth ; for ( int i = 0 ; i < numTeeth ; i ++ ) { int angleStart = ( angleSlice * i ) + rotationDegrees ; double angleStartRadian = angleStart * Math . PI / 180 ; float xStart = ( float ) ( cx + radius * Math . cos ( angleStartRadian ) ) ; float yStart = ( float ) ( cy + radius * Math . sin ( angleStartRadian ) ) ; int angleEnd = ( angleSlice * ( i + 1 ) ) + rotationDegrees ; double angleEndRadian = angleEnd * Math . PI / 180 ; float xEnd = ( float ) ( cx + radius * Math . cos ( angleEndRadian ) ) ; float yEnd = ( float ) ( cy + radius * Math . sin ( angleEndRadian ) ) ; float circleCenterX = DrawUtils . getPointBetweenTwoPoints ( xStart , xEnd , 0.5 ) ; float circleCenterY = DrawUtils . getPointBetweenTwoPoints ( yStart , yEnd , 0.5 ) ; double circumference = DrawUtils . getDistanceBetweenTwoPoints ( xStart , yStart , xEnd , yEnd ) ; int num = i + 1 ; if ( num > ( numTeeth / 2 ) + 0.5 ) { if ( num == 6 ) num -= 2 ; if ( num == 7 ) num -= 4 ; if ( num == 8 ) num -= 6 ; if ( num == 9 ) num -= 8 ; } double angleOfSmallSemiCircle = ( ( 180 / numTeeth ) * num ) - 10 ; float radiusSmall = ( float ) ( circumference / 2 ) ; RectF bounds2 = new RectF ( circleCenterX - radiusSmall , circleCenterY - radiusSmall , circleCenterX + radiusSmall , circleCenterY + radiusSmall ) ; RectF rectTooth = new RectF ( ) ; rectTooth . set ( bounds2 ) ; int baseSmallCircleAngleStart = rotationDegrees - 90 ; if ( i > numTeeth / 2 ) { angleOfSmallSemiCircle = 90 + ( 90 - angleOfSmallSemiCircle ) ; } float startAngle = ( float ) ( baseSmallCircleAngleStart + angleOfSmallSemiCircle ) ; c . drawArc ( rectTooth , ( float ) startAngle , 180 , true , paint ) ; } return bitmap ; }
take a bite out of the bitmap by painting over it with a teeth shaped mark , nom !
