mirror of
				https://github.com/SimpleMobileTools/Simple-Camera.git
				synced 2025-06-27 09:02:59 +02:00 
			
		
		
		
	fix #172, set SCALER_CROP_REGION at image capturing only if the user zoomed
This commit is contained in:
		| @@ -109,7 +109,7 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie | |||||||
|     private val mPreviewToCameraMatrix = Matrix() |     private val mPreviewToCameraMatrix = Matrix() | ||||||
|     private val mCameraOpenCloseLock = Semaphore(1) |     private val mCameraOpenCloseLock = Semaphore(1) | ||||||
|     private val mMediaActionSound = MediaActionSound() |     private val mMediaActionSound = MediaActionSound() | ||||||
|     private var mZoomRect = Rect() |     private var mZoomRect: Rect? = null | ||||||
|  |  | ||||||
|     constructor(context: Context) : super(context) |     constructor(context: Context) : super(context) | ||||||
|  |  | ||||||
| @@ -557,8 +557,10 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie | |||||||
|                 setFlashAndExposure(this) |                 setFlashAndExposure(this) | ||||||
|                 set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE) |                 set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE) | ||||||
|                 set(CaptureRequest.JPEG_ORIENTATION, mSensorOrientation) |                 set(CaptureRequest.JPEG_ORIENTATION, mSensorOrientation) | ||||||
|                 set(CaptureRequest.SCALER_CROP_REGION, mZoomRect) |  | ||||||
|                 set(CaptureRequest.CONTROL_CAPTURE_INTENT, CaptureRequest.CONTROL_CAPTURE_INTENT_STILL_CAPTURE) |                 set(CaptureRequest.CONTROL_CAPTURE_INTENT, CaptureRequest.CONTROL_CAPTURE_INTENT_STILL_CAPTURE) | ||||||
|  |                 if (mZoomRect != null) { | ||||||
|  |                     set(CaptureRequest.SCALER_CROP_REGION, mZoomRect) | ||||||
|  |                 } | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             val captureCallback = object : CameraCaptureSession.CaptureCallback() { |             val captureCallback = object : CameraCaptureSession.CaptureCallback() { | ||||||
| @@ -706,8 +708,10 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie | |||||||
|  |  | ||||||
|                     Handler().postDelayed({ |                     Handler().postDelayed({ | ||||||
|                         if (mLastFocusX != 0f && mLastFocusY != 0f) { |                         if (mLastFocusX != 0f && mLastFocusY != 0f) { | ||||||
|  |                             if (mCaptureSession != null) { | ||||||
|                                 focusArea(mLastFocusX, mLastFocusY, false) |                                 focusArea(mLastFocusX, mLastFocusY, false) | ||||||
|                             } |                             } | ||||||
|  |                         } | ||||||
|                     }, 200L) |                     }, 200L) | ||||||
|                 } catch (e: Exception) { |                 } catch (e: Exception) { | ||||||
|                 } |                 } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user