コード例 #1
0
 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);
 }
コード例 #2
0
ファイル: PngReader.cs プロジェクト: 1144822034/sc2.2mobile
 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);
 }