Login Register

Transform shape by matrix

Hello everybody,

i´m trying to convert some SVG-Files to dojox.gfx compatible shapes. Some SVG-Tags contain transform-Attributes, like rotate(), matrix and so on...
for example something like that: <polygon ... transform="matrix(1,2,3,4,5,6)"></polygon>

Now i´m trying to port this matrix(...) which transforms the polygon to a dojox.gfx surface to transform a shape (like a rectangle or something else).
Up to now i tried a lot of things, but something worked :-(
Here a some excerpts of my attempts to solve the problem:
shape.setTransform({1,2,3,4,5,6});
shape.setTransform(dojox.gfx.matrix.Matrix2D(1,2,3,4,5,6));
shape.setTransform(dojox.gfx.matrix.Matrix2D({1,2,3,4,5,6}));

But none of these orders works. Is there anybody who can help me?

Big thanks!

The Matrix2D object takes args in this order:

xx, yx, xy, yy, dx, dy.

The easiest way to do the constructor is this:

shape.setTransform(new dojox.gfx.Matrix2D({
    xx: 1, yx: 2, xy: 3, yy: 4, dx: 5, dy: 6
}));

Hope that helps.

A shortcut

A shortcut:

shape.setTransform({xx: 1, yx: 2, xy: 3, yy: 4, dx: 5, dy: 6});

yes!

Hello,

thank you for your reply. That is the solution I was looking for ;-)

Greetz