本文整理汇总了C#中BitMiracle.LibTiff.Classic.Tiff.CurrentDirectory方法的典型用法代码示例。如果您正苦于以下问题:C# Tiff.CurrentDirectory方法的具体用法?C# Tiff.CurrentDirectory怎么用?C# Tiff.CurrentDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitMiracle.LibTiff.Classic.Tiff
的用法示例。
在下文中一共展示了Tiff.CurrentDirectory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: cpBiasedContig2Contig
/*
* Contig -> contig by scanline while subtracting a bias image.
*/
bool cpBiasedContig2Contig(Tiff inImage, Tiff outImage, int imagelength, int imagewidth, short spp)
{
if (spp == 1)
{
int biasSize = m_bias.ScanlineSize();
int bufSize = inImage.ScanlineSize();
FieldValue[] result = m_bias.GetField(TiffTag.IMAGEWIDTH);
int biasWidth = result[0].ToInt();
result = m_bias.GetField(TiffTag.IMAGELENGTH);
int biasLength = result[0].ToInt();
if (biasSize == bufSize && imagelength == biasLength && imagewidth == biasWidth)
{
result = inImage.GetField(TiffTag.BITSPERSAMPLE);
short sampleBits = result[0].ToShort();
if (sampleBits == 8 || sampleBits == 16 || sampleBits == 32)
{
byte[] buf = new byte[bufSize];
byte[] biasBuf = new byte[bufSize];
for (int row = 0; row < imagelength; row++)
{
if (!inImage.ReadScanline(buf, row, 0) && !m_ignore)
{
Tiff.Error(inImage.FileName(), "Error, can't read scanline {0}", row);
return false;
}
if (!m_bias.ReadScanline(biasBuf, row, 0) && !m_ignore)
{
Tiff.Error(inImage.FileName(), "Error, can't read biased scanline {0}", row);
return false;
}
if (sampleBits == 8)
subtract8(buf, biasBuf, imagewidth);
else if (sampleBits == 16)
subtract16(buf, biasBuf, imagewidth);
else if (sampleBits == 32)
subtract32(buf, biasBuf, imagewidth);
if (!outImage.WriteScanline(buf, row, 0))
{
Tiff.Error(outImage.FileName(), "Error, can't write scanline {0}", row);
return false;
}
}
m_bias.SetDirectory(m_bias.CurrentDirectory()); /* rewind */
return true;
}
else
{
Tiff.Error(inImage.FileName(), "No support for biasing {0} bit pixels\n", sampleBits);
return false;
}
}
Tiff.Error(inImage.FileName(), "Bias image {0},{1}\nis not the same size as {2},{3}\n",
m_bias.FileName(), m_bias.CurrentDirectory(), inImage.FileName(), inImage.CurrentDirectory());
return false;
}
else
{
Tiff.Error(inImage.FileName(), "Can't bias {0},{1} as it has >1 Sample/Pixel\n",
inImage.FileName(), inImage.CurrentDirectory());
return false;
}
}