当前位置: 首页>>代码示例>>C#>>正文


C# TIFF.tif_encodetile方法代码示例

本文整理汇总了C#中Free.Ports.LibTiff.TIFF.tif_encodetile方法的典型用法代码示例。如果您正苦于以下问题:C# TIFF.tif_encodetile方法的具体用法?C# TIFF.tif_encodetile怎么用?C# TIFF.tif_encodetile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Free.Ports.LibTiff.TIFF的用法示例。


在下文中一共展示了TIFF.tif_encodetile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TIFFWriteEncodedTile

        // Encode the supplied data and write it to the
        // specified tile. There must be space for the
        // data. The function clamps individual writes
        // to a tile to the tile size, but does not (and
        // can not) check that multiple writes to the same
        // tile do not write more than tile size data.
        //
        // NB:	Image length must be setup before writing; this
        //        interface does not support automatically growing
        //        the image on each write (as TIFFWriteScanline does).
        public static int TIFFWriteEncodedTile(TIFF tif, uint tile, byte[] data, int cc)
        {
            string module="TIFFWriteEncodedTile";
            ushort sample;

            if(!((tif.tif_flags&TIF_FLAGS.TIFF_BEENWRITING)!=0||TIFFWriteCheck(tif, true, module))) return -1;
            TIFFDirectory td=tif.tif_dir;
            if(tile>=td.td_nstrips)
            {
                TIFFErrorExt(tif.tif_clientdata, module, "{0}: Tile {1} out of range, max {2}", tif.tif_name, tile, td.td_nstrips);
                return -1;
            }

            // Handle delayed allocation of data buffer. This
            // permits it to be sized more intelligently (using
            // directory information).
            if(!BUFFERCHECK(tif)) return -1;

            tif.tif_curtile=tile;

            tif.tif_rawcc=0;
            tif.tif_rawcp=0;;

            if(td.td_stripbytecount[tile]>0)
            {
                // if we are writing over existing tiles, zero length.
                td.td_stripbytecount[tile]=0;

                // this forces TIFFAppendToStrip() to do a seek.
                tif.tif_curoff=0;
            }

            // Compute tiles per row & per column to compute
            // current row and column
            tif.tif_row=(tile%TIFFhowmany(td.td_imagelength, td.td_tilelength))*td.td_tilelength;
            tif.tif_col=(tile%TIFFhowmany(td.td_imagewidth, td.td_tilewidth))*td.td_tilewidth;

            if((tif.tif_flags&TIF_FLAGS.TIFF_CODERSETUP)==0)
            {
                if(!tif.tif_setupencode(tif)) return -1;
                tif.tif_flags|=TIF_FLAGS.TIFF_CODERSETUP;
            }

            tif.tif_flags&=~TIF_FLAGS.TIFF_POSTENCODE;
            sample=(ushort)(tile/td.td_stripsperimage);
            if(!tif.tif_preencode(tif, sample)) return -1;

            // Clamp write amount to the tile size. This is mostly
            // done so that callers can pass in some large number
            // (e.g. -1) and have the tile size used instead.
            if(cc<1||cc>tif.tif_tilesize) cc=tif.tif_tilesize;

            // swab if needed - note that source buffer will be altered
            tif.tif_postdecode(tif, data, 0, cc);

            if(!tif.tif_encodetile(tif, data, cc, sample)) return 0;
            if(!tif.tif_postencode(tif)) return -1;

            if(!isFillOrder(tif, td.td_fillorder)&&(tif.tif_flags&TIF_FLAGS.TIFF_NOBITREV)==0) TIFFReverseBits(tif.tif_rawdata, tif.tif_rawcc);

            if(tif.tif_rawcc>0&&!TIFFAppendToStrip(tif, tile, tif.tif_rawdata, tif.tif_rawcc)) return -1;

            tif.tif_rawcc=0;
            tif.tif_rawcp=0;

            return cc;
        }
开发者ID:JoshDullen,项目名称:libtiffN,代码行数:77,代码来源:tif_write.cs


注:本文中的Free.Ports.LibTiff.TIFF.tif_encodetile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。