3

由于我更新到 JRE 1.7.0_25,蜡染在应用转换时会抛出异常。

堆栈跟踪是:

java.awt.image.ImagingOpException: Unable to transform src image
at java.awt.image.AffineTransformOp.filter(Unknown Source)
at org.apache.batik.ext.awt.image.rendered.AffineRed.genRect(AffineRed.java:193)
at org.apache.batik.ext.awt.image.rendered.AffineRed.copyData(AffineRed.java:109)
at org.apache.batik.ext.awt.image.rendered.PadRed.copyData(PadRed.java:88)
at org.apache.batik.ext.awt.image.rendered.PadRed.copyData(PadRed.java:88)
at org.apache.batik.ext.awt.image.rendered.Any2sRGBRed.copyData(Any2sRGBRed.java:166)
at org.apache.batik.ext.awt.image.rendered.AbstractRed.getData(AbstractRed.java:526)
at org.apache.batik.ext.awt.image.GraphicsUtil.drawImage(GraphicsUtil.java:264)
at org.apache.batik.ext.awt.image.GraphicsUtil.drawImage(GraphicsUtil.java:455)
at org.apache.batik.gvt.AbstractGraphicsNode.paint(AbstractGraphicsNode.java:549)
at org.apache.batik.gvt.ShapeNode.paint(ShapeNode.java:143)
at org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(CompositeGraphicsNode.java:165)
at org.apache.batik.gvt.AbstractGraphicsNode.paint(AbstractGraphicsNode.java:509)
at org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(CompositeGraphicsNode.java:165)
at org.apache.batik.gvt.filter.GraphicsNodeRed8Bit.genRect(GraphicsNodeRed8Bit.java:140)
at org.apache.batik.gvt.filter.GraphicsNodeRed8Bit.copyData(GraphicsNodeRed8Bit.java:116)
at org.apache.batik.ext.awt.image.rendered.PadRed.copyData(PadRed.java:88)
at org.apache.batik.ext.awt.image.rendered.Any2LsRGBRed.copyData(Any2LsRGBRed.java:109)
at org.apache.batik.ext.awt.image.rendered.AbstractRed.getData(AbstractRed.java:526)
at org.apache.batik.ext.awt.image.rendered.CompositeRed.genRect(CompositeRed.java:188)
at org.apache.batik.ext.awt.image.rendered.CompositeRed.copyData(CompositeRed.java:139)
at org.apache.batik.ext.awt.image.rendered.Any2sRGBRed.copyData(Any2sRGBRed.java:166)
at org.apache.batik.ext.awt.image.GraphicsUtil.drawImage(GraphicsUtil.java:347)
at org.apache.batik.ext.awt.image.GraphicsUtil.drawImage(GraphicsUtil.java:455)
at org.apache.batik.ext.awt.image.renderable.PadRable8Bit.paintRable(PadRable8Bit.java:135)
at org.apache.batik.ext.awt.image.GraphicsUtil.drawImage(GraphicsUtil.java:440)
at org.apache.batik.ext.awt.image.renderable.PadRable8Bit.paintRable(PadRable8Bit.java:135)
at org.apache.batik.ext.awt.image.GraphicsUtil.drawImage(GraphicsUtil.java:440)
at org.apache.batik.ext.awt.image.renderable.FilterChainRable8Bit.paintRable(FilterChainRable8Bit.java:251)
at org.apache.batik.ext.awt.image.GraphicsUtil.drawImage(GraphicsUtil.java:440)
at org.apache.batik.gvt.AbstractGraphicsNode.paint(AbstractGraphicsNode.java:549)
at org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(CompositeGraphicsNode.java:165)
at org.apache.batik.gvt.AbstractGraphicsNode.paint(AbstractGraphicsNode.java:509)
at org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(CompositeGraphicsNode.java:165)
at org.apache.batik.gvt.CanvasGraphicsNode.primitivePaint(CanvasGraphicsNode.java:159)
at org.apache.batik.gvt.AbstractGraphicsNode.paint(AbstractGraphicsNode.java:509)
at org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(CompositeGraphicsNode.java:165)
at org.apache.batik.gvt.filter.GraphicsNodeRed8Bit.genRect(GraphicsNodeRed8Bit.java:140)
at org.apache.batik.gvt.filter.GraphicsNodeRed8Bit.copyData(GraphicsNodeRed8Bit.java:116)
at org.apache.batik.ext.awt.image.rendered.TranslateRed.copyData(TranslateRed.java:105)
at org.apache.batik.gvt.renderer.DynamicRenderer.repaint(DynamicRenderer.java:244)
at org.apache.batik.gvt.renderer.StaticRenderer.repaint(StaticRenderer.java:344)
at org.apache.batik.swing.gvt.GVTTreeRenderer.run(GVTTreeRenderer.java:123)

在 AffineRed.java的这一行抛出异常。

有谁可以解决这个问题,或者这是 JRE 中的一个临时错误?

4

2 回答 2

3

这是 Java 7 Update 25 中的回归。更糟糕的是,Oracle 似乎将回归的修复推迟到 Update 60。这不像任何人都依赖 Java。谢谢,甲骨文!

Batik 邮件列表中的这篇文章简要描述了如何避免该问题:

到目前为止,我能找到的唯一解决方法是修补 BATIK 源,使其不再直接在源图像和目标图像上调用 BufferedImageOp.filter,而是过滤两个 ARGB BufferedImage 副本。

遗憾的是,这意味着如果源图像和目标图像碰巧不是 ARGB,则必须复制它们。

于 2013-07-24T08:58:45.587 回答
3

Thomas Behr(写这篇文章的人)创建了一个补丁,使用兄弟答案中描述的解决方法解决了这个问题。

当我问他时,他好心地把它发给了我,由于有很多人就这个补丁与我联系过,我决定真诚地发布它,托马斯不介意。

将它应用在 Batik 1.7 源之上,你应该没问题。

于 2014-05-12T12:23:59.780 回答