Let’s say a Drawable, d, is created from an SVG image, and is to be painted inside a parent component such that it is scaled to a specific area.
I can draw it like this without any problems:
//in paint(Graphics &g) d->drawWithin(g, Rectangle<float>(x, y, w, h), RectanglePlacement::Flags::centred, 1.0f);
But I’d prefer to add the drawable as a child component instead. What would be the equivalent way of setting its bounds and transforms etc such that it produces similar results as the drawWithin() method?
I tried this, but it doesn’t scale:
//Constructor addAndMakeVisible(d); // resize() d->setBoundsToFit(x, y, w, h, Justification::centred, false);