i have a panel with the full height of the activity, the preview image looks stretched if i set this static to 1920x1080, how can i calculate the optimal sizes?
My code is not working, because he think 1080x1080 is the best size...
The panel is 1080x2200 on my device.
My code is not working, because he think 1080x1080 is the best size...
The panel is 1080x2200 on my device.
B4X:
Private Sub GetOptimal As CameraSize
Dim last_sizes As CameraSize
last_sizes.Initialize(0,0)
For Each prev_sizes As CameraSize In cam.SupportedPreviewSizes
Log("Width: " & prev_sizes.Width & " Height: " & prev_sizes.Height)
If prev_sizes.Height <= xpnl_camera_background.Height And prev_sizes.Width <= xpnl_camera_background.Width And prev_sizes.Height > last_sizes.Height And prev_sizes.Width > last_sizes.Width Then
last_sizes.Initialize(prev_sizes.Width,prev_sizes.Height)
Return last_sizes
End If
Next
Return last_sizes
End Sub
all available sizes:
Width: 4608 Height: 2304
Width: 4608 Height: 2592
Width: 4608 Height: 2176
Width: 4608 Height: 2112
Width: 4096 Height: 2160
Width: 4096 Height: 1940
Width: 4000 Height: 3000
Width: 3840 Height: 2160
Width: 3456 Height: 3456
Width: 3264 Height: 2448
Width: 3200 Height: 2400
Width: 2976 Height: 2976
Width: 2688 Height: 1512
Width: 2592 Height: 1944
Width: 2592 Height: 1940
Width: 2340 Height: 1080
Width: 2304 Height: 1728
Width: 2280 Height: 1080
Width: 2160 Height: 1080
Width: 2048 Height: 1536
Width: 1920 Height: 1440
Width: 1920 Height: 1080
Width: 1440 Height: 1080
Width: 1280 Height: 960
Width: 1280 Height: 768
Width: 1280 Height: 720
Width: 1080 Height: 1080
Width: 1024 Height: 738
Width: 1024 Height: 768
Width: 800 Height: 600
Width: 800 Height: 480
Width: 720 Height: 480
Width: 640 Height: 480
Width: 352 Height: 288
Width: 320 Height: 240
Width: 176 Height: 144