I hope to add a function to zoom in preview picture (Please see Image A) for the sample code at https://github.com/android/camera/tree/master/CameraXBasic
I have read the article but the following code doesn't work. How can I zoom the preview with CameraX API 1.0.0-alpha05 ?
/** Declare and bind preview, capture and analysis use cases */
private fun bindCameraUseCases() {
...
// Apply declared configs to CameraX using the same lifecycle owner
CameraX.bindToLifecycle(
viewLifecycleOwner, preview, imageCapture, imageAnalyzer)
//I added code
var my=Rect(0,0,500,500)
preview.zoom(my)
}
Image A