how to rotate a bitmap 90 degrees

后端 未结 10 1600
离开以前
离开以前 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:37

    If you rotate bitmap, 90 180 270 360 is ok but for other degrees canvas will draw bitmap with different size.

    So,the best way is

    canvas.rotate(degree,rotateCenterPoint.x,rotateCenterPoint.y);  
    canvas.drawBitmap(...);
    canvas.rotate(-degree,rotateCenterPoint.x,rotateCenterPoint.y);//rotate back
    

提交回复
热议问题