BitMiracle.LibTiff.Classic.Tiff.WriteEncodedStrip C# (CSharp) Method

WriteEncodedStrip() public method

Encodes and writes a strip of data to an open TIFF file/stream.

WriteEncodedStrip encodes count bytes of raw data from buffer and append the result to the specified strip; replacing any previously written data. Note that the value of strip is a "raw strip number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeStrip automatically does this when converting an (row, plane) to a strip index.

If there is no space for the strip, the value of TiffTag.IMAGELENGTH tag is automatically increased to include the strip (except for TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE, where the TiffTag.IMAGELENGTH tag cannot be changed once the first data are written). If the TiffTag.IMAGELENGTH is increased, the values of TiffTag.STRIPOFFSETS and TiffTag.STRIPBYTECOUNTS tags are similarly enlarged to reflect data written past the previous end of image.

The library writes encoded data using the native machine byte order. Correctly implemented TIFF readers are expected to do any necessary byte-swapping to correctly process image data with value of TiffTag.BITSPERSAMPLE tag greater than 8.

public WriteEncodedStrip ( int strip, byte buffer, int count ) : int
strip int The zero-based index of the strip to write.
buffer byte The buffer with image data to be encoded and written.
count int The maximum number of strip bytes to be read from /// .
return int
        public int WriteEncodedStrip(int strip, byte[] buffer, int count)
        {
            return WriteEncodedStrip(strip, buffer, 0, count);
        }

Same methods

Tiff::WriteEncodedStrip ( int strip, byte buffer, int offset, int count ) : int

Usage Example

示例#1
0
        /*
         * Strip -> strip for change in encoding.
         */
        bool cpDecodedStrips(Tiff inImage, Tiff outImage, int imagelength, int imagewidth, short spp)
        {
            int stripsize = inImage.StripSize();
            byte[] buf = new byte[stripsize];
            int ns = inImage.NumberOfStrips();
            int row = 0;
            for (int s = 0; s < ns; s++)
            {
                int cc = (row + m_rowsperstrip > imagelength) ? inImage.VStripSize(imagelength - row) : stripsize;
                if (inImage.ReadEncodedStrip(s, buf, 0, cc) < 0 && !m_ignore)
                {
                    Tiff.Error(inImage.FileName(), "Error, can't read strip {0}", s);
                    return false;
                }

                if (outImage.WriteEncodedStrip(s, buf, cc) < 0)
                {
                    Tiff.Error(outImage.FileName(), "Error, can't write strip {0}", s);
                    return false;
                }

                row += m_rowsperstrip;
            }

            return true;
        }
All Usage Examples Of BitMiracle.LibTiff.Classic.Tiff::WriteEncodedStrip
Tiff