I want to mirror a preview in a rear camera. Not to rotate a view but flip the view.
I am using surfaceView. any help will be Appreciated.

I want to mirror a preview in a rear camera. Not to rotate a view but flip the view.
I am using surfaceView. any help will be Appreciated.

You can flip the image of bitmap using prescale properties of Matrix. example:
val rotateMatrix = Matrix() rotateMatrix.postRotate(0.0f)
rotateMatrix.preScale(-1.0f, 1.0f)
val rotatedBitmap = Bitmap.createBitmap(imageBitmap, 0, 0, PREVIEW_WIDTH, PREVIEW_HEIGHT, rotateMatrix, false)