bilevelImage.putPackedBytes(0, y, getBoundsWidth(), buffer, x1 / 8, x1 % 8);
break;
}
case(2):
{
Gray8Image grayImage = (Gray8Image)image;
byte[] dest = new byte[width + 3];
ArrayConverter.convertPacked2BitIntensityTo8Bit(buffer, 0, dest, 0, buffer.length);
grayImage.putByteSamples(0, 0, y, getBoundsWidth(), 1, dest, getBoundsX1());
break;
}
case(4):
{
Gray8Image grayImage = (Gray8Image)image;
byte[] dest = new byte[width + 1];
ArrayConverter.convertPacked4BitIntensityTo8Bit(buffer, 0, dest, 0, buffer.length);
grayImage.putByteSamples(0, 0, y, getBoundsWidth(), 1, dest, getBoundsX1());
break;
}
case(8):
{
Gray8Image grayImage = (Gray8Image)image;
int offset = getBoundsX1();
int x = 0;
int k = getBoundsWidth();
while (k > 0)
{
grayImage.putSample(0, x++, y, buffer[offset++]);
k--;
}
break;
}
case(16):
{
Gray16Image grayImage = (Gray16Image)image;
int offset = getBoundsX1();
int x = 0;
int k = getBoundsWidth();
while (k > 0)
{
int sample = (buffer[offset++] & 0xff) << 8;
sample |= (buffer[offset++] & 0xff);
grayImage.putSample(x++, y, sample);
k--;
}
break;
}
}