title: How to show reign of area using SurfaceView and SurfaceHolder?
body: <p>I would like to know if there is a way to show only a reign of area of the camera that shown on a SurfaceView.</p>
  
  <p>I've got an image like that (microscopic image)<img src="https://i.stack.imgur.com/phCKi.png" alt="Full Image"></p>
  
  <p>and I want to show image like that(Cropped and <strong>Stretched</strong>): 
  <img src="https://i.stack.imgur.com/q9wdz.png" alt="Cropped and Stretched image"></p>
  
  <p>This is a part of my code(it is a basic code that show the camera on SurfaceView using SurfaceHolder):</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      requestWindowFeature(Window.FEATURE_NO_TITLE);
      getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
      WindowManager.LayoutParams.FLAG_FULLSCREEN);
      getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
      setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
  
  setContentView(R.layout.activity_sample_testing);
  
  overridePendingTransition(0, 0);
  
  cameraView = (SurfaceView)findViewById(R.id.CameraView);
  
      holder = cameraView.getHolder();
      holder.addCallback(this);
      holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  }
  
      @Override
  public void surfaceCreated(SurfaceHolder holder) {
      try {
          camera = Camera.open();
  
          parameters = camera.getParameters();
          parameters.setFlashMode(Parameters.FLASH_MODE_TORCH);
          parameters.setFocusMode(Parameters.FOCUS_MODE_AUTO);
  
          //parameters.setZoom(10);
          camera.setParameters(parameters);
          camera.setPreviewDisplay(holder);
          camera.setDisplayOrientation(90);
          camera.startPreview();
          camera.autoFocus(autoFocusCallback);
          recorder = new MediaRecorder();
  
          final Timer myTimer = new Timer();
          myTimer.schedule(new TimerTask() {
              @Override
              public void run() {
                  StartTest(0);
                  myTimer.cancel();
                  myTimer.purge();
              }
          },10000, 10); 
  
  
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
  
  }
      private void initRecorder() {
      camera.unlock();
  
      recorder.setCamera(camera);
      recorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
      recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
      CamcorderProfile cpHigh = CamcorderProfile
              .get(CamcorderProfile.QUALITY_HIGH);
      recorder.setProfile(cpHigh);
      recorder.setMaxDuration(50000); // 50 seconds
      recorder.setMaxFileSize(300000000); // Approximately 5 megabytes
  
      recorder.setOutputFile(VIDEO_PATH);
  
  }
  private void prepareRecorder() {
  
      recorder.setPreviewDisplay(holder.getSurface());
      try {
          recorder.prepare();
      } catch (IllegalStateException e) {
          e.printStackTrace();
          finish();
      } catch (IOException e) {
          e.printStackTrace();
          finish();
      }
  }
  </code></pre>
  
  <p>Thanks for any help!</p>