1
Fork 0
mirror of https://github.com/Steffo99/twom.git synced 2024-11-25 01:24:24 +00:00

Handle ExifInterface.ORIENTATION_TRANSPOSE and ExifInterface.ORIENTATION_TRANSVERSE

This commit is contained in:
Steffo 2024-01-09 08:49:20 +01:00
parent 1b7705df63
commit 58cb8de3ff
Signed by: steffo
GPG key ID: 2A24051445686895

View file

@ -51,7 +51,6 @@ class ImageHandler {
// Create a transformation matrix to rotate the bitmap based on the orientation
val transformationMatrix = Matrix()
// TODO: Make sure all these transformations are valid
when (orientation) {
ExifInterface.ORIENTATION_FLIP_HORIZONTAL -> {
transformationMatrix.postScale(-1f, 1f)
@ -66,7 +65,14 @@ class ImageHandler {
}
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 -> {
@ -74,7 +80,14 @@ class ImageHandler {
}
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 -> {