Archived:JSR-226 - SVGLocatableElement.getBBox() returns wrong value when a transformation is applied for the inner elements (Known Issue)
Archived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.
Article Metadata
Compatibility
Platform(s): S60 3rd Edition, FP1 MIDP SDK
Article
Created: User:Technical writer 1
(14 Sep 2007)
Last edited: hamishwillee
(28 Jun 2012)
Contents |
Overview
When using the Scalable 2D Vector Graphics API, the method SVGLocatableElement.getBBox() returns a wrong value when a transformation is applied. The bounding box for an element is in that element's user space, which does not take the transformation of the element into account.
Description
The correct value for the group’s bounding box is the one that does not take the transformation of inner elements into account.
How to reproduce
This issue affects JSR-226 when running on the emulator.
<g id="group1" transform="translate(10, 20)" fill="red" >
<rect id="rect1" transform="scale(2)" x="10" y="10" width="50" height="50"/>
<rect id="rect2" x="10" y="10" width="100" height="100"/>
<g id="group2" transform="translate(10, 20)" >
<rect id="rect3" x="0" y="10" width="150" height="50"/>
<circle id="circle1" cx="20" cy="20" r="100" />
</g>
</g>
SVGLocatableElement group1Elem = (SVGLocatableElement)
svgImage.getDocument().getElementById(group1);
SVGRect group1BBox = group1Elem.getBBox();
group1BBox = [-80, -80, 230, 200]
The correct value is: [-70, -60, 230, 200]
Solution
This issue is fixed in S60 3rd Edition, FP2 MIDP SDK.


(no comments yet)