how to rotate a bitmap 90 degrees

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

    Using Java createBitmap() method you can pass the degrees.

    Bitmap bInput /*your input bitmap*/, bOutput;
    float degrees = 45; //rotation degree
    Matrix matrix = new Matrix();
    matrix.setRotate(degrees);
    bOutput = Bitmap.createBitmap(bInput, 0, 0, bInput.getWidth(), bInput.getHeight(), matrix, true);
    

提交回复
热议问题