Problem with SVG transformations

M

M.Barren

Hi,

I'm a newbie in SVG, I've been trying to get the svg below working for
sometime now, I need help:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xml:space="preserve" zoomAndPan="disable">

<g transform="translate(10mm,10mm)">
<rect x="0mm" y="0mm" width="100mm" height="30mm"
style="fill:red;stroke:black;stroke-width:1mm"/>
</g>
</svg>

The "translate(10mm,10mm)" doesn't work unless i get rid of the units.
Without the units, how can I tell it 10 is in mm and not in cm or inch
or pixel or ... ?

Any help would be appreciated
 
J

Joe Kesselman

The "translate(10mm,10mm)" doesn't work unless i get rid of the units.
Without the units, how can I tell it 10 is in mm and not in cm or inch
or pixel or ... ?

Transformation is implemented as a matrix-multiplication operation upon
the coordinates. As such, it is unitless; the units are those of the
original coordinates it is being applied to. See the detailed
descriptions at
http://www.w3.org/TR/SVG11/coords.html#EstablishingANewUserSpace

(If you aren't familiar with matrix math operations, you really should
invest a bit of time in learning about them -- they're a fairly basic
tool for computer graphics work.)
 
J

Joe Kesselman

Joe said:
the coordinates. As such, it is unitless

.... or at least, that's how I read it. Certainly the scaling columns
have to be unitless (you don't want to multiply cm by cm when the result
is supposed to be cm). I suppose the additive column could and perhaps
should carry units, but I don't see provision for that in the spec. I
may be missing something (and whoever implemented the version you're
using may have missed the same thing I did), but...
 
M

M.Barren

Joe said:
Transformation is implemented as a matrix-multiplication operation upon
the coordinates. As such, it is unitless; the units are those of the
original coordinates it is being applied to. See the detailed
descriptions at
http://www.w3.org/TR/SVG11/coords.html#EstablishingANewUserSpace

(If you aren't familiar with matrix math operations, you really should
invest a bit of time in learning about them -- they're a fairly basic
tool for computer graphics work.)
Thanks joe for the the reply,
I have looked into the spec before, not only that page but many other
pages as well and I ended up not finding a solution, I'm familiar with
matrices and if you know a solution, please post a sample svg code to
show that, I'm really frustrated as even a google search on this didn't
get me anywhere.
Thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top