예제 #1
0
        public static int[] Unpack(ImageInfo imgInfo, int[] src, int[] dst, bool scale)
        {
            int len1 = imgInfo.SamplesPerRow;
            int len0 = imgInfo.SamplesPerRowPacked;

            if (dst == null || dst.Length < len1)
            {
                dst = new int[len1];
            }
            if (imgInfo.Packed)
            {
                ImageLine.unpackInplaceInt(imgInfo, src, dst, scale);
            }
            else
            {
                Array.Copy(src, 0, dst, 0, len0);
            }
            return(dst);
        }
예제 #2
0
 void decodeLastReadRowToInt(int[] buffer, int bytesRead)    // see http://www.libpng.org/pub/png/spec/1.2/PNG-DataRep.html
 {
     if (ImgInfo.BitDepth <= 8)
     {
         for (int i = 0, j = 1; i < bytesRead; i++)
         {
             buffer[i] = (rowb[j++]);
         }
     }
     else     // 16 bitspc
     {
         for (int i = 0, j = 1; j < bytesRead; i++)
         {
             buffer[i] = (rowb[j++] << 8) + rowb[j++];
         }
     }
     if (ImgInfo.Packed && unpackedMode)
     {
         ImageLine.unpackInplaceInt(ImgInfo, buffer, buffer, false);
     }
 }