iTextSharp.text.pdf.codec.TiffImage.DecodePackbits C# (CSharp) Метод

DecodePackbits() публичный статический Метод

public static DecodePackbits ( byte data, byte dst ) : void
data byte
dst byte
Результат void
        public static void DecodePackbits(byte[] data, byte[] dst)
        {
            int srcCount = 0, dstCount = 0;
            sbyte repeat, b;

            try {
                while (dstCount < dst.Length) {
                    b = (sbyte)data[srcCount++];
                    if (b >= 0 && b <= 127) {
                        // literal run packet
                        for (int i=0; i<(b + 1); i++) {
                            dst[dstCount++] = data[srcCount++];
                        }

                    } else if (b <= -1 && b >= -127) {
                        // 2 byte encoded run packet
                        repeat = (sbyte)data[srcCount++];
                        for (int i=0; i<(-b + 1); i++) {
                            dst[dstCount++] = (byte)repeat;
                        }
                    } else {
                        // no-op packet. Do nothing
                        srcCount++;
                    }
                }
            }
            catch {
            }
        }