I faced with the issue of CameraX screen rotation support.
Portrait:
Landscape:
Transformation code:
private void updateTransform() {
Log.d(TAG, "updateTransform: ");
Matrix matrix = new Matrix();
float centerX = cameraViewTextureV.getWidth() / 2f;
float centerY = cameraViewTextureV.getHeight() / 2f;
switch (cameraViewTextureV.getDisplay().getRotation()) {
case Surface.ROTATION_0:
rotation = 0;
break;
case Surface.ROTATION_90:
rotation = 90;
break;
case Surface.ROTATION_180:
rotation = 180;
break;
case Surface.ROTATION_270:
rotation = 270;
break;
default:
break;
}
matrix.postRotate((float) -rotation, centerX, centerY);
cameraViewTextureV.setTransform(matrix);
}
So, as you can see in the pictures, camera support screen rotation not correctly... I calling updateTransform
method when screen rotating...
Took this code from the official guide for cameraX from Android developers site.
Will be very grateful for any proposes for fixing. Have a nice day!