本文整理汇总了C#中Free.Ports.LibTiff.TIFF.tif_decoderow方法的典型用法代码示例。如果您正苦于以下问题:C# TIFF.tif_decoderow方法的具体用法?C# TIFF.tif_decoderow怎么用?C# TIFF.tif_decoderow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Free.Ports.LibTiff.TIFF
的用法示例。
在下文中一共展示了TIFF.tif_decoderow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TIFFSeek
// Seek to a random row+sample in a file.
static bool TIFFSeek(TIFF tif, byte[] buf, uint row, ushort sample)
{
TIFFDirectory td=tif.tif_dir;
if(row>=td.td_imagelength)
{ // out of range
TIFFErrorExt(tif.tif_clientdata, tif.tif_name, "{0}: Row out of range, max {1}", row, td.td_imagelength);
return false;
}
uint strip;
if(td.td_planarconfig==PLANARCONFIG.SEPARATE)
{
if(sample>=td.td_samplesperpixel)
{
TIFFErrorExt(tif.tif_clientdata, tif.tif_name, "{0}: Sample out of range, max {1}", sample, td.td_samplesperpixel);
return false;
}
strip=sample*td.td_stripsperimage+row/td.td_rowsperstrip;
}
else strip=row/td.td_rowsperstrip;
if(strip!=tif.tif_curstrip)
{ // different strip, refill
if(!TIFFFillStrip(tif, strip)) return false;
}
else if(row<tif.tif_row)
{
// Moving backwards within the same strip: backup
// to the start and then decode forward (below).
//
// NB: If you're planning on lots of random access within a
// strip, it's better to just read and decode the entire
// strip, and then access the decoded data in a random fashion.
if(!TIFFStartStrip(tif, strip)) return false;
}
if(row!=tif.tif_row)
{
// Seek forward to the desired row.
if(!tif.tif_seek(tif, row-tif.tif_row))
{
// if not directly seeked to, then the slow way... line by line
for(; tif.tif_row<row; tif.tif_row++)
tif.tif_decoderow(tif, buf, (int)tif.tif_scanlinesize, sample);
}
tif.tif_row=row;
}
return true;
}
示例2: TIFFReadScanline
public static int TIFFReadScanline(TIFF tif, byte[] buf, uint row, ushort sample)
{
if(!TIFFCheckRead(tif, false)) return -1;
bool e=TIFFSeek(tif, buf, row, sample);
if(e)
{
// Decompress desired row into user buffer.
e=tif.tif_decoderow(tif, buf, (int)tif.tif_scanlinesize, sample);
// we are now poised at the beginning of the next row
tif.tif_row=row+1;
if(e) tif.tif_postdecode(tif, buf, 0, (int)tif.tif_scanlinesize);
}
return e?1:-1;
}