Rectangle destRect) {
// Retrieve format tags.
RasterFormatTag[] formatTags = getFormatTags();
/* For PointOpImage, srcRect = destRect. */
RasterAccessor s1 = new RasterAccessor(sources[0], destRect,
formatTags[0],
getSourceImage(0).getColorModel());
RasterAccessor s2 = new RasterAccessor(sources[1], destRect,
formatTags[1],
getSourceImage(1).getColorModel());
RasterAccessor d = new RasterAccessor(dest, destRect,
formatTags[2], getColorModel());
if(d.isBinary()) {
byte[] src1Bits = s1.getBinaryDataArray();
byte[] src2Bits = s2.getBinaryDataArray();
byte[] dstBits = d.getBinaryDataArray();
int length = dstBits.length;
for(int i = 0; i < length; i++) {
dstBits[i] = (byte)(src1Bits[i] & src2Bits[i]);
}
d.copyBinaryDataToRaster();
return;
}
int src1LineStride = s1.getScanlineStride();
int src1PixelStride = s1.getPixelStride();
int[] src1BandOffsets = s1.getBandOffsets();
int src2LineStride = s2.getScanlineStride();
int src2PixelStride = s2.getPixelStride();
int[] src2BandOffsets = s2.getBandOffsets();
int dstNumBands = d.getNumBands();
int dstWidth = d.getWidth();
int dstHeight = d.getHeight();
int dstLineStride = d.getScanlineStride();
int dstPixelStride = d.getPixelStride();
int[] dstBandOffsets = d.getBandOffsets();
switch (d.getDataType()) {
case DataBuffer.TYPE_BYTE:
byteLoop(dstNumBands, dstWidth, dstHeight,
src1LineStride, src1PixelStride,
src1BandOffsets, s1.getByteDataArrays(),
src2LineStride, src2PixelStride,
src2BandOffsets, s2.getByteDataArrays(),
dstLineStride, dstPixelStride,
dstBandOffsets, d.getByteDataArrays());
break;
case DataBuffer.TYPE_USHORT:
case DataBuffer.TYPE_SHORT:
shortLoop(dstNumBands, dstWidth, dstHeight,
src1LineStride, src1PixelStride,
src1BandOffsets, s1.getShortDataArrays(),
src2LineStride, src2PixelStride,
src2BandOffsets, s2.getShortDataArrays(),
dstLineStride, dstPixelStride,
dstBandOffsets, d.getShortDataArrays());
break;
case DataBuffer.TYPE_INT:
intLoop(dstNumBands, dstWidth, dstHeight,
src1LineStride, src1PixelStride,
src1BandOffsets, s1.getIntDataArrays(),
src2LineStride, src2PixelStride,
src2BandOffsets, s2.getIntDataArrays(),
dstLineStride, dstPixelStride,
dstBandOffsets, d.getIntDataArrays());
break;
}
d.copyDataToRaster();
}