bool readSeparateStripsIntoBuffer(Tiff inImage, byte[] buf, int imagelength, int imagewidth, short spp)
{
int scanlinesize = inImage.ScanlineSize();
if (scanlinesize == 0)
return false;
byte[] scanline = new byte[scanlinesize];
int bufp = 0;
for (int row = 0; row < imagelength; row++)
{
/* merge channels */
for (short s = 0; s < spp; s++)
{
if (!inImage.ReadScanline(scanline, row, s) && !m_ignore)
{
Tiff.Error(inImage.FileName(), "Error, can't read scanline {0}", row);
return false;
}
int n = scanlinesize;
int bp = s;
int sbuf = 0;
while (n-- > 0)
{
buf[bufp + bp] = scanline[sbuf];
sbuf++;
bp += spp;
}
}
bufp += scanlinesize * spp;
}
return true;
}