SVG size

I am a bit confused (or let’s say I lack information) about the way SVGs are handled in VASSAL (3.2.17, MacOS 10.11). The Designer Manual (still on 3.1, it seems) does not explain these things in detail, that’s why I ask here. Please point me to a source of information if it has been answered before.

I create my SVGs from Illustrator and can load them into VASSAL as map or piece images without problems. When I select an SVG image, let’s say for a map, the size settings disappear – logical, it seems, as an SVG is vector except for embedded images and should scale to any size. But OTOH VASSAL has to render the SVG to some size – which? Looking at screenshots and the coordinates shown during Region creation I think it uses the size given in
<svg version=“1.1” xmlns=“http://www.w3.org/2000/svg” xmlns:xlink=“http://www.w3.org/1999/xlink” x=“0px” y=“0px” width=“782.177px” height=“1587.4px” viewBox=“0 0 782.177 1587.4” enable-background=“new 0 0 782.177 1587.4” xml:space=“preserve”> ?
Indeed the map does scale brilliantly to any size until the heap runs out of space.

So, when I mix PNG and SVG, I guess I should use the height/width as shown in the SVG source as a reference? In other words, for all things concerned with size, scale etc. I should treat the SVG as an image of the px size given in the tag?

Thanks in advance,
Lutz

PS: Yes, I know I should have avoided fractional px sizes from the start.
PPS: I’d be ready to help with writing new docs.

I’ll add something that may be interesting for other Illustrator users:
It looks as if Illustrator calculates the canvas and viewbox sizes (they are identical if you save the SVG with the “use Artboard” option) as the size in px of a 72 ppi preview. This is regardless of document settings (I use mm) and raster Effect settings (I use 300 dpi).
This means that I will never have “clean” coordiante values in my SVGs, try what I may, unless I decide to work in relation to 72 ppi all the time (which would be absurd, and not only because of the “i” part of the unit).

Thus spake PunTheHun:

So, when I mix PNG and SVG, I guess I should use the height/width as
shown in the SVG source as a reference? In other words, for all things
concerned with size, scale etc. I should treat the SVG as an image of
the px size given in the tag?

Yes, that’s exactly right. VASSAL takes the 100% size of the SVG image
from the width and height attributes of the svg element.


J.

Great! Thanks a million. And on I go…

Thus spake PunTheHun:

Great! Thanks a million. And on I go…

For your information, there will be a way to specify the natural size
of SVG external to the SVG file itself in VASSAL 4. That doesn’t help
you now, but it’s what’s coming.


J.


messages mailing list
messages@vassalengine.org
vassalengine.org/mailman/listinfo/messages