mirror of
https://github.com/Steffo99/twom.git
synced 2024-11-22 08:04:26 +00:00
Handle ExifInterface.ORIENTATION_TRANSPOSE
and ExifInterface.ORIENTATION_TRANSVERSE
This commit is contained in:
parent
1b7705df63
commit
58cb8de3ff
1 changed files with 16 additions and 3 deletions
|
@ -51,7 +51,6 @@ class ImageHandler {
|
||||||
// Create a transformation matrix to rotate the bitmap based on the orientation
|
// Create a transformation matrix to rotate the bitmap based on the orientation
|
||||||
val transformationMatrix = Matrix()
|
val transformationMatrix = Matrix()
|
||||||
|
|
||||||
// TODO: Make sure all these transformations are valid
|
|
||||||
when (orientation) {
|
when (orientation) {
|
||||||
ExifInterface.ORIENTATION_FLIP_HORIZONTAL -> {
|
ExifInterface.ORIENTATION_FLIP_HORIZONTAL -> {
|
||||||
transformationMatrix.postScale(-1f, 1f)
|
transformationMatrix.postScale(-1f, 1f)
|
||||||
|
@ -66,7 +65,14 @@ class ImageHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
ExifInterface.ORIENTATION_TRANSPOSE -> {
|
ExifInterface.ORIENTATION_TRANSPOSE -> {
|
||||||
/* TODO: Transpose the image Matrix */
|
// Untested.
|
||||||
|
transformationMatrix.setValues(FloatArray(16) {
|
||||||
|
if (it == 0 || it == 6 || it == 9 || it == 15) {
|
||||||
|
1f
|
||||||
|
} else {
|
||||||
|
0f
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
ExifInterface.ORIENTATION_ROTATE_90 -> {
|
ExifInterface.ORIENTATION_ROTATE_90 -> {
|
||||||
|
@ -74,7 +80,14 @@ class ImageHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
ExifInterface.ORIENTATION_TRANSVERSE -> {
|
ExifInterface.ORIENTATION_TRANSVERSE -> {
|
||||||
/* TODO: Flip horizontally the image Matrix, then transpose it */
|
// Untested.
|
||||||
|
transformationMatrix.setValues(FloatArray(16) {
|
||||||
|
if (it == 3 || it == 5 || it == 10 || it == 12) {
|
||||||
|
1f
|
||||||
|
} else {
|
||||||
|
0f
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
ExifInterface.ORIENTATION_ROTATE_270 -> {
|
ExifInterface.ORIENTATION_ROTATE_270 -> {
|
||||||
|
|
Loading…
Reference in a new issue