It seems like it’s reading the SVG directly will have additional pixels or whatever ! I tried to debug the centreX, centreY of SVG bounds, it’s changed on rotation.
Anyway, I solved the problem using SVG Path Helper to get the path and rotate it, and it works fine with me.
to my current experience, the [Drawable] object filled with svg might ignore its viewport attribute and gives no option to enable it (i guess). So your situation might be caused by unregular shape of svg that is rather extracted from its document excluding its context. So for example if your original shape has been drawn with an offest from its boundaries, this is going to be ignored at its final stage.
original
drawable
in order to remain shape’s original position you would have to calculate it yourself. for example:
I have tried your approach, it gives me the same results ! the problem actually is with rotation, I cannot get it applied around center perfectly, the slight difference is in range 1.0f->2.0f in centers which is kinda weird ! why is the center changes in my calculations any yours if the shape is symmetric
I was drilling down in SVGParser, found out that the change is actually happening due to viewport parsing ! Inkscape is not generating numbers accurately !
it contributed to the scale factor, so I would guess, rw is the width of the target rectangle, and since it is supposed to be rectangular (or round to be precise), the height is the same like width…