Android Question CamEx2 Zoom in Preview AND Capture

lerneBasic4Android

Member
Licensed User
Hi,

as Erel stated in this post the zoom in CamEx2 Class effects only the preview but not the capture of the photo taken: https://www.b4x.com/android/forum/threads/camera2-still-images-and-videos.83920/page-3#post-557317

To change this behavior I added in CamEx2.setPreviewCropRegion a line that puts the rectangle not only to PreviewSettingmap but also to CaptureSettingMap:

B4X:
'Sets the preview region.
Public Sub setPreviewCropRegion(r As Rect)
  PreviewSettingsMap.Put("SCALER_CROP_REGION", r)
  CaptureSettingMap.Put("SCALER_CROP_REGION", r) ' New line added for Zoom in Capture
End Sub
On my devices (mostly Samsung) it works fine. I would love to hear you opinion on this solution. Does anyone see drawbacks? (Except the obvious one that this change will be gone with every update of CamEx2 and has to be applied again.)

Thanks,
Thomas
 
Top