I've used the SVG Tool to convert my path into a stream and I load it as suggest. now I'd like to rotate it while keeping it centered in my graphic bounderies.
So my path loading function is:
static const unsigned char pathData[] {...} Path p; p.loadPathFromData (pathData, sizeof (pathData));
I've also tried as I saw being used within JUCE code for drawing arrow (I'm providing the height and get the path in return):
p.scaleToFit (0, 0, height, height, true);
However no matter where I try to add transformation:
p.applyTransform (juce::AffineTransform::rotation (angle,0.5f * width, 0.5f * height)); // or this one p.applyTransform(juce::AffineTransform::rotation(angle));
I'm never being able to keep the image centered just rotating it "in-place".
I think the thing I'm missing is how can I make the Path or an object that has bounds of my desired area.
Because when I call:
DBG(String::formatted("%d : %d : %d : %d",p.getBounds().getX(),p.getBounds().getY(),p.getBounds().getWidth(),p.getBounds().getHeight()));
I'm getting very big canvas:
1606405377 : 1606405792 : 23178600 : 23178604
So I guess the scaleToFit (or other call I'm trying to make the path within the desired boundaries) isn't really commiting to the Path.
I guess I'm missing something.