}
} else {
int srcSampleType = accessor.sampleType == PixelAccessor.TYPE_BIT ?
DataBuffer.TYPE_BYTE : accessor.sampleType;
UnpackedImageData uid = accessor.getPixels(raster, rect,
srcSampleType, false);
rect = uid.rect;
int lineStride = uid.lineStride;
int pixelStride = uid.pixelStride;
switch(uid.type) {
case DataBuffer.TYPE_BYTE:
byte[][] bdata = uid.getByteData();
for (int b = 0; b < accessor.numBands; b++) {
byte value = (byte)backgroundValues[b];
byte[] bd = bdata[b];
int lastLine = uid.bandOffsets[b] + rect.height * lineStride;
for (int lo = uid.bandOffsets[b]; lo < lastLine; lo += lineStride) {
int lastPixel = lo + rect.width * pixelStride;
for (int po = lo; po < lastPixel; po += pixelStride) {
bd[po] = value;
}
}
}
break;
case DataBuffer.TYPE_USHORT:
case DataBuffer.TYPE_SHORT:
short[][] sdata = uid.getShortData();
for (int b = 0; b < accessor.numBands; b++) {
short value = (short)backgroundValues[b];
short[] sd = sdata[b];
int lastLine = uid.bandOffsets[b] + rect.height * lineStride;
for (int lo = uid.bandOffsets[b]; lo < lastLine; lo += lineStride) {
int lastPixel = lo + rect.width * pixelStride;
for (int po = lo; po < lastPixel; po += pixelStride) {
sd[po] = value;
}
}
}
break;
case DataBuffer.TYPE_INT:
int[][] idata = uid.getIntData();
for (int b = 0; b < accessor.numBands; b++) {
int value = (int)backgroundValues[b];
int[] id = idata[b];
int lastLine = uid.bandOffsets[b] + rect.height * lineStride;
for (int lo = uid.bandOffsets[b]; lo < lastLine; lo += lineStride) {
int lastPixel = lo + rect.width * pixelStride;
for (int po = lo; po < lastPixel; po += pixelStride) {
id[po] = value;
}
}
}
break;
case DataBuffer.TYPE_FLOAT:
float[][] fdata = uid.getFloatData();
for (int b = 0; b < accessor.numBands; b++) {
float value = (float)backgroundValues[b];
float[] fd = fdata[b];
int lastLine = uid.bandOffsets[b] + rect.height * lineStride;
for (int lo = uid.bandOffsets[b]; lo < lastLine; lo += lineStride) {
int lastPixel = lo + rect.width * pixelStride;
for (int po = lo; po < lastPixel; po += pixelStride) {
fd[po] = value;
}
}
}
break;
case DataBuffer.TYPE_DOUBLE:
double[][] ddata = uid.getDoubleData();
for (int b = 0; b < accessor.numBands; b++) {
double value = backgroundValues[b];
double[] dd = ddata[b];
int lastLine = uid.bandOffsets[b] + rect.height * lineStride;