W3C home > Mailing lists > Public > www-svg@w3.org > June 2005

getBBox and the transform attribute

From: Rob Adams <readams@readams.net>
Date: Tue, 07 Jun 2005 15:19:09 -0700
To: www-svg@w3.org
Message-Id: <1118182750.2376.8.camel@localhost.localdomain>

According to http://www.w3.org/TR/SVG/types.html#InterfaceSVGLocatable,
getBBox "Returns the tight bounding box in current user space (i.e.,
after application of the transform attribute, if any) on the geometry of
all contained graphics elements, exclusive of stroke-width and filter
effects)."

Consider this document:
<svg id="drawingCanvas" version="1.1"
	 viewPort="0 0 300 400"
	 xmlns:xlink="http://www.w3.org/1999/xlink"
	 xmlns = "http://www.w3.org/2000/svg">
  <rect id="transformed" fill="blue" stroke="black" stroke-width="3"
	 x="100" y="100" width="100" height="200"transform="translate(50 50)"/>
  <rect id="untransformed" fill="none" stroke="black" stroke-width="1"
         stroke-dasharray="4,4" x="100" y="100" width="100" height="200"/>
</svg>

Adobe, Batik, and mozilla SVG all seem to show the behavior that for
both of these rect, getBBox returns (100, 100, 100, 200) and not (150,
150, 100, 200) for the transformed rectangle.

The question is, given the ambiguity of the spec, is this behavior
correct?  

-Rob

See:
https://bugzilla.mozilla.org/show_bug.cgi?id=296997 
and the testcase at:
https://bugzilla.mozilla.org/attachment.cgi?id=185604

(Note that in order for this work you must be using a recent nightly
build of firefox)
Received on Wednesday, 8 June 2005 01:14:10 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:30 GMT