Add ability to set a rotation on SSIV #5
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why does this PR exist?
This library is quite handy, but it seems to lack the ability of dealing with rotated images. For example images having EXIF rotation data. In order to keeps things simple, the SSIV should have a rotation field and apply that to the tiles it's displaying.
How does the PR solve this?
This PR adds a new enum called
ImageRotation
, it has fixed values of 90 degree increments.SubsamplingScaleImageView
has been extended by aimageRotation
field of typeImageRotation
and with a default value ofImageRotation.ROTATION_0
. This value can be changed viaSubsamplingScaleImageView.setImageRotation()
. In order for the rotation to applygetEffectiveSWidth()
andgetEffectiveSHeight()
have been added to account for the rotation when usingsWidth
andsHeight
.Further Reading
I based this PR on the original repo. I left out the EXIF parsing, it has to bee done externally, and once the rotation is determined, users can call
SubsamplingScaleImageView.setImageRotation()
.