title: Draw bitmap on current clip in canvas with border (Paint)
body: <p>I'm learning Android by writing a game and have a problem with the graphics API. </p>
  
  <p>I want to draw an image into shape of a Path and then add border on the Path. I was able to clip the image with Path but can't find a way to add border on it. I though it would be simple because the API supports Paint object on Canvas.draw* methods. </p>
  
  <p><strong>Update</strong></p>
  
  <p>In original question, my Path contains two rectangles and @christopher-souvey answered correctly. However, I get another problem when dealing with adding one more clipPath() method.</p>
  
  <p>I updated previous code by adding one more circle into Path. Here is my new code:</p>
  
  <pre><code>Bitmap srcImage = BitmapFactory.decodeStream(getAssets().open("panda.jpg"));
  Bitmap bitmapResult = Bitmap.createBitmap(srcImage.getWidth(), srcImage.getHeight(), Bitmap.Config.ARGB_8888);
  Path path = new Path();
  
  // This is my border
  Paint paint = new Paint();
  paint.setStyle(Style.STROKE);
  paint.setColor(Color.RED);
  paint.setStrokeWidth(2);
  paint.setAntiAlias(true);
  
  Canvas canvas = new Canvas(bitmapResult);
  
  // Overlay two rectangles
  path.addRect(10, 10, 70, 70, Path.Direction.CCW); 
  path.addRect(40, 40, 120, 120, Path.Direction.CCW);
  canvas.drawPath(path , paint);
  canvas.clipPath(path, Region.Op.INTERSECT);
  
  path.reset();
  path.addCircle(40, 80, 20, Path.Direction.CCW); 
  canvas.drawPath(path , paint);
  canvas.clipPath(path, Region.Op.DIFFERENCE);
  
  // The image is drawn within the area of two rectangles and a circle
  // Although I suppose that puting Paint object into drawBitmap() method will add a red border on result image but it doesn't work
  canvas.drawBitmap(srcImage, 0, 0, paint);
  
  ((ImageView)this.findViewById(R.id.imageView1)).setImageBitmap(bitmapResult);
  </code></pre>
  
  <p>Here is the result from my code: <a href="http://i.stack.imgur.com/8j2Kg.png">http://i.stack.imgur.com/8j2Kg.png</a></p>
  
  <p>And this is what I expect: <a href="http://i.stack.imgur.com/iKhIr.png">http://i.stack.imgur.com/iKhIr.png</a></p>
  
  <p>Do I miss anything to make it work ?</p>