-
Bug
-
Resolution: Fixed
-
P3
-
5.0
FULL PRODUCT VERSION :
java version "1.5.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09)
Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
An error occurs if the following conditions are met:
1. Rendering an image (source) into the graphics of another image (target)
2. The images only partially overlap (graphics.translate on target)
3. The target image is a custom BufferedImage of type BYTE4_RGBA
4. JRE 1.4.2 or later (no problems with 1.3.1 and 1.4.1)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the sample code
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
no ArrayIndexOutOfBoundsException
ACTUAL -
an ArrayIndexOutOfBoundsException
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Coordinate
out of bounds!
at sun.awt.image.ByteInterleavedRaster.getDataElements(Unknown Source)
at sun.java2d.loops.OpaqueCopyAnyToArgb.Blit(Unknown Source)
at sun.java2d.loops.GraphicsPrimitive.convertFrom(Unknown Source)
at sun.java2d.loops.MaskBlit$General.MaskBlit(Unknown Source)
at sun.java2d.loops.Blit$GeneralMaskBlit.Blit(Unknown Source)
at sun.java2d.pipe.DrawImage.blitSurfaceData(Unknown Source)
at sun.java2d.pipe.DrawImage.renderImageCopy(Unknown Source)
at sun.java2d.pipe.DrawImage.copyImage(Unknown Source)
at sun.java2d.pipe.DrawImage.copyImage(Unknown Source)
at sun.java2d.pipe.ValidatePipe.copyImage(Unknown Source)
at sun.java2d.SunGraphics2D.drawImage(Unknown Source)
at sun.java2d.SunGraphics2D.drawImage(Unknown Source)
at com.eurotronics.test.lander.ImageOverlay.main(ImageOverlay.java:14)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package com.eurotronics.test.lander;
import java.awt.*;
import java.awt.color.ColorSpace;
import java.awt.image.*;
public class ImageOverlay
{
static public void main(String[] args)
{
BufferedImage image = createImage(600,600);
Graphics2D graphics = image.createGraphics();
graphics.translate(-100,0);
graphics.drawImage(new BufferedImage(200,200,BufferedImage.TYPE_INT_RGB),null,null);
graphics.dispose();
}
static private BufferedImage createImage(int width,int height)
{
/* Create the data buffer */
DataBufferByte dataBuffer = new DataBufferByte(width*height*4);
/* Create the color model */
ColorSpace colorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB);
int[] nBits = {8, 8, 8, 8};
ColorModel colorModel = new ComponentColorModel(colorSpace,nBits,true/*has-alpha*/,false/*alpha-premul*/,
Transparency.TRANSLUCENT,DataBuffer.TYPE_BYTE);
/* Create the raster */
int[] bOffs = {0, 1, 2, 3};
WritableRaster raster = Raster.createInterleavedRaster(dataBuffer,width,height,
width*4/*linestride*/,4/*pixelstride*/,bOffs/*bandoffsets*/,null/*location*/);
/* Create the buffered image */
return new BufferedImage(colorModel,raster,colorModel.isAlphaPremultiplied(),null/*properties*/);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
none found
Release Regression From : 1.3.1
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
###@###.### 2005-05-11 12:50:45 GMT
java version "1.5.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09)
Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
An error occurs if the following conditions are met:
1. Rendering an image (source) into the graphics of another image (target)
2. The images only partially overlap (graphics.translate on target)
3. The target image is a custom BufferedImage of type BYTE4_RGBA
4. JRE 1.4.2 or later (no problems with 1.3.1 and 1.4.1)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the sample code
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
no ArrayIndexOutOfBoundsException
ACTUAL -
an ArrayIndexOutOfBoundsException
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Coordinate
out of bounds!
at sun.awt.image.ByteInterleavedRaster.getDataElements(Unknown Source)
at sun.java2d.loops.OpaqueCopyAnyToArgb.Blit(Unknown Source)
at sun.java2d.loops.GraphicsPrimitive.convertFrom(Unknown Source)
at sun.java2d.loops.MaskBlit$General.MaskBlit(Unknown Source)
at sun.java2d.loops.Blit$GeneralMaskBlit.Blit(Unknown Source)
at sun.java2d.pipe.DrawImage.blitSurfaceData(Unknown Source)
at sun.java2d.pipe.DrawImage.renderImageCopy(Unknown Source)
at sun.java2d.pipe.DrawImage.copyImage(Unknown Source)
at sun.java2d.pipe.DrawImage.copyImage(Unknown Source)
at sun.java2d.pipe.ValidatePipe.copyImage(Unknown Source)
at sun.java2d.SunGraphics2D.drawImage(Unknown Source)
at sun.java2d.SunGraphics2D.drawImage(Unknown Source)
at com.eurotronics.test.lander.ImageOverlay.main(ImageOverlay.java:14)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package com.eurotronics.test.lander;
import java.awt.*;
import java.awt.color.ColorSpace;
import java.awt.image.*;
public class ImageOverlay
{
static public void main(String[] args)
{
BufferedImage image = createImage(600,600);
Graphics2D graphics = image.createGraphics();
graphics.translate(-100,0);
graphics.drawImage(new BufferedImage(200,200,BufferedImage.TYPE_INT_RGB),null,null);
graphics.dispose();
}
static private BufferedImage createImage(int width,int height)
{
/* Create the data buffer */
DataBufferByte dataBuffer = new DataBufferByte(width*height*4);
/* Create the color model */
ColorSpace colorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB);
int[] nBits = {8, 8, 8, 8};
ColorModel colorModel = new ComponentColorModel(colorSpace,nBits,true/*has-alpha*/,false/*alpha-premul*/,
Transparency.TRANSLUCENT,DataBuffer.TYPE_BYTE);
/* Create the raster */
int[] bOffs = {0, 1, 2, 3};
WritableRaster raster = Raster.createInterleavedRaster(dataBuffer,width,height,
width*4/*linestride*/,4/*pixelstride*/,bOffs/*bandoffsets*/,null/*location*/);
/* Create the buffered image */
return new BufferedImage(colorModel,raster,colorModel.isAlphaPremultiplied(),null/*properties*/);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
none found
Release Regression From : 1.3.1
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
###@###.### 2005-05-11 12:50:45 GMT