WritableRaster dest,
Rectangle destRect) {
int formatTag = MediaLibAccessor.findCompatibleTag(sources, dest);
Raster source = sources[0];
MediaLibAccessor srcMA =
new MediaLibAccessor(source, source.getBounds(), formatTag);
MediaLibAccessor dstMA =
new MediaLibAccessor(dest, destRect, formatTag);
mediaLibImage[] srcMLI = srcMA.getMediaLibImages();
mediaLibImage[] dstMLI = dstMA.getMediaLibImages();
switch (dstMA.getDataType()) {
case DataBuffer.TYPE_BYTE:
case DataBuffer.TYPE_USHORT:
case DataBuffer.TYPE_SHORT:
case DataBuffer.TYPE_INT:
// computing medialibtable and calc for integral type and call
if (mlibInterpTableI==null){
InterpolationTable jtable = (InterpolationTable)interp;
mlibInterpTableI =
new mediaLibImageInterpTable(Constants.MLIB_INT,
jtable.getWidth(),
jtable.getHeight(),
jtable.getLeftPadding(),
jtable.getTopPadding(),
jtable.getSubsampleBitsH(),
jtable.getSubsampleBitsV(),
jtable.getPrecisionBits(),
jtable.getHorizontalTableData(),
jtable.getVerticalTableData());
}
if (setBackground)
for (int i = 0 ; i < dstMLI.length; i++) {
Image.GridWarpTable2(dstMLI[i], srcMLI[i],
xWarpPos, yWarpPos,
source.getMinX(),
source.getMinY(),
xStart - destRect.x,
xStep, xNumCells,
yStart - destRect.y,
yStep, yNumCells,
mlibInterpTableI,
Constants.MLIB_EDGE_DST_NO_WRITE,
intBackgroundValues);
}
else
for (int i = 0 ; i < dstMLI.length; i++) {
Image.GridWarpTable(dstMLI[i], srcMLI[i],
xWarpPos, yWarpPos,
source.getMinX(),
source.getMinY(),
xStart - destRect.x,
xStep, xNumCells,
yStart - destRect.y,
yStep, yNumCells,
mlibInterpTableI,
Constants.MLIB_EDGE_DST_NO_WRITE);
MlibUtils.clampImage(dstMLI[i], getColorModel());
}
break;
case DataBuffer.TYPE_FLOAT:
if (mlibInterpTableF==null){
InterpolationTable jtable = (InterpolationTable)interp;
mlibInterpTableF =
new mediaLibImageInterpTable(Constants.MLIB_FLOAT,
jtable.getWidth(),
jtable.getHeight(),
jtable.getLeftPadding(),
jtable.getTopPadding(),
jtable.getSubsampleBitsH(),
jtable.getSubsampleBitsV(),
jtable.getPrecisionBits(),
jtable.getHorizontalTableDataFloat(),
jtable.getVerticalTableDataFloat());
}
if (setBackground)
for (int i = 0 ; i < dstMLI.length; i++) {
Image.GridWarpTable2_Fp(dstMLI[i], srcMLI[i],
xWarpPos, yWarpPos,
source.getMinX(),
source.getMinY(),
xStart - destRect.x,
xStep, xNumCells,
yStart - destRect.y,
yStep, yNumCells,
mlibInterpTableF,
Constants.MLIB_EDGE_DST_NO_WRITE,
backgroundValues);
}
else
for (int i = 0 ; i < dstMLI.length; i++) {
Image.GridWarpTable_Fp(dstMLI[i], srcMLI[i],
xWarpPos, yWarpPos,
source.getMinX(),
source.getMinY(),
xStart - destRect.x,
xStep, xNumCells,
yStart - destRect.y,
yStep, yNumCells,
mlibInterpTableF,
Constants.MLIB_EDGE_DST_NO_WRITE);
}
break;
case DataBuffer.TYPE_DOUBLE:
if (mlibInterpTableD == null){
InterpolationTable jtable = (InterpolationTable)interp;
mlibInterpTableD =
new mediaLibImageInterpTable(Constants.MLIB_DOUBLE,
jtable.getWidth(),
jtable.getHeight(),
jtable.getLeftPadding(),
jtable.getTopPadding(),
jtable.getSubsampleBitsH(),
jtable.getSubsampleBitsV(),
jtable.getPrecisionBits(),
jtable.getHorizontalTableDataDouble(),
jtable.getVerticalTableDataDouble());
}
if (setBackground)
for (int i = 0 ; i < dstMLI.length; i++) {
Image.GridWarpTable2_Fp(dstMLI[i], srcMLI[i],
xWarpPos, yWarpPos,
source.getMinX(),
source.getMinY(),
xStart - destRect.x,
xStep, xNumCells,
yStart - destRect.y,
yStep, yNumCells,
mlibInterpTableD,
Constants.MLIB_EDGE_DST_NO_WRITE,
backgroundValues);
}
else
for (int i = 0 ; i < dstMLI.length; i++) {
Image.GridWarpTable_Fp(dstMLI[i], srcMLI[i],
xWarpPos, yWarpPos,
source.getMinX(),
source.getMinY(),
xStart - destRect.x,
xStep, xNumCells,
yStart - destRect.y,
yStep, yNumCells,
mlibInterpTableD,