I am creating an image using NinePatchDrawable and trying to rotate it using rotateBy method simply, but it is not rotating somehow. I am using following code snippet:
TextureAtlas ninePatchAtlas = game.getAssetsInterface().getTextureAtlas(Constants.GAME_ATLAS);
AtlasRegion region = ninePatchAtlas.findRegion("drawPatch");
NinePatch ninePatch = new NinePatch(region, 59, 59, 59, 59);
NinePatchDrawable ninePatchDrawable = new NinePatchDrawable(ninePatch);
Image image = new Image(ninePatchDrawable);
image.setOrigin(image.getWidth() / 2, image.getHeight() / 2);
image.setPosition(200, 400);
image.setWidth(150);
image.rotateBy(45);
rotate is working if I use another drawable instead of NinePatchDrawable on constructor of Image. Is there anyone facing the same issue?
After investigating I have decided to use Containers as follows:
You can add container directly to stage or use its draw method in your custom widget implementation.