title: Show portion of Bitmap image on canvas in Android
body: <p>I am trying to build a Magnify tool in my Android app. For this, I have an ImageView, which I converted to Bitmap (with some zoom/scale factor).</p>
  
  <pre><code>imageView.setDrawingCacheEnabled(true);
  Bitmap drawingCache = imageView.getDrawingCache(true);
  Matrix matrix = new Matrix();
  matrix.postScale(5, 5);        
  
  Bitmap viewCapture = Bitmap.createBitmap(drawingCache, 0, 0, 
                                           drawingCache.getWidth(),
                                           drawingCache.getHeight(), 
                                           matrix, true);
  imageView.setDrawingCacheEnabled(false);
  </code></pre>
  
  <p>Now, I am drawing this Bitmap image "viewCapture" to my canvas. Here, I want only portion of the image to be rendered on the canvas.</p>
  
  <p>I tried using approaches: "setRectToRect() on Matrix", "canvas.drawBitmap(bitmap, src, dst, paint)". But, didn't work out appropriately.</p>
  
  <p>Would using SurfaceViews be helpful? Has anyone come across this situation? Please post your thoughts/ideas. </p>