You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by "Radu Coravu (JIRA)" <ji...@apache.org> on 2016/05/18 07:21:12 UTC
[jira] [Commented] (BATIK-1150) ArrayIndexOutOfBoundsException when
referencing PNG with 8-bit color
[ https://issues.apache.org/jira/browse/BATIK-1150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15288553#comment-15288553 ]
Radu Coravu commented on BATIK-1150:
------------------------------------
The problem is that the PNG has only one band and the GraphicsUtil tries to copy pixels from an image with one band to an image with 3 bands.
As a possible suggested fix on the method:
org.apache.batik.ext.awt.image.rendered.Any2sRGBRed.copyData(WritableRaster)
at some point there is a comparison like:
{code}if (srcCM.getColorSpace() == dstCM.getColorSpace()){
///Calls the GraphicsUtil part
}
{code}
which could be rewritten like:
{code} if (srcCM.getColorSpace() == dstCM.getColorSpace()
// If the number of bands do not match, also perform forced conversion...
&& srcSM.getNumBands() == wr.getNumBands()) {
.....
{code}
> ArrayIndexOutOfBoundsException when referencing PNG with 8-bit color
> --------------------------------------------------------------------
>
> Key: BATIK-1150
> URL: https://issues.apache.org/jira/browse/BATIK-1150
> Project: Batik
> Issue Type: Bug
> Components: SVG Rasterizer
> Affects Versions: 1.8
> Reporter: Radu Coravu
> Fix For: 1.8
>
> Attachments: small_panel.svg, test.png
>
> Original Estimate: 3h
> Remaining Estimate: 3h
>
> I have an SVG which references a PNG which has an 8-bit color space (only one band).
> Rendering the SVG using Batik 1.8 fails with an exception like:
> {code}java.lang.ArrayIndexOutOfBoundsException: 405
> at java.awt.image.SinglePixelPackedSampleModel.setPixels(SinglePixelPackedSampleModel.java:671)
> at java.awt.image.WritableRaster.setPixels(WritableRaster.java:550)
> at sun.awt.image.SunWritableRaster.setPixels(SunWritableRaster.java:176)
> at org.apache.batik.ext.awt.image.GraphicsUtil.copyData_FALLBACK(GraphicsUtil.java:838)
> at org.apache.batik.ext.awt.image.GraphicsUtil.copyData(GraphicsUtil.java:857)
> at org.apache.batik.ext.awt.image.rendered.Any2sRGBRed.copyData(Any2sRGBRed.java:261)
> at org.apache.batik.ext.awt.image.rendered.FormatRed.copyData(Unknown Source)
> at org.apache.batik.ext.awt.image.rendered.AbstractRed.getData(AbstractRed.java:530)
> at org.apache.batik.ext.awt.image.rendered.AbstractRed.getData(AbstractRed.java:515)
> at org.apache.batik.ext.awt.image.codec.imageio.AbstractImageIORegistryEntry$1.run(AbstractImageIORegistryEntry.java:142){code}
> I'm attaching the SVG and PNG
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org