本文整理汇总了C#中TiffTag类的典型用法代码示例。如果您正苦于以下问题:C# TiffTag类的具体用法?C# TiffTag怎么用?C# TiffTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TiffTag类属于命名空间,在下文中一共展示了TiffTag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetField
public override bool SetField(Tiff tif, TiffTag tag, FieldValue[] ap)
{
DeflateCodec sp = tif.m_currentCodec as DeflateCodec;
Debug.Assert(sp != null);
const string module = "ZIPVSetField";
switch (tag)
{
case TiffTag.ZIPQUALITY:
sp.m_zipquality = ap[0].ToInt();
if ((sp.m_state & DeflateCodec.ZSTATE_INIT_ENCODE) != 0)
{
if (sp.m_stream.deflateParams(sp.m_zipquality, zlibConst.Z_DEFAULT_STRATEGY) != zlibConst.Z_OK)
{
Tiff.ErrorExt(tif, tif.m_clientdata, module,
"{0}: zlib error: {0}", tif.m_name, sp.m_stream.msg);
return false;
}
}
return true;
}
return base.SetField(tif, tag, ap);
}
示例2: okToChangeTag
/*
* Return true / false according to whether or not
* it is permissible to set the tag's value.
* Note that we allow ImageLength to be changed
* so that we can append and extend to images.
* Any other tag may not be altered once writing
* has commenced, unless its value has no effect
* on the format of the data that is written.
*/
private bool okToChangeTag(TiffTag tag)
{
TiffFieldInfo fip = FindFieldInfo(tag, TiffType.ANY);
if (fip == null)
{
// unknown tag
ErrorExt(this, m_clientdata, "SetField", "{0}: Unknown {1}tag {2}",
m_name, isPseudoTag(tag) ? "pseudo-" : string.Empty, tag);
return false;
}
if (tag != TiffTag.IMAGELENGTH &&
(m_flags & TiffFlags.BEENWRITING) == TiffFlags.BEENWRITING &&
!fip.OkToChange)
{
// Consult info table to see if tag can be changed after we've
// started writing. We only allow changes to those tags that
// don't / shouldn't affect the compression and / or format of
// the data.
ErrorExt(this, m_clientdata, "SetField", "{0}: Cannot modify tag \"{1}\" while writing",
m_name, fip.Name);
return false;
}
return true;
}
示例3: GetField
public override FieldValue[] GetField(Tiff tif, TiffTag tag)
{
JpegCodec sp = tif.m_currentCodec as JpegCodec;
Debug.Assert(sp != null);
FieldValue[] result = null;
switch (tag)
{
case TiffTag.JPEGTABLES:
result = new FieldValue[2];
result[0].Set(sp.m_jpegtables_length);
result[1].Set(sp.m_jpegtables);
break;
case TiffTag.JPEGQUALITY:
result = new FieldValue[1];
result[0].Set(sp.m_jpegquality);
break;
case TiffTag.JPEGCOLORMODE:
result = new FieldValue[1];
result[0].Set(sp.m_jpegcolormode);
break;
case TiffTag.JPEGTABLESMODE:
result = new FieldValue[1];
result[0].Set(sp.m_jpegtablesmode);
break;
case TiffTag.YCBCRSUBSAMPLING:
JPEGFixupTestSubsampling(tif);
return base.GetField(tif, tag);
case TiffTag.FAXRECVPARAMS:
result = new FieldValue[1];
result[0].Set(sp.m_recvparams);
break;
case TiffTag.FAXSUBADDRESS:
result = new FieldValue[1];
result[0].Set(sp.m_subaddress);
break;
case TiffTag.FAXRECVTIME:
result = new FieldValue[1];
result[0].Set(sp.m_recvtime);
break;
case TiffTag.FAXDCS:
result = new FieldValue[1];
result[0].Set(sp.m_faxdcs);
break;
default:
return base.GetField(tif, tag);
}
return result;
}
示例4: SetField
public override bool SetField(Tiff tif, TiffTag tag, FieldValue[] ap)
{
CCITTCodec sp = tif.m_currentCodec as CCITTCodec;
Debug.Assert(sp != null);
switch (tag)
{
case TiffTag.FAXMODE:
sp.m_mode = (FaxMode)ap[0].ToShort();
return true; /* NB: pseudo tag */
case TiffTag.FAXFILLFUNC:
sp.fill = ap[0].Value as Tiff.FaxFillFunc;
return true; /* NB: pseudo tag */
case TiffTag.GROUP3OPTIONS:
/* XXX: avoid reading options if compression mismatches. */
if (tif.m_dir.td_compression == Compression.CCITTFAX3)
sp.m_groupoptions = (Group3Opt)ap[0].ToShort();
break;
case TiffTag.GROUP4OPTIONS:
/* XXX: avoid reading options if compression mismatches. */
if (tif.m_dir.td_compression == Compression.CCITTFAX4)
sp.m_groupoptions = (Group3Opt)ap[0].ToShort();
break;
case TiffTag.BADFAXLINES:
sp.m_badfaxlines = ap[0].ToInt();
break;
case TiffTag.CLEANFAXDATA:
sp.m_cleanfaxdata = (CleanFaxData)ap[0].ToByte();
break;
case TiffTag.CONSECUTIVEBADFAXLINES:
sp.m_badfaxrun = ap[0].ToInt();
break;
case TiffTag.FAXRECVPARAMS:
sp.m_recvparams = ap[0].ToInt();
break;
case TiffTag.FAXSUBADDRESS:
Tiff.setString(out sp.m_subaddress, ap[0].ToString());
break;
case TiffTag.FAXRECVTIME:
sp.m_recvtime = ap[0].ToInt();
break;
case TiffTag.FAXDCS:
Tiff.setString(out sp.m_faxdcs, ap[0].ToString());
break;
default:
return base.SetField(tif, tag, ap);
}
TiffFieldInfo fip = tif.FieldWithTag(tag);
if (fip != null)
tif.setFieldBit(fip.Bit);
else
return false;
tif.m_flags |= TiffFlags.DIRTYDIRECT;
return true;
}
示例5: 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;
}
示例6: 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;
}
示例7: GetField
public override FieldValue[] GetField(Tiff tif, TiffTag tag)
{
OJpegCodec sp = tif.m_currentCodec as OJpegCodec;
Debug.Assert(sp != null);
FieldValue[] result = null;
switch (tag)
{
case TiffTag.JPEGIFOFFSET:
result = new FieldValue[1];
result[0].Set(sp.m_jpeg_interchange_format);
break;
case TiffTag.JPEGIFBYTECOUNT:
result = new FieldValue[1];
result[0].Set(sp.m_jpeg_interchange_format_length);
break;
case TiffTag.YCBCRSUBSAMPLING:
if (!sp.m_subsamplingcorrect_done)
sp.OJPEGSubsamplingCorrect();
result = new FieldValue[2];
result[0].Set(sp.m_subsampling_hor);
result[1].Set(sp.m_subsampling_ver);
break;
case TiffTag.JPEGQTABLES:
result = new FieldValue[2];
result[0].Set(sp.m_qtable_offset_count);
result[1].Set(sp.m_qtable_offset);
break;
case TiffTag.JPEGDCTABLES:
result = new FieldValue[2];
result[0].Set(sp.m_dctable_offset_count);
result[1].Set(sp.m_dctable_offset);
break;
case TiffTag.JPEGACTABLES:
result = new FieldValue[2];
result[0].Set(sp.m_actable_offset_count);
result[1].Set(sp.m_actable_offset);
break;
case TiffTag.JPEGPROC:
result = new FieldValue[1];
result[0].Set(sp.m_jpeg_proc);
break;
case TiffTag.JPEGRESTARTINTERVAL:
result = new FieldValue[1];
result[0].Set(sp.m_restart_interval);
break;
default:
return base.GetField(tif, tag);
}
return result;
}
示例8: TiffFieldInfo
/// <summary>
/// Initializes a new instance of the <see cref="TiffFieldInfo"/> class.
/// </summary>
/// <param name="tag">The tag to describe.</param>
/// <param name="readCount">The number of values to read when reading field information or
/// one of <see cref="Variable"/>, <see cref="Spp"/> and <see cref="Variable2"/>.</param>
/// <param name="writeCount">The number of values to write when writing field information
/// or one of <see cref="Variable"/>, <see cref="Spp"/> and <see cref="Variable2"/>.</param>
/// <param name="type">The type of the field value.</param>
/// <param name="bit">Index of the bit to use in "Set Fields Vector" when this instance
/// is merged into field info collection. Take a look at <see cref="FieldBit"/> class.</param>
/// <param name="okToChange">If true, then it is permissible to set the tag's value even
/// after writing has commenced.</param>
/// <param name="passCount">If true, then number of value elements should be passed to
/// <see cref="Tiff.SetField"/> method as second parameter (right after tag type AND
/// before value itself).</param>
/// <param name="name">The name (description) of the tag this instance describes.</param>
public TiffFieldInfo(TiffTag tag, short readCount, short writeCount,
TiffType type, short bit, bool okToChange, bool passCount, string name)
{
m_tag = tag;
m_readCount = readCount;
m_writeCount = writeCount;
m_type = type;
m_bit = bit;
m_okToChange = okToChange;
m_passCount = passCount;
m_name = name;
}
示例9: 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;
}
示例10: GetField
public override FieldValue[] GetField(Tiff tif, TiffTag tag)
{
DeflateCodec sp = tif.m_currentCodec as DeflateCodec;
Debug.Assert(sp != null);
switch (tag)
{
case TiffTag.ZIPQUALITY:
FieldValue[] result = new FieldValue[1];
result[0].Set(sp.m_zipquality);
return result;
}
return base.GetField(tif, tag);
}
示例11: GetField
public override FieldValue[] GetField(Tiff tif, TiffTag tag)
{
CCITTCodec sp = tif.m_currentCodec as CCITTCodec;
Debug.Assert(sp != null);
FieldValue[] result = new FieldValue[1];
switch (tag)
{
case TiffTag.FAXMODE:
result[0].Set(sp.m_mode);
break;
case TiffTag.FAXFILLFUNC:
result[0].Set(sp.fill);
break;
case TiffTag.GROUP3OPTIONS:
case TiffTag.GROUP4OPTIONS:
result[0].Set(sp.m_groupoptions);
break;
case TiffTag.BADFAXLINES:
result[0].Set(sp.m_badfaxlines);
break;
case TiffTag.CLEANFAXDATA:
result[0].Set(sp.m_cleanfaxdata);
break;
case TiffTag.CONSECUTIVEBADFAXLINES:
result[0].Set(sp.m_badfaxrun);
break;
case TiffTag.FAXRECVPARAMS:
result[0].Set(sp.m_recvparams);
break;
case TiffTag.FAXSUBADDRESS:
result[0].Set(sp.m_subaddress);
break;
case TiffTag.FAXRECVTIME:
result[0].Set(sp.m_recvtime);
break;
case TiffTag.FAXDCS:
result[0].Set(sp.m_faxdcs);
break;
default:
return base.GetField(tif, tag);
}
return result;
}
示例12: GetField
public override FieldValue[] GetField(Tiff tif, TiffTag tag)
{
CodecWithPredictor sp = tif.m_currentCodec as CodecWithPredictor;
Debug.Assert(sp != null);
switch (tag)
{
case TiffTag.PREDICTOR:
FieldValue[] result = new FieldValue[1];
result[0].Set(sp.GetPredictorValue());
return result;
}
TiffTagMethods childMethods = sp.GetChildTagMethods();
if (childMethods != null)
return childMethods.GetField(tif, tag);
return base.GetField(tif, tag);
}
示例13: SetField
public override bool SetField(Tiff tif, TiffTag tag, FieldValue[] ap)
{
CodecWithPredictor sp = tif.m_currentCodec as CodecWithPredictor;
Debug.Assert(sp != null);
switch (tag)
{
case TiffTag.PREDICTOR:
sp.SetPredictorValue((Predictor)ap[0].ToByte());
tif.setFieldBit(CodecWithPredictor.FIELD_PREDICTOR);
tif.m_flags |= TiffFlags.DIRTYDIRECT;
return true;
}
TiffTagMethods childMethods = sp.GetChildTagMethods();
if (childMethods != null)
return childMethods.SetField(tif, tag, ap);
return base.SetField(tif, tag, ap);
}
示例14: PrintTagInfo
private static void PrintTagInfo(Tiff tiff, TiffTag tiffTag)
{
try
{
var field = tiff.GetField(tiffTag);
if (field != null)
{
Console.WriteLine($"{tiffTag}");
for (int i = 0; i < field.Length; i++)
{
Console.WriteLine($" [{i}] {field[i].Value}");
byte[] bytes = field[i].Value as byte[];
if (bytes != null)
{
Console.WriteLine($" Length: {bytes.Length}");
if (bytes.Length % 8 == 0)
{
for (int k = 0; k < bytes.Length / 8; k++)
{
Console.WriteLine($" [{k}] {BitConverter.ToDouble(bytes, k * 8)}");
}
}
try
{
Console.WriteLine($" > {System.Text.Encoding.ASCII.GetString(bytes).Trim()} < ");
}
catch (Exception ex)
{
}
}
}
}
}
catch (Exception ex)
{
Console.WriteLine($"ERROR: {tiffTag}");
}
}
示例15: isPseudoTag
/* is tag value normal or pseudo */
internal static bool isPseudoTag(TiffTag t)
{
return ((int)t > 0xffff);
}