'Android SurfaceView Mirror camera

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. enter image description here



Solution 1:[1]

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)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ouflak