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

StripSize() public method

Computes the number of bytes in a row-aligned strip.

StripSize returns the equivalent size for a strip of data as it would be returned in a call to ReadEncodedStrip or as it would be expected in a call to O:BitMiracle.LibTiff.Classic.Tiff.WriteEncodedStrip.

If the value of the field corresponding to TiffTag.ROWSPERSTRIP is larger than the recorded TiffTag.IMAGELENGTH, then the strip size is truncated to reflect the actual space required to hold the strip.

public StripSize ( ) : int
return int
        public int StripSize()
        {
            int rps = m_dir.td_rowsperstrip;
            if (rps > m_dir.td_imagelength)
                rps = m_dir.td_imagelength;

            return VStripSize(rps);
        }

Usage Example

コード例 #1
0
ファイル: Copier.cs プロジェクト: XiBeichuan/hydronumerics
        static bool writeBufferToSeparateStrips(Tiff outImage, byte[] buf, int imagelength, int imagewidth, short spp)
        {
            byte[] obuf = new byte[outImage.StripSize()];

            FieldValue[] result = outImage.GetFieldDefaulted(TiffTag.ROWSPERSTRIP);
            int rowsperstrip = result[0].ToInt();

            int rowsize = imagewidth * spp;
            int strip = 0;

            for (short s = 0; s < spp; s++)
            {
                for (int row = 0; row < imagelength; row += rowsperstrip)
                {
                    int nrows = (row + rowsperstrip > imagelength) ? imagelength - row : rowsperstrip;
                    int stripsize = outImage.VStripSize(nrows);

                    cpContigBufToSeparateBuf(obuf, buf, row * rowsize + s, nrows, imagewidth, 0, 0, spp, 1);
                    if (outImage.WriteEncodedStrip(strip++, obuf, stripsize) < 0)
                    {
                        Tiff.Error(outImage.FileName(), "Error, can't write strip {0}", strip - 1);
                        return false;
                    }
                }
            }

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