I'm just following up on this. I finally got around to doing it and it
worked fine:
SVGLocatable locatable = (SVGLocatable) element;
SVGRect boundingBox = locatable.getBBox();
SVGMatrix matrix = locatable.getCTM();
AffineTransform shapeTransform =
new AffineTransform(
matrix.getA(), matrix.getB(), matrix.getC(),
matrix.getD(), matrix.getE(), matrix.getF());
Rectangle2D rectangle2D =
new Rectangle2D.Double(
boundingBox.getX() - padding[count],
boundingBox.getY() - padding[count],
boundingBox.getWidth() + (2 * padding[count]),
boundingBox.getHeight() + (2 * padding[count]));
graphics2D.draw(
shapeTransform.createTransformedShape(rectangle2D));
This works wonderfully and handles transforms with ease. I'm not a big
fan of newing stuff up, especially in a rendering method, but I have no
perceived performance problems under normal usage.
Michael Bishop
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 14, 2006 7:26 PM
To: [email protected]
Cc: [email protected]
Subject: Re: Bounding Boxes....again.
Hi Michael,
"Bishop, Michael W. CONTR J9C880" <[EMAIL PROTECTED]> wrote on
02/13/2006 10:54:03 AM:
> OK, I have all the pieces from previous posts, but I?m lacking the
crucial
> method calls to put it together.
>
> I have an element.
> An element has a CTM which contains all of its transform information.
> An element has a bounding box (getBBox()).
>
> How do I apply the CTM to the bounding box to properly bound the
element?
You can either use the SVGMatrix to map each of the corner points
or you can build a Java awt AffineTransform and call
createTransformedShape
with the bounding Rect.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]