Hi,
I tried to use the camera2 example in landscape view. (#SupportedOrientations: landscape)
The preview image has been stretched and enlarged, but the photo is good. (see attachment)
I tried the following:
- changed cam.PreviewSize.Initialize(1920, 1080) -> cam.PreviewSize.Initialize(1080, 1920)
- created a landscape design variant
but these did not help.
I don't know, this is a bug or I'm doing something wrong.
Private Sub ResizePreviewPanelBasedPreviewSize
Dim pw = cam.PreviewSize.Width, ph = cam.PreviewSize.Height As Int
Dim r As Float = Max(Root.Width / pw, Root.Height / ph) 'FILL_NO_DISTORTIONS (change to Min for FIT)
Dim w As Int = pw * r
Dim h As Int = ph * r
pnlCamera.SetLayoutAnimated(0, Round(Root.Width / 2 - w / 2), Round(Root.Height / 2 - h / 2), Round(w), Round(h))
End Sub
Private Sub ResizePreviewPanelBasedPreviewSize
Dim pw = cam.PreviewSize.Width, ph = cam.PreviewSize.Height As Int
Dim r As Float = Max(Root.Width / pw, Root.Height / ph) 'FILL_NO_DISTORTIONS (change to Min for FIT)
Dim w As Int = pw * r
Dim h As Int = ph * r
pnlCamera.SetLayoutAnimated(0, Round(Root.Width / 2 - w / 2), Round(Root.Height / 2 - h / 2), Round(w), Round(h))
End Sub