I am trying to implement a function that translates a G to the origin,
rotates it, translates it back to the original position, scales it, and
then translates it to a target position. However it doesn't seem to work
if I comment out the rotation bits translation and scaling work
perfectly. Any ideas what I am doing wrong?
 
<snip>
SVGOMGElement svgG = ((SVGOMGElement) n);
SVGTransformList svgTL = ((SVGTransformable)
svgG).getTransform().getBaseVal(); 
svgTL.consolidate();
 
SVGMatrix svgM;

if(svgTL.getNumberOfItems() == 0)
{
    SVGTransform svgT = new SVGOMTransform();
    svgM = new SVGOMMatrix(new AffineTransform(1,0,0,1,0,0));
    svgT.setMatrix(svgM);
    svgTL.appendItem(svgT);
}

SVGOMMatrix mat1 = new SVGOMMatrix(new
AffineTransform(1,0,0,1,-w/2,-h/2));
SVGOMMatrix mat2 = new SVGOMMatrix(new
AffineTransform(Math.cos(angle),Math.sin(angle),-Math.sin(angle),Math.co
s(angle),0,0));
SVGOMMatrix mat3 = new SVGOMMatrix(new
AffineTransform(1,0,0,1,w/2,h/2));
SVGOMMatrix mat4 = new SVGOMMatrix(new
AffineTransform(scaleX,0,0,scaleY,0,0));
SVGOMMatrix mat5 = new SVGOMMatrix(new AffineTransform(1,0,0,1,x,y));

svgM = mat1;
svgM = svgM.multiply(mat2);
svgM = svgM.multiply(mat3);
svgM = svgM.multiply(mat4);
svgM = svgM.multiply(mat5);
svgTL.getItem(0).setMatrix(svgM);

</snip>

thanks,
plb
PAUL LOGASA BOGEN II
Programmer

KNOWLEDGE BASED SYSTEMS, INC.
1408 University Drive East
College Station, Texas 77840
Phone: 979-260-5274
Fax: 979-691-2928
www.kbsi.com
<file:///C:/Documents%20and%20Settings/plbogen/Application%20Data/Micros
oft/Signatures/www.kbsi.com> 

 

Reply via email to