SVG - Best approach to scale and draw


#1

Hi

I'm trying to figure out the best way to scale SVG images. For example, I'm loading the individual SVG files into DrawableComposite objects, like:

ScopedPointer<XmlElement> svg(XmlDocument::parse(BinaryData::Module_background_svg));
background = dynamic_cast<DrawableComposite*>(Drawable::createFromSVG(*svg));


Then I'm drawing them in the paint() method with this:

background->drawWithin(g, Rectangle<float>(0, 0, width, height), RectanglePlacement::stretchToFit, 1.0);

But what I want to be able to do is change the size of the SVG without the graphic appearing to be stretched. To me it looks like the SVG is rendered as an image then drawn. How do I draw them as actual vectors or paths?

thanks
peter

 


#2

Don't understand - they're always drawn as vectors, there should be no images involved unless you explicitly use them (?)


#3

Thanks Jules for the clarification. I think I was expecting the borders of the SVG images to stay the same width, but it totally makes sense that they would also scale up. Maybe I need to set some sort of non-scaling stroke property on just the border.