Android Question Camera2 zoom function in Erel code

IpHostA

New Member
Hello everyone,

In this post from Erel in September 2017 there is an example of code related to the Camera2 library:

Camera2 - New camera library

Everything works perfectly. But in this example if you use the zoom and take a photo, it is the unzoomed version of the image that is saved.
Do you have any idea what needs to be changed in the code to save the zoomed photo and not the unzoomed general camera view ?

B4X:
Sub TakePicture

    Try
        SetState(openstate, True, VideoMode)
        Wait For(cam.FocusAndTakePicture(MyTaskIndex)) Complete (Data() As Byte)
        
        SetState(openstate, False, VideoMode)

        cam.DataToFile(Data, VideoFileDir, "temp.jpg")
        Log(VideoFileDir & "/temp.jpg : ")

        Dim bmp As Bitmap = cam.DataToBitmap(Data)
        Log("Picture taken: " & bmp) 'ignore
        pnlBackground.SetVisibleAnimated(100, True)
        B4XImageView1.Bitmap = RotateJpegIfNeeded(bmp, Data)
        
        Sleep(2000)
        pnlBackground.SetVisibleAnimated(500, False)

    Catch
        HandleError(LastException)
        Log(LastException.Message)
    End Try

End Sub

Can someone help me figure out what is wrong?

THANKS,
 
Top