fix the rotation of images captured with Camera2 api

This commit is contained in:
tibbi
2018-05-30 16:11:23 +02:00
parent 184f87aab1
commit 7d5a60f13d
6 changed files with 58 additions and 67 deletions

View File

@ -35,3 +35,10 @@ const val STATE_PICTURE_TAKEN = 2
const val STATE_WAITING_LOCK = 3
const val STATE_WAITING_PRECAPTURE = 4
const val STATE_WAITING_NON_PRECAPTURE = 5
fun compensateDeviceRotation(orientation: Int, isUsingFrontCamera: Boolean) = when {
orientation == ORIENT_LANDSCAPE_LEFT -> 270
orientation == ORIENT_LANDSCAPE_RIGHT -> 90
isUsingFrontCamera -> 180
else -> 0
}