本文整理汇总了C#中BitMiracle.LibTiff.Classic.Tiff.RasterScanlineSize方法的典型用法代码示例。如果您正苦于以下问题:C# Tiff.RasterScanlineSize方法的具体用法?C# Tiff.RasterScanlineSize怎么用?C# Tiff.RasterScanlineSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitMiracle.LibTiff.Classic.Tiff
的用法示例。
在下文中一共展示了Tiff.RasterScanlineSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: writeBufferToSeparateTiles
bool writeBufferToSeparateTiles(Tiff outImage, byte[] buf, int imagelength, int imagewidth, short spp)
{
byte[] obuf = new byte[outImage.TileSize()];
FieldValue[] result = outImage.GetField(TiffTag.TILELENGTH);
int tl = result[0].ToInt();
result = outImage.GetField(TiffTag.TILEWIDTH);
int tw = result[0].ToInt();
result = outImage.GetField(TiffTag.BITSPERSAMPLE);
short bps = result[0].ToShort();
Debug.Assert(bps % 8 == 0);
short bytes_per_sample = (short)(bps / 8);
int imagew = outImage.ScanlineSize();
int tilew = outImage.TileRowSize();
int iimagew = outImage.RasterScanlineSize();
int iskew = iimagew - tilew * spp;
int bufp = 0;
for (int row = 0; row < imagelength; row += tl)
{
int nrow = (row + tl > imagelength) ? imagelength - row : tl;
int colb = 0;
for (int col = 0; col < imagewidth; col += tw)
{
for (short s = 0; s < spp; s++)
{
/*
* Tile is clipped horizontally. Calculate
* visible portion and skewing factors.
*/
if (colb + tilew > imagew)
{
int width = imagew - colb;
int oskew = tilew - width;
cpContigBufToSeparateBuf(obuf, buf, bufp + (colb * spp) + s, nrow, width / bytes_per_sample, oskew, (oskew * spp) + iskew, spp, bytes_per_sample);
}
else
cpContigBufToSeparateBuf(obuf, buf, bufp + (colb * spp) + s, nrow, m_tilewidth, 0, iskew, spp, bytes_per_sample);
if (outImage.WriteTile(obuf, col, row, 0, s) < 0)
{
Tiff.Error(outImage.FileName(), "Error, can't write tile at {0} {1} sample {2}", col, row, s);
return false;
}
}
colb += tilew;
}
bufp += nrow * iimagew;
}
return true;
}
示例2: cpImage
static bool cpImage(Tiff inImage, Tiff outImage, readFunc fin, writeFunc fout, int imagelength, int imagewidth, short spp)
{
bool status = false;
int scanlinesize = inImage.RasterScanlineSize();
int bytes = scanlinesize * imagelength;
/*
* XXX: Check for integer overflow.
*/
if (scanlinesize != 0 && imagelength != 0 && (bytes / imagelength == scanlinesize))
{
byte[] buf = new byte[bytes];
if (fin(inImage, buf, imagelength, imagewidth, spp))
status = fout(outImage, buf, imagelength, imagewidth, spp);
}
else
{
Tiff.Error(inImage.FileName(), "Error, no space for image buffer");
}
return status;
}
示例3: readSeparateTilesIntoBuffer
bool readSeparateTilesIntoBuffer(Tiff inImage, byte[] buf, int imagelength, int imagewidth, short spp)
{
byte[] tilebuf = new byte[inImage.TileSize()];
FieldValue[] result = inImage.GetField(TiffTag.TILEWIDTH);
int tw = result[0].ToInt();
result = inImage.GetField(TiffTag.TILELENGTH);
int tl = result[0].ToInt();
result = inImage.GetField(TiffTag.BITSPERSAMPLE);
short bps = result[0].ToShort();
Debug.Assert(bps % 8 == 0);
short bytes_per_sample = (short)(bps / 8);
int imagew = inImage.RasterScanlineSize();
int tilew = inImage.TileRowSize();
int iskew = imagew - tilew * spp;
int bufp = 0;
for (int row = 0; row < imagelength; row += tl)
{
int nrow = (row + tl > imagelength) ? imagelength - row : tl;
int colb = 0;
for (int col = 0; col < imagewidth; col += tw)
{
for (short s = 0; s < spp; s++)
{
if (inImage.ReadTile(tilebuf, 0, col, row, 0, s) < 0 && !m_ignore)
{
Tiff.Error(inImage.FileName(), "Error, can't read tile at {0} {1}, sample {2}", col, row, s);
return false;
}
/*
* Tile is clipped horizontally. Calculate
* visible portion and skewing factors.
*/
if (colb + tilew * spp > imagew)
{
int width = imagew - colb;
int oskew = tilew * spp - width;
cpSeparateBufToContigBuf(buf, bufp + colb + s * bytes_per_sample, tilebuf, nrow, width / (spp * bytes_per_sample), oskew + iskew, oskew / spp, spp, bytes_per_sample);
}
else
cpSeparateBufToContigBuf(buf, bufp + colb + s * bytes_per_sample, tilebuf, nrow, tw, iskew, 0, spp, bytes_per_sample);
}
colb += tilew * spp;
}
bufp += imagew * nrow;
}
return true;
}