示例#1
0
 public byte[] ReadRowByte(byte[] buffer, int nrow)
 {
     if (buffer == null)
     {
         buffer = new byte[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
         }
         decodeLastReadRowToByte(buffer, bytesread);
     }
     else     // interlaced
     {
         if (deinterlacer.getImageByte() == null)
         {
             deinterlacer.setImageByte(ReadRowsByte().ScanlinesB); // read all image and store it in deinterlacer
         }
         Array.Copy(deinterlacer.getImageByte()[nrow], 0, buffer, 0, unpackedMode ? ImgInfo.SamplesPerRow
                 : ImgInfo.SamplesPerRowPacked);
     }
     return(buffer);
 }
示例#2
0
 public byte[] ReadRowByte(byte[] buffer, int nrow)
 {
     if (buffer == null)
     {
         buffer = new byte[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);
         }
         decodeLastReadRowToByte(buffer, bytesRead);
     }
     else
     {
         if (deinterlacer.getImageByte() == null)
         {
             deinterlacer.setImageByte(ReadRowsByte().ScanlinesB);
         }
         Array.Copy(deinterlacer.getImageByte()[nrow], 0, buffer, 0, unpackedMode ? ImgInfo.SamplesPerRow : ImgInfo.SamplesPerRowPacked);
     }
     return(buffer);
 }