本文整理汇总了C#中BitMiracle.LibTiff.Classic.Tiff.NumberOfTiles方法的典型用法代码示例。如果您正苦于以下问题:C# Tiff.NumberOfTiles方法的具体用法?C# Tiff.NumberOfTiles怎么用?C# Tiff.NumberOfTiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitMiracle.LibTiff.Classic.Tiff
的用法示例。
在下文中一共展示了Tiff.NumberOfTiles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: read_tiff_init
/*
This function scans the input TIFF file for pages. It attempts
to determine which IFD's of the TIFF file contain image document
pages. For each, it gathers some information that has to do
with the output of the PDF document as a whole.
*/
private void read_tiff_init(Tiff input)
{
short directorycount = input.NumberOfDirectories();
m_tiff_pages = new T2P_PAGE [directorycount];
for (int p = 0; p < directorycount; p++)
m_tiff_pages[p] = new T2P_PAGE();
FieldValue[] result = null;
for (short i = 0; i < directorycount; i++)
{
int subfiletype = 0;
if (!input.SetDirectory(i))
{
Tiff.Error(Tiff2PdfConstants.TIFF2PDF_MODULE,
"Can't set directory {0} of input file {1}", i, input.FileName());
return;
}
result = input.GetField(TiffTag.PAGENUMBER);
if (result != null)
{
short pagen = result[0].ToShort();
short paged = result[1].ToShort();
if ((pagen > paged) && (paged != 0))
m_tiff_pages[m_tiff_pagecount].page_number = paged;
else
m_tiff_pages[m_tiff_pagecount].page_number = pagen;
}
else
{
result = input.GetField(TiffTag.SUBFILETYPE);
if (result != null)
{
subfiletype = result[0].ToInt();
if ((((FileType)subfiletype & FileType.PAGE) == 0) && (subfiletype != 0))
continue;
}
else
{
result = input.GetField(TiffTag.OSUBFILETYPE);
if (result != null)
{
subfiletype = result[0].ToInt();
if (((OFileType)subfiletype != OFileType.IMAGE) && ((OFileType)subfiletype != OFileType.PAGE) && (subfiletype != 0))
continue;
}
}
m_tiff_pages[m_tiff_pagecount].page_number = m_tiff_pagecount;
}
m_tiff_pages[m_tiff_pagecount].page_directory = i;
if (input.IsTiled())
m_tiff_pages[m_tiff_pagecount].page_tilecount = input.NumberOfTiles();
m_tiff_pagecount++;
}
IComparer myComparer = new cmp_t2p_page();
Array.Sort(m_tiff_pages, myComparer);
for (short i = 0; i < m_tiff_pagecount; i++)
{
m_pdf_xrefcount += 5;
input.SetDirectory(m_tiff_pages[i].page_directory);
result = input.GetField(TiffTag.PHOTOMETRIC);
if ((result != null && ((Photometric)result[0].ToInt() == Photometric.PALETTE)) || input.GetField(TiffTag.INDEXED) != null)
{
m_tiff_pages[i].page_extra++;
m_pdf_xrefcount++;
}
result = input.GetField(TiffTag.COMPRESSION);
if (result != null)
{
Compression xuint16 = (Compression)result[0].ToInt();
if ((xuint16 == Compression.DEFLATE || xuint16 == Compression.ADOBE_DEFLATE)
&& ((m_tiff_pages[i].page_tilecount != 0) || input.NumberOfStrips() == 1)
&& !m_pdf_nopassthrough)
{
if (m_pdf_minorversion < 2)
m_pdf_minorversion = 2;
}
}
result = input.GetField(TiffTag.TRANSFERFUNCTION);
if (result != null)
{
m_tiff_transferfunction[0] = result[0].GetBytes();
//.........这里部分代码省略.........
示例2: 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)
//.........这里部分代码省略.........