int srcRectY = srcRect.y;
//
// Get data for the source rectangle & the destination rectangle
//
RasterAccessor srcAccessor =
new RasterAccessor(source,
srcRect,
formatTags[0],
getSourceImage(0).getColorModel());
RasterAccessor dstAccessor =
new RasterAccessor(dest,
destRect,
formatTags[1],
getColorModel());
switch (dstAccessor.getDataType()) {
case DataBuffer.TYPE_BYTE:
int dstNumBands = dstAccessor.getNumBands();
if (dstNumBands == 1) {
byteLoop_1band(srcAccessor,
destRect,
srcRectX,
srcRectY,
dstAccessor);
} else if (dstNumBands == 3) {
byteLoop_3band(srcAccessor,
destRect,
srcRectX,
srcRectY,
dstAccessor);
} else {
byteLoop(srcAccessor,
destRect,
srcRectX,
srcRectY,
dstAccessor);
}
break;
case DataBuffer.TYPE_INT:
intLoop(srcAccessor,
destRect,
srcRectX,
srcRectY,
dstAccessor);
break;
case DataBuffer.TYPE_SHORT:
case DataBuffer.TYPE_USHORT:
shortLoop(srcAccessor,
destRect,
srcRectX,
srcRectY,
dstAccessor);
break;
case DataBuffer.TYPE_FLOAT:
floatLoop(srcAccessor,
destRect,
srcRectX,
srcRectY,
dstAccessor);
break;
case DataBuffer.TYPE_DOUBLE:
doubleLoop(srcAccessor,
destRect,
srcRectX,
srcRectY,
dstAccessor);
break;
}
//
// If the RasterAccessor object set up a temporary buffer for the
// op to write to, tell the RasterAccessor to write that data
// to the raster, that we're done with it.
//
if (dstAccessor.isDataCopy()) {
dstAccessor.clampDataArrays();
dstAccessor.copyDataToRaster();
}
}