private static void putRGBcontig8bitCMYKtile(
TiffRgbaImage img, int[] raster, int rasterOffset, int rasterShift,
int x, int y, int width, int height, byte[] buffer, int offset, int bufferShift)
{
int samplesperpixel = img.samplesperpixel;
bufferShift *= samplesperpixel;
while (height-- > 0)
{
int _x;
for (_x = width; _x >= 8; _x -= 8)
{
for (int rc = 0; rc < 8; rc++)
{
short k = (short)(255 - buffer[offset + 3]);
short r = (short)((k * (255 - buffer[offset])) / 255);
short g = (short)((k * (255 - buffer[offset + 1])) / 255);
short b = (short)((k * (255 - buffer[offset + 2])) / 255);
raster[rasterOffset] = PACK(r, g, b);
rasterOffset++;
offset += samplesperpixel;
}
}
if (_x > 0)
{
if (_x <= 7 && _x > 0)
{
for (int i = _x; i > 0; i--)
{
short k = (short)(255 - buffer[offset + 3]);
short r = (short)((k * (255 - buffer[offset])) / 255);
short g = (short)((k * (255 - buffer[offset + 1])) / 255);
short b = (short)((k * (255 - buffer[offset + 2])) / 255);
raster[rasterOffset] = PACK(r, g, b);
rasterOffset++;
offset += samplesperpixel;
}
}
}
rasterOffset += rasterShift;
offset += bufferShift;
}
}