Interpretation of AspectRatioMode.FILL, ADJUST and NONE #1546
Replies: 2 comments 2 replies
-
Beta Was this translation helpful? Give feedback.
-
Hello, If you means the reason about aspect ratio is not working with the case 1 it is because you set a SurfaceView to RtmpCamera1 in the first case instead of an OpenGlView. fun save(surfaceView: OpenGlView, connectChecker: ConnectChecker) { The reason is because RtmpCamera1 accept both, OpenGlView and SurfaceView. In this case you are casting your OpenGlView to a SurfaceView and library can't know it so it is working as a SurfaceView ignoring aspect ratio (OpenGlView is a custom implementation of SurfaceView with cheats like the aspect ratio or filters) |
Beta Was this translation helpful? Give feedback.
-
Hi Pedro,
I'm having some trouble understanding what difference the three values of
AspectRatioMode
make to the preview image I see. After some experimentation, I see thatadjust
gives me a couple of black gutters at left and right in landscape orientation - but I can't tell if the image itself is slightly stretched horizontally or not.Does the
app:aspectRatioMode
value I set to anOpenGlView
change the way the image is rendered, or does it only effect how much of the OpenGlView is devoted to the image?I hope you can see what I mean ... this is hard to put into words. Maybe this image will make it clearer:
This is my app in landscape mode. There's an
OpenGlView
in the background that occupies the full screen, and a layer of Jetpack Compose controls on top of that. The OpenGlView is in preview mode. Note the black gutters at left and right, marked up with white arrows. This comes from setting theOpenGlView
'saspectRatioMode
toadjust
. If I change theaspectRatioMode
to "fill
", those black gutters disappear, but I cannot tell if that results in the image being slightly stretched horizontally more or not. If that is happening, it might be too subtle to notice.Can you please describe what each of the three
aspectRatioMode
values (adjust
,fill
,none
) actually mean in terms of the rendered image? In particular, what is being adjusted if I chooseadjust
? I've looked at the code inSizeCalculator.getViewport
but couldn't understand it.In summary: If it is important to me that the preview image should appear such that objects in the preview image appear with their natural proportions, which
aspectRatioMode
(s) should I use?Thanks for your time.
Rod.
Beta Was this translation helpful? Give feedback.
All reactions