public int[] ReadRowInt(int[] buffer, int nrow) { if (buffer == null) { buffer = new int[unpackedMode ? ImgInfo.SamplesPerRow : ImgInfo.SamplesPerRowPacked]; } if (!interlaced) { if (nrow <= rowNum) { throw new PngjInputException("rows must be read in increasing order: " + nrow); } int bytesread = 0; while (rowNum < nrow) { bytesread = ReadRowRaw(rowNum + 1); // read rows, perhaps skipping if necessary } decodeLastReadRowToInt(buffer, bytesread); } else // interlaced { if (deinterlacer.getImageInt() == null) { deinterlacer.setImageInt(ReadRowsInt().Scanlines); // read all image and store it in deinterlacer } Array.Copy(deinterlacer.getImageInt()[nrow], 0, buffer, 0, unpackedMode ? ImgInfo.SamplesPerRow : ImgInfo.SamplesPerRowPacked); } return(buffer); }
public int[] ReadRowInt(int[] buffer, int nrow) { if (buffer == null) { buffer = new int[unpackedMode ? ImgInfo.SamplesPerRow : ImgInfo.SamplesPerRowPacked]; } if (!interlaced) { if (nrow <= rowNum) { throw new PngjInputException("rows must be read in increasing order: " + nrow.ToString()); } int bytesRead = 0; while (rowNum < nrow) { bytesRead = ReadRowRaw(rowNum + 1); } decodeLastReadRowToInt(buffer, bytesRead); } else { if (deinterlacer.getImageInt() == null) { deinterlacer.setImageInt(ReadRowsInt().Scanlines); } Array.Copy(deinterlacer.getImageInt()[nrow], 0, buffer, 0, unpackedMode ? ImgInfo.SamplesPerRow : ImgInfo.SamplesPerRowPacked); } return(buffer); }