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 Sebastien Aurelie <Au...@artesiaservices.be> on 2001/07/03 16:06:26 UTC

SwingSVGPrettyPrint and JPEGTranscoder

Hi,

I need to paint a JScrollBar. I noticed that if the JScrollBar is very small
you have only up and down buttons (no lift between), a fill3DRect to paint a
rectangle with a negative height (-1) is called.
You can see the trace I put in SVGShape.java and SVGRectangle.java:
 

printHack :
javax.swing.JScrollPane$ScrollBar[,483,25,15x28,layout=javax.swing.plaf.meta
l.MetalScrollBarUI,alignmentX=null,alignmentY=null,border=,flags=1185,maximu
mSize=,minimumSize=,preferredSize=,blockIncrement=10,orientation=VERTICAL,un
itIncrement=1] 
Shape is : java.awt.geom.GeneralPath@58b7f Shape is :
java.awt.geom.GeneralPath@3dc777 
Shape is : java.awt.Rectangle[x=0,y=0,width=15,height=28] 
rect height = 28 
Shape is : java.awt.geom.Line2D$Float@7282a1 
Shape is : java.awt.geom.GeneralPath@5e4fa6 
Shape is : java.awt.geom.Line2D$Float@3f4547 
Shape is : java.awt.geom.Line2D$Float@5d669a 
Shape is : java.awt.geom.Line2D$Float@7b41d6
Shape is : java.awt.geom.Line2D$Float@1f6177 
Shape is : java.awt.geom.Line2D$Float@380316 
Shape is : java.awt.geom.Line2D$Float@529976 
Shape is : java.awt.geom.Line2D$Float@5941d7 
Shape is : java.awt.Rectangle[x=0,y=0,width=0,height=-1] 
rect height = -1 
Shape is : java.awt.Rectangle[x=0,y=0,width=0,height=-1] 
rect height = -1 

I thought that it was an error, but in fact I get an SVG image identical to
my JScrollPane.
And if I modify the height of the rectangle (height becomes 0), I loose the
rendering of my ScrollPane in my SVG Image.
The problem is localized about JPEGTrancoder that I call next, to trancode
my SVG image into JPEG Image.

Here the exception I get with JPEG conversion:

org.apache.batik.bridge.BridgeException:
file:/C:/WINNT/Profiles/ausebast.000/cache/documentInterface51913.svg:0
The attribute 'height' of the element <rect> can not be negative 	
at
org.apache.batik.bridge.UnitProcessor.svgLengthToUserSpace(UnitProcessor.jav
a:344) 	
at
org.apache.batik.bridge.UnitProcessor.svgVerticalLengthToUserSpace(UnitProce
ssor.java:273) 	
at
org.apache.batik.bridge.SVGRectElementBridge.buildShape(SVGRectElementBridge
.java:85) 	
at
org.apache.batik.bridge.SVGShapeElementBridge.createGraphicsNode(SVGShapeEle
mentBridge.java:44) 	
at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:170)

at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:136)

at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:176)

at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:136)

at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:176)

at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:136)

at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:176)

at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:136)

at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:176)

at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:136)

at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:176)

at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:136)

at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:176)

at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:136)

at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:176)

at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:136)

at org.apache.batik.bridge.GVTBuilder.build(GVTBuilder.java:69) 	
at
org.apache.batik.transcoder.image.ImageTranscoder.transcode(ImageTranscoder.
java:155) 	
at
org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTrans
coder.java:126)


Any Idea? 






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


Re: SwingSVGPrettyPrint and JPEGTranscoder

Posted by Thierry Kormann <tk...@ilog.fr>.
On Tuesday 03 July 2001 16:06, Sebastien Aurelie wrote:
> Hi,
>
> I need to paint a JScrollBar. I noticed that if the JScrollBar is very
> small you have only up and down buttons (no lift between), a fill3DRect to
> paint a rectangle with a negative height (-1) is called.
> You can see the trace I put in SVGShape.java and SVGRectangle.java:
>
>...
>
> I thought that it was an error, but in fact I get an SVG image identical to
> my JScrollPane.
> And if I modify the height of the rectangle (height becomes 0), I loose the
> rendering of my ScrollPane in my SVG Image.
> The problem is localized about JPEGTrancoder that I call next, to trancode
> my SVG image into JPEG Image.
>
> Here the exception I get with JPEG conversion:
>
> org.apache.batik.bridge.BridgeException:
> file:/C:/WINNT/Profiles/ausebast.000/cache/documentInterface51913.svg:0
> The attribute 'height' of the element <rect> can not be negative

The bridge module (the one that does the conversion from an SVG DOM tree to 
our data structure GVT) complains that a reactangle has a height equal to 0.

I have three comment on that:

1. You are not doing something wrong :)

2. According to the SVG spec
height: "A negative value is an error (see Error processing). A value of zero 
disables rendering of the element."

So, the bridge is wrong and should not complain. I will fix that ASAP.

3. The SVGGraphics2D might let the user know that something might go wrong 
(and let you a chance to fix that).

Thanks for your feedback.
Thierry.

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