-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: EXIF orientation flag support (#6)
- Loading branch information
Showing
8 changed files
with
202 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/main/kotlin/com/github/secretx33/imagetopdf/convert/ExifConstant.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.github.secretx33.imagetopdf.convert | ||
|
||
const val ORIENTATION_HORIZONTAL = 1 | ||
const val ORIENTATION_MIRROR_HORIZONTAL = 2 | ||
const val ORIENTATION_ROTATE_180 = 3 | ||
const val ORIENTATION_MIRROR_VERTICAL = 4 | ||
const val ORIENTATION_MIRROR_HORIZONTAL_AND_ROTATE_270 = 5 | ||
const val ORIENTATION_ROTATE_90 = 6 | ||
const val ORIENTATION_MIRROR_HORIZONTAL_AND_ROTATE_90 = 7 | ||
const val ORIENTATION_ROTATE_270 = 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/kotlin/com/github/secretx33/imagetopdf/model/ImageMirroring.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.github.secretx33.imagetopdf.model | ||
|
||
import com.github.secretx33.imagetopdf.convert.ORIENTATION_MIRROR_HORIZONTAL | ||
import com.github.secretx33.imagetopdf.convert.ORIENTATION_MIRROR_HORIZONTAL_AND_ROTATE_270 | ||
import com.github.secretx33.imagetopdf.convert.ORIENTATION_MIRROR_HORIZONTAL_AND_ROTATE_90 | ||
import com.github.secretx33.imagetopdf.convert.ORIENTATION_MIRROR_VERTICAL | ||
|
||
enum class ImageMirroring { | ||
NONE, | ||
HORIZONTAL, | ||
VERTICAL; | ||
|
||
companion object { | ||
fun from(mirroring: Int): ImageMirroring = when (mirroring) { | ||
ORIENTATION_MIRROR_VERTICAL -> VERTICAL | ||
ORIENTATION_MIRROR_HORIZONTAL, | ||
ORIENTATION_MIRROR_HORIZONTAL_AND_ROTATE_90, | ||
ORIENTATION_MIRROR_HORIZONTAL_AND_ROTATE_270 -> HORIZONTAL | ||
else -> NONE | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/kotlin/com/github/secretx33/imagetopdf/model/ImageRotation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.github.secretx33.imagetopdf.model | ||
|
||
import com.github.secretx33.imagetopdf.convert.ORIENTATION_MIRROR_HORIZONTAL_AND_ROTATE_270 | ||
import com.github.secretx33.imagetopdf.convert.ORIENTATION_MIRROR_HORIZONTAL_AND_ROTATE_90 | ||
import com.github.secretx33.imagetopdf.convert.ORIENTATION_ROTATE_180 | ||
import com.github.secretx33.imagetopdf.convert.ORIENTATION_ROTATE_270 | ||
import com.github.secretx33.imagetopdf.convert.ORIENTATION_ROTATE_90 | ||
|
||
enum class ImageRotation(val degrees: Double) { | ||
NONE(0.0), | ||
ROTATE_90(90.0), | ||
ROTATE_180(180.0), | ||
ROTATE_270(270.0); | ||
|
||
companion object { | ||
fun from(orientation: Int): ImageRotation = when (orientation) { | ||
ORIENTATION_ROTATE_90, ORIENTATION_MIRROR_HORIZONTAL_AND_ROTATE_90 -> ROTATE_90 | ||
ORIENTATION_ROTATE_180 -> ROTATE_180 | ||
ORIENTATION_ROTATE_270, ORIENTATION_MIRROR_HORIZONTAL_AND_ROTATE_270 -> ROTATE_270 | ||
else -> NONE | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters