public ImageLines ReadRowsInt(int rowOffset, int nRows, int rowStep)
{
if (nRows < 0)
nRows = (ImgInfo.Rows - rowOffset) / rowStep;
if (rowStep < 1 || rowOffset < 0 || nRows * rowStep + rowOffset > ImgInfo.Rows)
throw new PngjInputException("bad args");
ImageLines imlines = new ImageLines(ImgInfo, ImageLine.ESampleType.INT, unpackedMode, rowOffset, nRows, rowStep);
if (!interlaced) {
for (int j = 0; j < ImgInfo.Rows; j++) {
int bytesread = ReadRowRaw(j); // read and perhaps discards
int mrow = imlines.ImageRowToMatrixRowStrict(j);
if (mrow >= 0)
decodeLastReadRowToInt(imlines.Scanlines[mrow], bytesread);
}
} else { // and now, for something completely different (interlaced)
int[] buf = new int[unpackedMode ? ImgInfo.SamplesPerRow : ImgInfo.SamplesPerRowPacked];
for (int p = 1; p <= 7; p++) {
deinterlacer.setPass(p);
for (int i = 0; i < deinterlacer.getRows(); i++) {
int bytesread = ReadRowRaw(i);
int j = deinterlacer.getCurrRowReal();
int mrow = imlines.ImageRowToMatrixRowStrict(j);
if (mrow >= 0) {
decodeLastReadRowToInt(buf, bytesread);
deinterlacer.deinterlaceInt(buf, imlines.Scanlines[mrow], !unpackedMode);
}
}
}
}
End();
return imlines;
}