mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
SVG: Rescale image before transforming to ensure that it is the correct size
This commit is contained in:
parent
b8b77df0ed
commit
594e09b250
1 changed files with 6 additions and 4 deletions
|
|
@ -1201,11 +1201,13 @@ private:
|
|||
auto* di = new DrawableImage();
|
||||
|
||||
setCommonAttributes (*di, xml);
|
||||
di->setImage (image);
|
||||
|
||||
di->setTransformToFit ({ (float) xml->getDoubleAttribute ("x", 0.0), (float) xml->getDoubleAttribute ("y", 0.0),
|
||||
(float) xml->getDoubleAttribute ("width", 0.0), (float) xml->getDoubleAttribute ("height", 0.0) },
|
||||
RectanglePlacement (parsePlacementFlags (xml->getStringAttribute ("preserveAspectRatio").trim())));
|
||||
Rectangle<float> imageBounds ((float) xml->getDoubleAttribute ("x", 0.0), (float) xml->getDoubleAttribute ("y", 0.0),
|
||||
(float) xml->getDoubleAttribute ("width", image.getWidth()), (float) xml->getDoubleAttribute ("height", image.getHeight()));
|
||||
|
||||
di->setImage (image.rescaled ((int) imageBounds.getWidth(), (int) imageBounds.getHeight()));
|
||||
|
||||
di->setTransformToFit (imageBounds, RectanglePlacement (parsePlacementFlags (xml->getStringAttribute ("preserveAspectRatio").trim())));
|
||||
|
||||
if (additionalTransform != nullptr)
|
||||
di->setTransform (di->getTransform().followedBy (transform).followedBy (*additionalTransform));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue