Created
July 27, 2020 06:22
-
-
Save kwmt/60964abd7eecbf0dc384c441abab0912 to your computer and use it in GitHub Desktop.
android.graphic.Rectを回転させるサンプル
This file contains hidden or 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
private fun Rect.rotateRect(degree:Float): Rect { | |
val rectF = this.toRectF() | |
val matrix = Matrix() | |
matrix.setRotate(degree, rectF.centerX(), rectF.centerY()) | |
matrix.mapRect(rectF) | |
return rectF.toRect() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment