I'm struggling to draw a rotating bitmap around its center and do the rotation without resizing the bitmap. I draw all my sprites on the screen through the game stream, so I'm looking for a solution that includes the original bitmap and not the canvas.
Thanks in advance.
This is my code so far, it turns a bitmap around its center, but resizes it.
i = i + 2;
transform.postRotate(i, Assets.scoresScreen_LevelStar.getWidth()/2, Assets.scoresScreen_LevelStar.getHeight()/2);
Bitmap resizedBitmap = Bitmap.createBitmap(Assets.scoresScreen_LevelStar, 0, 0, Assets.scoresScreen_LevelStar.getWidth(), Assets.scoresScreen_LevelStar.getHeight(), transform, true);
game.getGraphics().getCanvasGameScreen().drawBitmap(resizedBitmap, null, this.levelStar.getHolderPolygons().get(0), null);
Update:
I noticed that it is not as simple as it seems. My spinning code is not a problem. The bitmap rotates, but dst rect should also increase / decrease depending on the rotation angle, otherwise the bi-map will be smaller, because it is pulled into a fixed dst rect. Therefore, I assume that I will have to develop some method that will return dst rect. Therefore, the methods required to rotate a bitmap image have not changed:
public static Bitmap rotateBitmap(Bitmap bitmap, int rotation)
and
public static Rect rotateRect(Rect currentDst, int rotation)
I understand that this will require some kind of math (trigger), someone to call ?: P