本文整理汇总了C#中BitMiracle.LibTiff.Classic.Internal.TiffDirEntry类的典型用法代码示例。如果您正苦于以下问题:C# TiffDirEntry类的具体用法?C# TiffDirEntry怎么用?C# TiffDirEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TiffDirEntry类属于BitMiracle.LibTiff.Classic.Internal命名空间,在下文中一共展示了TiffDirEntry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: writeDirEntryOK
private bool writeDirEntryOK(TiffDirEntry[] entries, long count, bool isBigTiff)
{
bool res = true;
for (long i = 0; i < count; i++)
{
res = writeShortOK((short)entries[i].tdir_tag);
if (res)
res = writeShortOK((short)entries[i].tdir_type);
if (isBigTiff)
{
if (res)
res = writelongOK(entries[i].tdir_count);
if (res)
res = writelongOK((long)entries[i].tdir_offset);
}
else
{
if (res)
res = writeIntOK(entries[i].tdir_count);
if (res)
res = writeIntOK((int)entries[i].tdir_offset);
}
if (!res)
break;
}
return res;
}
开发者ID:dronab,项目名称:libtiff.net,代码行数:30,代码来源:Tiff_Write.cs
示例2: extractData
private long extractData(TiffDirEntry dir)
{
int type = (int)dir.tdir_type;
if (m_header.tiff_magic == TIFF_BIGENDIAN)
return (long)((dir.tdir_offset >> m_typeshift[type]) & m_typemask[type]);
return (long)(dir.tdir_offset & m_typemask[type]);
}
开发者ID:Ravivishnubhotla,项目名称:libtiff.net,代码行数:8,代码来源:Tiff_DirRead.cs
示例3: writeRationalPair
private bool writeRationalPair(TiffDirEntry[] entries, int dirOffset, TiffType type, TiffTag tag1, float v1, TiffTag tag2, float v2)
{
if (!writeRational(type, tag1, ref entries[dirOffset], v1))
return false;
if (!writeRational(type, tag2, ref entries[dirOffset + 1], v2))
return false;
return true;
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:10,代码来源:Tiff_DirWrite.cs
示例4: readDirectoryFind
private static int readDirectoryFind(TiffDirEntry[] dir, short dircount, TiffTag tagid)
{
for (short n = 0; n < dircount; n++)
{
if (dir[n].tdir_tag == tagid)
return n;
}
return -1;
}
开发者ID:Core-Techs,项目名称:TiffLibrary,代码行数:10,代码来源:Tiff_DirRead.cs
示例5: writeRational
private bool writeRational(TiffType type, TiffTag tag, ref TiffDirEntry dir, float v)
{
dir.tdir_tag = tag;
dir.tdir_type = type;
dir.tdir_count = 1;
float[] a = new float[1];
a[0] = v;
if (!writeRationalArray(ref dir, a))
return false;
return true;
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:13,代码来源:Tiff_DirWrite.cs
示例6: writeDirEntryOK
private bool writeDirEntryOK(TiffDirEntry[] entries, int count)
{
bool res = true;
for (int i = 0; i < count; i++)
{
res = writeShortOK((short)entries[i].tdir_tag);
if (res)
res = writeShortOK((short)entries[i].tdir_type);
if (res)
res = writeIntOK(entries[i].tdir_count);
if (res)
res = writeIntOK((int)entries[i].tdir_offset);
if (!res)
break;
}
return res;
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:22,代码来源:Tiff_Write.cs
示例7: writeShortTable
/// <summary>
/// Setup a directory entry for an NxM table of shorts, where M is
/// known to be 2**bitspersample, and write the associated indirect data.
/// </summary>
private bool writeShortTable(TiffTag tag, ref TiffDirEntry dir, int n, short[][] table)
{
dir.tdir_tag = tag;
dir.tdir_type = TiffType.SHORT;
// XXX -- yech, fool writeData
dir.tdir_count = 1 << m_dir.td_bitspersample;
uint off = m_dataoff;
for (int i = 0; i < n; i++)
{
if (!writeData(ref dir, table[i], dir.tdir_count))
return false;
}
dir.tdir_count *= n;
dir.tdir_offset = off;
return true;
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:22,代码来源:Tiff_DirWrite.cs
示例8: setupShortPair
/*
* Setup a pair of shorts that are returned by
* value, rather than as a reference to an array.
*/
private bool setupShortPair(TiffTag tag, ref TiffDirEntry dir)
{
short[] v = new short[2];
FieldValue[] result = GetField(tag);
v[0] = result[0].ToShort();
v[1] = result[1].ToShort();
dir.tdir_tag = tag;
dir.tdir_type = TiffType.SHORT;
dir.tdir_count = 2;
return writeShortArray(ref dir, v);
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:16,代码来源:Tiff_DirWrite.cs
示例9: writePerSampleAnys
/*
* Setup a directory entry that references a samples/pixel array of ``type''
* values and (potentially) write the associated indirect values. The source
* data from GetField() for the specified tag must be returned as double.
*/
private bool writePerSampleAnys(TiffType type, TiffTag tag, ref TiffDirEntry dir)
{
double[] w = new double [m_dir.td_samplesperpixel];
FieldValue[] result = GetField(tag);
double v = result[0].ToDouble();
for (short i = 0; i < m_dir.td_samplesperpixel; i++)
w[i] = v;
bool status = writeAnyArray(type, tag, ref dir, m_dir.td_samplesperpixel, w);
return status;
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:18,代码来源:Tiff_DirWrite.cs
示例10: writeDirectory
/// <summary>
/// Writes the contents of the current directory to the specified file.
/// </summary>
/// <remarks>This routine doesn't handle overwriting a directory with
/// auxiliary storage that's been changed.</remarks>
private bool writeDirectory(bool done)
{
if (m_mode == O_RDONLY)
return true;
// Clear write state so that subsequent images with different
// characteristics get the right buffers setup for them.
if (done)
{
if ((m_flags & TiffFlags.POSTENCODE) == TiffFlags.POSTENCODE)
{
m_flags &= ~TiffFlags.POSTENCODE;
if (!m_currentCodec.PostEncode())
{
ErrorExt(this, m_clientdata, m_name, "Error post-encoding before directory write");
return false;
}
}
// shutdown encoder
m_currentCodec.Close();
// Flush any data that might have been written by the
// compression close+cleanup routines.
if (m_rawcc > 0 && (m_flags & TiffFlags.BEENWRITING) == TiffFlags.BEENWRITING && !flushData1())
{
ErrorExt(this, m_clientdata, m_name, "Error flushing data before directory write");
return false;
}
if ((m_flags & TiffFlags.MYBUFFER) == TiffFlags.MYBUFFER && m_rawdata != null)
{
m_rawdata = null;
m_rawcc = 0;
m_rawdatasize = 0;
}
m_flags &= ~(TiffFlags.BEENWRITING | TiffFlags.BUFFERSETUP);
}
// Size the directory so that we can calculate offsets for the data
// items that aren't kept in-place in each field.
int nfields = 0;
for (int b = 0; b <= FieldBit.Last; b++)
{
if (fieldSet(b) && b != FieldBit.Custom)
nfields += (b < FieldBit.SubFileType ? 2 : 1);
}
nfields += m_dir.td_customValueCount;
int dirsize = nfields * TiffDirEntry.SizeInBytes;
TiffDirEntry[] data = new TiffDirEntry [nfields];
for (int i = 0; i < nfields; i++)
data[i] = new TiffDirEntry();
// Directory hasn't been placed yet, put it at the end of the file
// and link it into the existing directory structure.
if (m_diroff == 0 && !linkDirectory())
return false;
m_dataoff = m_diroff + sizeof(short) + (uint)dirsize + sizeof(int);
if ((m_dataoff & 1) != 0)
m_dataoff++;
seekFile(m_dataoff, SeekOrigin.Begin);
m_curdir++;
int dir = 0;
// Setup external form of directory entries and write data items.
int[] fields = new int[FieldBit.SetLongs];
Buffer.BlockCopy(m_dir.td_fieldsset, 0, fields, 0, FieldBit.SetLongs * sizeof(int));
// Write out ExtraSamples tag only if extra samples are present in the data.
if (fieldSet(fields, FieldBit.ExtraSamples) && m_dir.td_extrasamples == 0)
{
resetFieldBit(fields, FieldBit.ExtraSamples);
nfields--;
dirsize -= TiffDirEntry.SizeInBytes;
} // XXX
for (int fi = 0, nfi = m_nfields; nfi > 0; nfi--, fi++)
{
TiffFieldInfo fip = m_fieldinfo[fi];
// For custom fields, we test to see if the custom field is set
// or not. For normal fields, we just use the fieldSet test.
if (fip.Bit == FieldBit.Custom)
{
bool is_set = false;
for (int ci = 0; ci < m_dir.td_customValueCount; ci++)
is_set |= (m_dir.td_customValues[ci].info == fip);
if (!is_set)
continue;
}
//.........这里部分代码省略.........
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:101,代码来源:Tiff_DirWrite.cs
示例11: writeData
/// <summary>
/// Writes a contiguous directory item.
/// </summary>
private bool writeData(ref TiffDirEntry dir, byte[] buffer, int count)
{
dir.tdir_offset = m_dataoff;
count = (int)dir.tdir_count * DataWidth(dir.tdir_type);
if (seekOK(dir.tdir_offset) && writeOK(buffer, 0, count))
{
m_dataoff += (uint)((count + 1) & ~1);
return true;
}
ErrorExt(this, m_clientdata, m_name,
"Error writing data for field \"{0}\"",
FieldWithTag(dir.tdir_tag).Name);
return false;
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:18,代码来源:Tiff_DirWrite.cs
示例12: writeLongArray
/// <summary>
/// Setup a directory entry of an array of LONG or SLONG and write the
/// associated indirect values.
/// </summary>
private bool writeLongArray(ref TiffDirEntry dir, int[] v)
{
if (dir.tdir_count == 1)
{
dir.tdir_offset = (uint)v[0];
return true;
}
return writeData(ref dir, v, dir.tdir_count);
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:14,代码来源:Tiff_DirWrite.cs
示例13: writeRationalArray
/// <summary>
/// Setup a directory entry of an array of RATIONAL or SRATIONAL and
/// write the associated indirect values.
/// </summary>
private bool writeRationalArray(ref TiffDirEntry dir, float[] v)
{
int[] t = new int [2 * dir.tdir_count];
for (int i = 0; i < dir.tdir_count; i++)
{
int sign = 1;
float fv = v[i];
if (fv < 0)
{
if (dir.tdir_type == TiffType.RATIONAL)
{
WarningExt(this, m_clientdata, m_name,
"\"{0}\": Information lost writing value ({1:G}) as (unsigned) RATIONAL",
FieldWithTag(dir.tdir_tag).Name, fv);
fv = 0;
}
else
{
fv = -fv;
sign = -1;
}
}
int den = 1;
if (fv > 0)
{
while (fv < (1L << (31 - 3)) && den < (1L << (31 - 3)))
{
fv *= 1 << 3;
den *= 1 << 3;
}
}
t[2 * i + 0] = (int)(sign * (fv + 0.5));
t[2 * i + 1] = den;
}
return writeData(ref dir, t, 2 * dir.tdir_count);
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:43,代码来源:Tiff_DirWrite.cs
示例14: writeNormalTag
/// <summary>
/// Writes tags that are not special cased.
/// </summary>
private bool writeNormalTag(ref TiffDirEntry dir, TiffFieldInfo fip)
{
short wc = fip.WriteCount;
dir.tdir_tag = fip.Tag;
dir.tdir_type = fip.Type;
dir.tdir_count = wc;
switch (fip.Type)
{
case TiffType.SHORT:
case TiffType.SSHORT:
if (fip.PassCount)
{
short[] wp;
int wc2;
if (wc == TiffFieldInfo.Variable2)
{
FieldValue[] result = GetField(fip.Tag);
wc2 = result[0].ToInt();
wp = result[1].ToShortArray();
dir.tdir_count = wc2;
}
else
{
// Assume TiffFieldInfo.Variable
FieldValue[] result = GetField(fip.Tag);
wc = result[0].ToShort();
wp = result[1].ToShortArray();
dir.tdir_count = wc;
}
if (!writeShortArray(ref dir, wp))
return false;
}
else
{
if (wc == 1)
{
FieldValue[] result = GetField(fip.Tag);
short sv = result[0].ToShort();
dir.tdir_offset = insertData(dir.tdir_type, sv);
}
else
{
FieldValue[] result = GetField(fip.Tag);
short[] wp = result[0].ToShortArray();
if (!writeShortArray(ref dir, wp))
return false;
}
}
break;
case TiffType.LONG:
case TiffType.SLONG:
case TiffType.IFD:
if (fip.PassCount)
{
int[] lp;
int wc2;
if (wc == TiffFieldInfo.Variable2)
{
FieldValue[] result = GetField(fip.Tag);
wc2 = result[0].ToInt();
lp = result[1].ToIntArray();
dir.tdir_count = wc2;
}
else
{
// Assume TiffFieldInfo.Variable
FieldValue[] result = GetField(fip.Tag);
wc = result[0].ToShort();
lp = result[1].ToIntArray();
dir.tdir_count = wc;
}
if (!writeLongArray(ref dir, lp))
return false;
}
else
{
if (wc == 1)
{
// XXX handle LONG->SHORT conversion
FieldValue[] result = GetField(fip.Tag);
dir.tdir_offset = result[0].ToUInt();
}
else
{
int[] lp;
FieldValue[] result = GetField(fip.Tag);
lp = result[0].ToIntArray();
if (!writeLongArray(ref dir, lp))
return false;
}
}
break;
case TiffType.RATIONAL:
//.........这里部分代码省略.........
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:101,代码来源:Tiff_DirWrite.cs
示例15: writeByteArray
/// <summary>
/// Write/copy data associated with an ASCII or opaque tag value.
/// </summary>
private bool writeByteArray(ref TiffDirEntry dir, byte[] cp)
{
if (dir.tdir_count <= 4)
{
if (m_header.tiff_magic == TIFF_BIGENDIAN)
{
dir.tdir_offset = (uint)(cp[0] << 24);
if (dir.tdir_count >= 2)
dir.tdir_offset |= (uint)(cp[1] << 16);
if (dir.tdir_count >= 3)
dir.tdir_offset |= (uint)(cp[2] << 8);
if (dir.tdir_count == 4)
dir.tdir_offset |= cp[3];
}
else
{
dir.tdir_offset = cp[0];
if (dir.tdir_count >= 2)
dir.tdir_offset |= (uint)(cp[1] << 8);
if (dir.tdir_count >= 3)
dir.tdir_offset |= (uint)(cp[2] << 16);
if (dir.tdir_count == 4)
dir.tdir_offset |= (uint)(cp[3] << 24);
}
return true;
}
return writeData(ref dir, cp, dir.tdir_count);
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:37,代码来源:Tiff_DirWrite.cs
示例16: writeDoubleArray
private bool writeDoubleArray(ref TiffDirEntry dir, double[] v)
{
return writeData(ref dir, v, dir.tdir_count);
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:4,代码来源:Tiff_DirWrite.cs
示例17: writeShortArray
/// <summary>
/// Setup a directory entry of an array of SHORT or SSHORT and write
/// the associated indirect values.
/// </summary>
private bool writeShortArray(ref TiffDirEntry dir, short[] v)
{
if (dir.tdir_count <= 2)
{
if (m_header.tiff_magic == TIFF_BIGENDIAN)
{
dir.tdir_offset = (uint)(v[0] << 16);
if (dir.tdir_count == 2)
dir.tdir_offset |= (uint)(v[1] & 0xffff);
}
else
{
dir.tdir_offset = (uint)(v[0] & 0xffff);
if (dir.tdir_count == 2)
dir.tdir_offset |= (uint)(v[1] << 16);
}
return true;
}
return writeData(ref dir, v, dir.tdir_count);
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:26,代码来源:Tiff_DirWrite.cs
示例18: readDirEntryOk
private bool readDirEntryOk(TiffDirEntry[] dir, ulong dircount, bool isBigTiff)
{
int entrySize = 0;
if (isBigTiff)
{
entrySize = sizeof(short) * 2 + sizeof(long) * 2;
}
else
{
entrySize = sizeof(short) * 2 + sizeof(int) * 2;
}
int totalSize = entrySize * (int)dircount;
byte[] bytes = new byte[totalSize];
bool res = readOK(bytes, totalSize);
if (res)
readDirEntry(dir, dircount, bytes, 0, isBigTiff);
return res;
}
开发者ID:dronab,项目名称:libtiff.net,代码行数:19,代码来源:Tiff_Read.cs
示例19: writeInkNames
private bool writeInkNames(ref TiffDirEntry dir)
{
dir.tdir_tag = TiffTag.INKNAMES;
dir.tdir_type = TiffType.ASCII;
byte[] bytes = Latin1Encoding.GetBytes(m_dir.td_inknames);
dir.tdir_count = bytes.Length;
return writeByteArray(ref dir, bytes);
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:8,代码来源:Tiff_DirWrite.cs
示例20: writeFloatArray
private bool writeFloatArray(ref TiffDirEntry dir, float[] v)
{
if (dir.tdir_count == 1)
{
dir.tdir_offset = BitConverter.ToUInt32(BitConverter.GetBytes(v[0]), 0);
return true;
}
return writeData(ref dir, v, dir.tdir_count);
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:10,代码来源:Tiff_DirWrite.cs
注:本文中的BitMiracle.LibTiff.Classic.Internal.TiffDirEntry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论