本文整理汇总了C#中Free.Ports.LibTiff.TIFF.tif_close方法的典型用法代码示例。如果您正苦于以下问题:C# TIFF.tif_close方法的具体用法?C# TIFF.tif_close怎么用?C# TIFF.tif_close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Free.Ports.LibTiff.TIFF
的用法示例。
在下文中一共展示了TIFF.tif_close方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TIFFWriteDirectory
// Write the contents of the current directory
// to the specified file. This routine doesn't
// handle overwriting a directory with auxiliary
// storage that's been changed.
static bool TIFFWriteDirectory(TIFF tif, bool done)
{
if(tif.tif_mode==O.RDONLY) return true;
// Clear write state so that subsequent images with
// different characteristics get the right buffers
// setup for them.
if(done)
{
if((tif.tif_flags&TIF_FLAGS.TIFF_POSTENCODE)!=0)
{
tif.tif_flags&=~TIF_FLAGS.TIFF_POSTENCODE;
if(!tif.tif_postencode(tif))
{
TIFFErrorExt(tif.tif_clientdata, tif.tif_name, "Error post-encoding before directory write");
return false;
}
}
tif.tif_close(tif); // shutdown encoder
// Flush any data that might have been written
// by the compression close+cleanup routines.
if(tif.tif_rawcc>0&&(tif.tif_flags&TIF_FLAGS.TIFF_BEENWRITING)!=0&&!TIFFFlushData1(tif))
{
TIFFErrorExt(tif.tif_clientdata, tif.tif_name, "Error flushing data before directory write");
return false;
}
tif.tif_rawdata=null;
tif.tif_rawcc=0;
tif.tif_rawdatasize=0;
tif.tif_flags&=~(TIF_FLAGS.TIFF_BEENWRITING|TIF_FLAGS.TIFF_BUFFERSETUP);
}
TIFFDirectory td=tif.tif_dir;
// Some Irfan view versions don't like RowsPerStrip set in tiled tifs
if(isTiled(tif)) TIFFClrFieldBit(tif, FIELD.ROWSPERSTRIP);
// Size the directory so that we can calculate
// offsets for the data items that aren't kept
// in-place in each field.
uint nfields=0;
uint[] fields=new uint[FIELD_SETLONGS];
for(FIELD b=0; b<=(FIELD)FIELD_LAST; b++)
{
if(TIFFFieldSet(tif, b)&&b!=FIELD.CUSTOM) nfields+=(b<FIELD.SUBFILETYPE?2u:1u);
}
nfields+=(uint)td.td_customValueCount;
int dirsize=(int)nfields*12; // 12: sizeof(TIFFDirEntry);
List<TIFFDirEntry> dirs=null;
try
{
dirs=new List<TIFFDirEntry>();
for(int i=0; i<nfields; i++) dirs.Add(new TIFFDirEntry());
}
catch
{
TIFFErrorExt(tif.tif_clientdata, tif.tif_name, "Cannot write directory, out of space");
return false;
}
// Directory hasn't been placed yet, put
// it at the end of the file and link it
// into the existing directory structure.
if(tif.tif_diroff==0&&!TIFFLinkDirectory(tif)) return false;
//tif.tif_dataoff=(uint)(tif.tif_diroff+sizeof(uint16)+dirsize+sizeof(toff_t));
tif.tif_dataoff=(uint)(tif.tif_diroff+2+dirsize+4);
if((tif.tif_dataoff&1)==1) tif.tif_dataoff++;
TIFFSeekFile(tif, tif.tif_dataoff, SEEK.SET);
tif.tif_curdir++;
// Setup external form of directory
// entries and write data items.
td.td_fieldsset.CopyTo(fields, 0);
// Write out ExtraSamples tag only if
// extra samples are present in the data.
if(FieldSet(fields, FIELD.EXTRASAMPLES)&&td.td_extrasamples==0)
{
ResetFieldBit(fields, FIELD.EXTRASAMPLES);
nfields--;
dirsize-=12; // 12: sizeof(TIFFDirEntry);
} // XXX
int dirsnumber=0;
TIFFTAG tag;
foreach(TIFFFieldInfo fip in tif.tif_fieldinfo)
{
TIFFDirEntry dir=(dirsnumber<dirs.Count)?dir=dirs[dirsnumber]:null;
//.........这里部分代码省略.........