You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Cory Sanoy <Co...@smarttech.com> on 2002/10/04 21:28:39 UTC

Bug in Use x and y coordinate handling

A use tag with x and y coordinates specified as percentages throws a null
pointer exception. 

Here is the tag used:
        <use x="10%" y="10%"
             width="50" xmlns:xlink="http://www.w3.org/1999/xlink"
             xlink:href="#symbol1"
             id="symbol1" height="50"/>


Here is the error:
java.lang.NullPointerException
	at
org.apache.batik.bridge.UnitProcessor$DefaultContext.getViewportWidth(UnitPr
ocessor.java:382)
	at
org.apache.batik.util.UnitProcessor.percentagesToPixels(UnitProcessor.java:2
23)
	at
org.apache.batik.util.UnitProcessor.svgToUserSpace(UnitProcessor.java:166)
	at
org.apache.batik.util.UnitProcessor.svgToUserSpace(UnitProcessor.java:131)
	at
org.apache.batik.bridge.UnitProcessor.svgToUserSpace(UnitProcessor.java:313)
	at
org.apache.batik.bridge.UnitProcessor.svgHorizontalCoordinateToUserSpace(Uni
tProcessor.java:247)
	at
org.apache.batik.bridge.SVGUseElementBridge.computeTransform(SVGUseElementBr
idge.java:178)
	at
org.apache.batik.bridge.SVGUseElementBridge.createGraphicsNode(SVGUseElement
Bridge.java:152)
	at
org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:182)
	at
org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:148)
	at
org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:188)
	at
org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:148)
	at org.apache.batik.bridge.GVTBuilder.build(GVTBuilder.java:76)
	at
org.apache.batik.swing.svg.GVTTreeBuilder.run(GVTTreeBuilder.java:81)

It appears that the ctx is null in the getViewportWidth method.

It works fine for other use Element types for example <path> and <text> but
not for <use> Elements.

Thanks,
/Cory 

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


RE: Bug in Use x and y coordinate handling

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "CS" == Cory Sanoy <Co...@smarttech.com> writes:

CS> A use tag with x and y coordinates specified as percentages throws
CS> a null pointer exception.

CS> Here is the tag used: 

CS> <use x="10%" y="10%" width="50"
CS> xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#symbol1"
CS> id="symbol1" height="50"/>

    Why would you think that a circular reference should work?
There is no way to break out of the recursion in SVG...

    Can you provide an example that isn't circulare that triggers the
bug?


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org