本文整理汇总了C#中BitMiracle.LibTiff.Classic.Tiff.IsTiled方法的典型用法代码示例。如果您正苦于以下问题:C# Tiff.IsTiled方法的具体用法?C# Tiff.IsTiled怎么用?C# Tiff.IsTiled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitMiracle.LibTiff.Classic.Tiff
的用法示例。
在下文中一共展示了Tiff.IsTiled方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: tiffcvt
public bool tiffcvt(Tiff inImage, Tiff outImage)
{
FieldValue[] result = inImage.GetField(TiffTag.IMAGEWIDTH);
if (result == null)
return false;
int width = result[0].ToInt();
result = inImage.GetField(TiffTag.IMAGELENGTH);
if (result == null)
return false;
int height = result[0].ToInt();
copyField(inImage, outImage, TiffTag.SUBFILETYPE);
outImage.SetField(TiffTag.IMAGEWIDTH, width);
outImage.SetField(TiffTag.IMAGELENGTH, height);
outImage.SetField(TiffTag.BITSPERSAMPLE, 8);
outImage.SetField(TiffTag.COMPRESSION, m_compression);
outImage.SetField(TiffTag.PHOTOMETRIC, Photometric.RGB);
copyField(inImage, outImage, TiffTag.FILLORDER);
outImage.SetField(TiffTag.ORIENTATION, Orientation.TOPLEFT);
if (m_noAlpha)
outImage.SetField(TiffTag.SAMPLESPERPIXEL, 3);
else
outImage.SetField(TiffTag.SAMPLESPERPIXEL, 4);
if (!m_noAlpha)
{
short[] v = new short[1];
v[0] = (short)ExtraSample.ASSOCALPHA;
outImage.SetField(TiffTag.EXTRASAMPLES, 1, v);
}
copyField(inImage, outImage, TiffTag.XRESOLUTION);
copyField(inImage, outImage, TiffTag.YRESOLUTION);
copyField(inImage, outImage, TiffTag.RESOLUTIONUNIT);
outImage.SetField(TiffTag.PLANARCONFIG, PlanarConfig.CONTIG);
if (!m_testFriendly)
outImage.SetField(TiffTag.SOFTWARE, Tiff.GetVersion());
copyField(inImage, outImage, TiffTag.DOCUMENTNAME);
if (m_processByBlock && inImage.IsTiled())
return cvt_by_tile(inImage, outImage, width, height);
else if (m_processByBlock)
return cvt_by_strip(inImage, outImage, width, height);
return cvt_whole_image(inImage, outImage, width, height);
}
示例2: pickFuncAndCopy
/*
* Select the appropriate copy function to use.
*/
bool pickFuncAndCopy(Tiff inImage, Tiff outImage, short bitspersample, short samplesperpixel, int length, int width)
{
using (TextWriter stderr = Console.Error)
{
FieldValue[] result = inImage.GetField(TiffTag.PLANARCONFIG);
PlanarConfig shortv = (PlanarConfig)result[0].ToShort();
if (shortv != m_config && bitspersample != 8 && samplesperpixel > 1)
{
stderr.Write("{0}: Cannot handle different planar configuration w/ bits/sample != 8\n", inImage.FileName());
return false;
}
result = inImage.GetField(TiffTag.IMAGEWIDTH);
int w = result[0].ToInt();
result = inImage.GetField(TiffTag.IMAGELENGTH);
int l = result[0].ToInt();
bool bychunk;
if (!(outImage.IsTiled() || inImage.IsTiled()))
{
result = inImage.GetField(TiffTag.ROWSPERSTRIP);
if (result != null)
{
int irps = result[0].ToInt();
/* if biased, force decoded copying to allow image subtraction */
bychunk = (m_bias == null) && (m_rowsperstrip == irps);
}
else
bychunk = false;
}
else
{
/* either inImage or outImage is tiled */
if (m_bias != null)
{
stderr.Write("{0}: Cannot handle tiled configuration w/bias image\n", inImage.FileName());
return false;
}
if (outImage.IsTiled())
{
int tw;
result = inImage.GetField(TiffTag.TILEWIDTH);
if (result == null)
tw = w;
else
tw = result[0].ToInt();
int tl;
result = inImage.GetField(TiffTag.TILELENGTH);
if (result == null)
tl = l;
else
tl = result[0].ToInt();
bychunk = (tw == m_tilewidth && tl == m_tilelength);
}
else
{
/* outImage's not, so inImage must be tiled */
result = inImage.GetField(TiffTag.TILEWIDTH);
int tw = result[0].ToInt();
result = inImage.GetField(TiffTag.TILELENGTH);
int tl = result[0].ToInt();
bychunk = (tw == w && tl == m_rowsperstrip);
}
}
if (inImage.IsTiled())
{
if (outImage.IsTiled())
{
/* Tiles -> Tiles */
if (shortv == PlanarConfig.CONTIG && m_config == PlanarConfig.CONTIG)
return cpContigTiles2ContigTiles(inImage, outImage, length, width, samplesperpixel);
else if (shortv == PlanarConfig.CONTIG && m_config == PlanarConfig.SEPARATE)
return cpContigTiles2SeparateTiles(inImage, outImage, length, width, samplesperpixel);
else if (shortv == PlanarConfig.SEPARATE && m_config == PlanarConfig.CONTIG)
return cpSeparateTiles2ContigTiles(inImage, outImage, length, width, samplesperpixel);
else if (shortv == PlanarConfig.SEPARATE && m_config == PlanarConfig.SEPARATE)
return cpSeparateTiles2SeparateTiles(inImage, outImage, length, width, samplesperpixel);
}
else
{
/* Tiles -> Strips */
if (shortv == PlanarConfig.CONTIG && m_config == PlanarConfig.CONTIG)
return cpContigTiles2ContigStrips(inImage, outImage, length, width, samplesperpixel);
else if (shortv == PlanarConfig.CONTIG && m_config == PlanarConfig.SEPARATE)
return cpContigTiles2SeparateStrips(inImage, outImage, length, width, samplesperpixel);
else if (shortv == PlanarConfig.SEPARATE && m_config == PlanarConfig.CONTIG)
return cpSeparateTiles2ContigStrips(inImage, outImage, length, width, samplesperpixel);
else if (shortv == PlanarConfig.SEPARATE && m_config == PlanarConfig.SEPARATE)
//.........这里部分代码省略.........
示例3: Copy
//.........这里部分代码省略.........
switch (m_orientation)
{
case Orientation.BOTRIGHT:
case Orientation.RIGHTBOT:
Tiff.Warning(inImage.FileName(), "using bottom-left orientation");
m_orientation = Orientation.BOTLEFT;
break;
case Orientation.LEFTBOT:
case Orientation.BOTLEFT:
break;
case Orientation.TOPRIGHT:
case Orientation.RIGHTTOP:
default:
Tiff.Warning(inImage.FileName(), "using top-left orientation");
m_orientation = Orientation.TOPLEFT;
break;
case Orientation.LEFTTOP:
case Orientation.TOPLEFT:
break;
}
outImage.SetField(TiffTag.ORIENTATION, m_orientation);
/*
* Choose tiles/strip for the output image according to
* the command line arguments (-tiles, -strips) and the
* structure of the input image.
*/
if (m_outtiled == -1)
{
if (inImage.IsTiled())
m_outtiled = 1;
else
m_outtiled = 0;
}
if (m_outtiled != 0)
{
/*
* Setup output file's tile width&height. If either
* is not specified, use either the value from the
* input image or, if nothing is defined, use the
* library default.
*/
if (m_tilewidth == -1)
{
result = inImage.GetFieldDefaulted(TiffTag.TILEWIDTH);
if (result != null)
m_tilewidth = result[0].ToInt();
}
if (m_tilelength == -1)
{
result = inImage.GetFieldDefaulted(TiffTag.TILELENGTH);
if (result != null)
m_tilelength = result[0].ToInt();
}
outImage.DefaultTileSize(ref m_tilewidth, ref m_tilelength);
outImage.SetField(TiffTag.TILEWIDTH, m_tilewidth);
outImage.SetField(TiffTag.TILELENGTH, m_tilelength);
}
else
示例4: read_tiff_data
//.........这里部分代码省略.........
result = input.GetField(TiffTag.XRESOLUTION);
if (result == null)
m_tiff_xres = 0.0f;
else
m_tiff_xres = result[0].ToFloat();
result = input.GetField(TiffTag.YRESOLUTION);
if (result == null)
m_tiff_yres = 0.0f;
else
m_tiff_yres = result[0].ToFloat();
result = input.GetFieldDefaulted(TiffTag.RESOLUTIONUNIT);
m_tiff_resunit = (ResUnit)result[0].ToByte();
if (m_tiff_resunit == ResUnit.CENTIMETER)
{
m_tiff_xres *= 2.54F;
m_tiff_yres *= 2.54F;
}
else if (m_tiff_resunit != ResUnit.INCH && m_pdf_centimeters)
{
m_tiff_xres *= 2.54F;
m_tiff_yres *= 2.54F;
}
compose_pdf_page();
m_pdf_transcode = t2p_transcode_t.T2P_TRANSCODE_ENCODE;
if (!m_pdf_nopassthrough)
{
if (m_tiff_compression == Compression.CCITTFAX4)
{
if (input.IsTiled() || (input.NumberOfStrips() == 1))
{
m_pdf_transcode = t2p_transcode_t.T2P_TRANSCODE_RAW;
m_pdf_compression = t2p_compress_t.T2P_COMPRESS_G4;
}
}
if (m_tiff_compression == Compression.ADOBE_DEFLATE || m_tiff_compression == Compression.DEFLATE)
{
if (input.IsTiled() || (input.NumberOfStrips() == 1))
{
m_pdf_transcode = t2p_transcode_t.T2P_TRANSCODE_RAW;
m_pdf_compression = t2p_compress_t.T2P_COMPRESS_ZIP;
}
}
if (m_tiff_compression == Compression.JPEG)
{
m_pdf_transcode = t2p_transcode_t.T2P_TRANSCODE_RAW;
m_pdf_compression = t2p_compress_t.T2P_COMPRESS_JPEG;
}
}
if (m_pdf_transcode != t2p_transcode_t.T2P_TRANSCODE_RAW)
m_pdf_compression = m_pdf_defaultcompression;
if (m_pdf_defaultcompression == t2p_compress_t.T2P_COMPRESS_JPEG)
{
if ((m_pdf_colorspace & t2p_cs_t.T2P_CS_PALETTE) != 0)
{
m_pdf_sample = (t2p_sample_t)(m_pdf_sample | t2p_sample_t.T2P_SAMPLE_REALIZE_PALETTE);
m_pdf_colorspace = (t2p_cs_t)(m_pdf_colorspace ^ t2p_cs_t.T2P_CS_PALETTE);
m_tiff_pages[m_pdf_page].page_extra--;
示例5: 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();
//.........这里部分代码省略.........