title: Zoom Camera2 Preview using TextureView
body: <p>i have a Problem with my Preview Zoom for the Camera2 API. I am using a TextureView.</p>
  
  <p>I want to zoom only the preview Stream that was showed in the TextureView. </p>
  
  <p>I want to zoom the Area where i use the Zoom Gesture.</p>
  
  <p>I use the SimpleOnScaleGestureListener!</p>
  
  <p>I added following Code. The zoomingFactor and the x and y Position are right.</p>
  
  <pre><code> private void updateTextureViewSize(float xPosi,float yPosi, float scale){
          float scaleX = 1.0f;
          float scaleY = 1.0f;
  
  
  
  
          float mVideoWidth = mCamcontrol.getmPreviewSize().getWidth();
          float mVideoHeight = mCamcontrol.getmPreviewSize().getHeight();
  
          int rotation = getWindowManager().getDefaultDisplay().getRotation();
          RectF viewRect = new RectF(0, 0, 1440, 2560);
          RectF bufferRect = new RectF(0, 0, mVideoHeight, mVideoWidth);
  
          bufferRect.offset(xPosi - bufferRect.centerX(), yPosi -    bufferRect.centerY());
  
           //16:9 faktor
          scaleX = ((mScale * scale) / 9f) * 16f;
          scaleY = ((mScale * scale) / 16f) * 9f;
  
          Matrix matrix = new Matrix();
  
          matrix.setRectToRect(bufferRect, viewRect, Matrix.ScaleToFit.FILL);
          scalefactorView.setText(String.valueOf(xPosi) + "  " + String.valueOf(yPosi));
  
          matrix.setScale(scaleY, scaleX, xPosi, yPosi);
          matrix.postRotate(90 * (rotation - 2), xPosi, yPosi);
  
          mTextureView.setTransform(matrix);
  
  
  }
  </code></pre>
  
  <p>Zooming is Right, but not the Position where i Zoom. For Example! When i zoom on the position right/middle i see only the left/top rectangle of the Stream.</p>
  
  <p>I added the <a href="http://fs1.directupload.net/images/150922/ep8t4n6h.jpg" rel="nofollow noreferrer">following pictures</a> to unterstand the problem.</p>