本文整理汇总了C#中BitMiracle.LibTiff.Classic.Tiff.ReadEncodedTile方法的典型用法代码示例。如果您正苦于以下问题:C# Tiff.ReadEncodedTile方法的具体用法?C# Tiff.ReadEncodedTile怎么用?C# Tiff.ReadEncodedTile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitMiracle.LibTiff.Classic.Tiff
的用法示例。
在下文中一共展示了Tiff.ReadEncodedTile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: readwrite_pdf_image_tile
/*
* This function reads the raster image data from the input TIFF for an image
* tile and writes the data to the output PDF XObject image dictionary stream
* for the tile. It returns the amount written or zero on error.
*/
private int readwrite_pdf_image_tile(Tiff input, int tile)
{
bool edge = false;
edge |= tile_is_right_edge(m_tiff_pages[m_pdf_page], tile);
edge |= tile_is_bottom_edge(m_tiff_pages[m_pdf_page], tile);
byte[] buffer = null;
int bufferoffset = 0;
FieldValue[] result = null;
if ((m_pdf_transcode == t2p_transcode_t.T2P_TRANSCODE_RAW) && (!edge || (m_pdf_compression == t2p_compress_t.T2P_COMPRESS_JPEG)))
{
if (m_pdf_compression == t2p_compress_t.T2P_COMPRESS_G4)
{
buffer = new byte [m_tiff_datasize];
input.ReadRawTile(tile, buffer, 0, m_tiff_datasize);
if (m_tiff_fillorder == FillOrder.LSB2MSB)
Tiff.ReverseBits(buffer, m_tiff_datasize);
writeToFile(buffer, m_tiff_datasize);
return m_tiff_datasize;
}
if (m_pdf_compression == t2p_compress_t.T2P_COMPRESS_ZIP)
{
buffer = new byte [m_tiff_datasize];
input.ReadRawTile(tile, buffer, 0, m_tiff_datasize);
if (m_tiff_fillorder == FillOrder.LSB2MSB)
Tiff.ReverseBits(buffer, m_tiff_datasize);
writeToFile(buffer, m_tiff_datasize);
return m_tiff_datasize;
}
if (m_tiff_compression == Compression.JPEG)
{
byte[] table_end = new byte[2];
buffer = new byte [m_tiff_datasize];
result = input.GetField(TiffTag.JPEGTABLES);
if (result != null)
{
int count = result[0].ToInt();
byte[] jpt = result[1].ToByteArray();
if (count > 0)
{
Buffer.BlockCopy(jpt, 0, buffer, 0, count);
bufferoffset += count - 2;
table_end[0] = buffer[bufferoffset - 2];
table_end[1] = buffer[bufferoffset - 1];
}
if (count > 0)
{
int xuint32 = bufferoffset;
bufferoffset += input.ReadRawTile(tile, buffer, bufferoffset - 2, -1);
buffer[xuint32 - 2] = table_end[0];
buffer[xuint32 - 1] = table_end[1];
}
else
{
bufferoffset += input.ReadRawTile(tile, buffer, bufferoffset, -1);
}
}
writeToFile(buffer, bufferoffset);
return bufferoffset;
}
}
if (m_pdf_sample == t2p_sample_t.T2P_SAMPLE_NOTHING)
{
buffer = new byte [m_tiff_datasize];
int read = input.ReadEncodedTile(tile, buffer, bufferoffset, m_tiff_datasize);
if (read == -1)
{
Tiff.Error(Tiff2PdfConstants.TIFF2PDF_MODULE,
"Error on decoding tile {0} of {1}", tile, input.FileName());
m_error = true;
return 0;
}
}
else
{
if (m_pdf_sample == t2p_sample_t.T2P_SAMPLE_PLANAR_SEPARATE_TO_CONTIG)
{
int septilesize = input.TileSize();
int septilecount = input.NumberOfTiles();
int tilecount = septilecount / m_tiff_samplesperpixel;
buffer = new byte [m_tiff_datasize];
byte[] samplebuffer = new byte [m_tiff_datasize];
int samplebufferoffset = 0;
for (short i = 0; i < m_tiff_samplesperpixel; i++)
{
int read = input.ReadEncodedTile(tile + i * tilecount, samplebuffer, samplebufferoffset, septilesize);
if (read == -1)
//.........这里部分代码省略.........