Created
July 30, 2020 11:55
-
-
Save ecoopnet/409b543b138036cda29e963aa10c3a23 to your computer and use it in GitHub Desktop.
Android Kotlin Graphics Utility.
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
// python numpy の処理をRectに適用できても面白いかも。 | |
// TODO: | |
// fun RectF().toInt(): Rect | |
// fun Rect().toFloat(): RectF | |
// fun Rect.scaleCenter(scaleX: Float, scaleY: Float): RectF | |
// fun Rect.scaleCenter(scaleXY: Float): RectF | |
/// Scale X and Y separately. | |
fun Rect.scale(scaleX: Float, scaleY): RectF | |
= Rect( | |
left * scaleX, | |
top * scaleY, | |
right * scaleX, | |
bottom * scaleY | |
) | |
// Scale with same scale factor. | |
fun Rect.scale(scaleXY: Float): RectF | |
= scale(scaleXY, scaleXY) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment