iTextSharp.text.pdf.codec.LZWCompressor.Flush C# (CSharp) Метод

Flush() публичный Метод

public Flush ( ) : void
Результат void
        public void Flush()
        {
            if (prefix_ != -1)
                bf_.WriteBits(prefix_, numBits_);

            bf_.WriteBits(endOfInfo_, numBits_);
            bf_.Flush();
        }

Usage Example

Пример #1
0
        public static void CompressLZW(Stream stream, int predictor, byte[] b, int height, int samplesPerPixel, int stride)
        {
            LZWCompressor lzwCompressor = new LZWCompressor(stream, 8, true);
            bool          usePredictor  = predictor == TIFFConstants.PREDICTOR_HORIZONTAL_DIFFERENCING;

            if (!usePredictor)
            {
                lzwCompressor.Compress(b, 0, b.Length);
            }
            else
            {
                int    off    = 0;
                byte[] rowBuf = usePredictor ? new byte[stride] : null;
                for (int i = 0; i < height; i++)
                {
                    System.Array.Copy(b, off, rowBuf, 0, stride);
                    for (int j = stride - 1; j >= samplesPerPixel; j--)
                    {
                        rowBuf[j] -= rowBuf[j - samplesPerPixel];
                    }
                    lzwCompressor.Compress(rowBuf, 0, stride);
                    off += stride;
                }
            }

            lzwCompressor.Flush();
        }
All Usage Examples Of iTextSharp.text.pdf.codec.LZWCompressor::Flush