public BufferedImage readBufferedImage() throws IOException {
colorModel = getColorModel();
sampleModel = getSampleModel();
WritableRaster raster = null;
BufferedImage image = j2krparam.getDestination();
int x = destinationRegion.x;
int y = destinationRegion.y;
destinationRegion.setLocation(j2krparam.getDestinationOffset());
if (image == null) {
ImageTypeSpecifier type = j2krparam.getDestinationType();
if (type != null)
colorModel = type.getColorModel();
raster = Raster.createWritableRaster(
sampleModel.createCompatibleSampleModel(destinationRegion.x +
destinationRegion.width,
destinationRegion.y +
destinationRegion.height),
new Point(0, 0));
image = new BufferedImage(colorModel, raster,
colorModel.isAlphaPremultiplied(),
new Hashtable());
} else
raster = image.getWritableTile(0, 0);
destImage = image;
readSubsampledRaster(raster);
destinationRegion.setLocation(x, y);
destImage = null;
return image;
}