how to rotate a bitmap 90 degrees

后端 未结 10 1572
离开以前
离开以前 2020-11-28 03:09

There is a statement in android canvas.drawBitmap(visiblePage, 0, 0, paint);

When I add canvas.rotate(90), there is no effect. But if I wri

10条回答
  •  难免孤独
    2020-11-28 03:46

    I would simplify comm1x's Kotlin extension function even more:

    fun Bitmap.rotate(degrees: Float) =
        Bitmap.createBitmap(this, 0, 0, width, height, Matrix().apply { postRotate(degrees) }, true)
    

提交回复
热议问题