int scaleY = param.getSourceYSubsampling();
int xOffset = param.getSubsamplingXOffset();
int yOffset = param.getSubsamplingYOffset();
// If the destination is provided, then use it. Otherwise, create new one
BufferedImage bi = param.getDestination();
if (bi == null)
bi = new BufferedImage(destinationRegion.x + destinationRegion.width,
destinationRegion.y + destinationRegion.height,
BufferedImage.TYPE_BYTE_BINARY);
boolean noTransform =
destinationRegion.equals(new Rectangle(0, 0, width, height)) &&
destinationRegion.equals(new Rectangle(0, 0, bi.getWidth(), bi.getHeight()));
// Get the image data.
WritableRaster tile = bi.getWritableTile(0, 0);
// Get the SampleModel.
MultiPixelPackedSampleModel sm =
(MultiPixelPackedSampleModel)bi.getSampleModel();
if (noTransform) {
if (abortRequested()) {
processReadAborted();
return bi;