Invert clipping of addArc in android
<p>Hi i am trying to clip an image using path and i want to make a semicircular image of a square image.i wrote the code below but what happens is a magenta coloured semicircle is created with remaining part of the image in the surrounding... i don want the remaining part nor do i want magenta colour i want semi circular shaped image how do i invert this.</p>

<pre><code>    Paint p,p1;
public customUI(Context context) {
    super(context);
    // TODO Auto-generated constructor stub
    initcustombubble();
}

public void initcustombubble() {
    // TODO Auto-generated method stub
    p = new Paint();
    p1 = new Paint();
    p.setColor(Color.MAGENTA);
    p1.setColor(Color.BLACK);
}

public customUI(Context context,AttributeSet attr) {
    super(context,attr);
    // TODO Auto-generated constructor stub
    initcustombubble();
}

public customUI(Context context,AttributeSet attr , int a) {
    super(context,attr,a);
    // TODO Auto-generated constructor stub
    initcustombubble();
}

@Override
protected void onDraw(Canvas canvas) {
    // TODO Auto-generated method stub
    super.onDraw(canvas);
    int height= getHeight();
    int width = getWidth();
    canvas.drawCircle(getWidth()/2, getHeight()/2, getWidth()/2, p);
    Path pth=new Path();
    Bitmap bp = BitmapFactory.decodeResource(getResources(), R.drawable.nexus7);
    p.setAntiAlias(true);
    RectF rect2=new RectF(6,6,width-6,height-6);
    canvas.drawBitmap(bp, 0, 0, null);
    pth.addArc(rect2, 180, 180);
    canvas.drawPath(pth,p);
</code></pre>
