当前位置: 首页>>代码示例>>C#>>正文


C# Tiff.FindFieldInfo方法代码示例

本文整理汇总了C#中BitMiracle.LibTiff.Classic.Tiff.FindFieldInfo方法的典型用法代码示例。如果您正苦于以下问题:C# Tiff.FindFieldInfo方法的具体用法?C# Tiff.FindFieldInfo怎么用?C# Tiff.FindFieldInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BitMiracle.LibTiff.Classic.Tiff的用法示例。


在下文中一共展示了Tiff.FindFieldInfo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TiffGrid

    public TiffGrid(string filename, string NewFileName)
    {
      ValuesToWrite = new Dictionary<int, Dictionary<int, double>>();

      tiff_org = BitMiracle.LibTiff.Classic.Tiff.Open(Path.GetFullPath(filename), "r");

      tiff = BitMiracle.LibTiff.Classic.Tiff.Open(Path.GetFullPath(NewFileName), "w");
      foreach (TiffTag enu in Enum.GetValues(typeof(TiffTag)))
      {
        var val = tiff_org.GetField(enu);
        if (val != null & enu != TiffTag.EXTRASAMPLES)
          tiff.SetField(enu, val[0]);
      }

      for (int i = 0; i < tiff_org.GetTagListCount(); i++)
      {
        int k = tiff_org.GetTagListEntry(i);
        var ff = tiff_org.FindFieldInfo((TiffTag)k, TiffType.ANY);
        tiff.MergeFieldInfo(new TiffFieldInfo[] { ff }, 1);
        var val = tiff_org.GetField((TiffTag)tiff_org.GetTagListEntry(i));
        tiff.SetField((TiffTag)k, val[0], val[1]);
      }

      var val2 = tiff_org.GetField((TiffTag)33922)[1].ToDoubleArray();
      XOrigin = val2[3];
      YOrigin = val2[4]; //Upper basegrid assumes Lower
      val2 = tiff_org.GetField((TiffTag)33550)[1].ToDoubleArray();
      GridSize = val2[0];
      GridSize = val2[1];
      NumberOfColumns = tiff_org.GetField(TiffTag.IMAGEWIDTH)[0].ToInt();
      NumberOfRows = tiff_org.GetField(TiffTag.IMAGELENGTH)[0].ToInt();

      //Shift YOrigin to lower left
      YOrigin -= GridSize * NumberOfRows;
      scanline = new byte[tiff_org.ScanlineSize()];
      bits = scanline.Count() / NumberOfColumns;
      ScanLineCache = new Dictionary<int, byte[]>();




    }
开发者ID:JacobGudbjerg,项目名称:hydronumerics,代码行数:42,代码来源:TiffGrid.cs

示例2: GetField


//.........这里部分代码省略.........
                    break;
                case TiffTag.YCBCRSUBSAMPLING:
                    result = new FieldValue[2];
                    result[0].Set(td.td_ycbcrsubsampling[0]);
                    result[1].Set(td.td_ycbcrsubsampling[1]);
                    break;
                case TiffTag.TRANSFERFUNCTION:
                    result = new FieldValue[3];
                    result[0].Set(td.td_transferfunction[0]);
                    if (td.td_samplesperpixel - td.td_extrasamples > 1)
                    {
                        result[1].Set(td.td_transferfunction[1]);
                        result[2].Set(td.td_transferfunction[2]);
                    }
                    break;
                case TiffTag.REFERENCEBLACKWHITE:
                    if (td.td_refblackwhite != null)
                    {
                        result = new FieldValue[1];
                        result[0].Set(td.td_refblackwhite);
                    }
                    break;
                case TiffTag.INKNAMES:
                    result = new FieldValue[1];
                    result[0].Set(td.td_inknames);
                    break;
                default:
                    // This can happen if multiple images are open with 
                    // different codecs which have private tags. The global tag
                    // information table may then have tags that are valid for
                    // one file but not the other. If the client tries to get a
                    // tag that is not valid for the image's codec then we'll
                    // arrive here.
                    TiffFieldInfo fip = tif.FindFieldInfo(tag, TiffType.ANY);
                    if (fip == null || fip.Bit != FieldBit.Custom)
                    {
                        Tiff.ErrorExt(tif, tif.m_clientdata, "_TIFFVGetField",
                            "{0}: Invalid {1}tag \"{2}\" (not supported by codec)",
                            tif.m_name, Tiff.isPseudoTag(tag) ? "pseudo-" : string.Empty,
                            fip != null ? fip.Name : "Unknown");
                        result = null;
                        break;
                    }

                    // Do we have a custom value?
                    result = null;
                    for (int i = 0; i < td.td_customValueCount; i++)
                    {
                        TiffTagValue tv = td.td_customValues[i];
                        if (tv.info.Tag != tag)
                            continue;

                        if (fip.PassCount)
                        {
                            result = new FieldValue[2];

                            if (fip.ReadCount == TiffFieldInfo.Variable2)
                            {
                                result[0].Set(tv.count);
                            }
                            else
                            {
                                // Assume TiffFieldInfo.Variable
                                result[0].Set(tv.count);
                            }
                            
开发者ID:dronab,项目名称:libtiff.net,代码行数:66,代码来源:TiffTagMethods.cs

示例3: SetField


//.........这里部分代码省略.........
                    td.td_ycbcrsubsampling[1] = value[1].ToShort();
                    break;
                case TiffTag.TRANSFERFUNCTION:
                    v = ((td.td_samplesperpixel - td.td_extrasamples) > 1 ? 3 : 1);
                    for (int i = 0; i < v; i++)
                    {
                        Tiff.setShortArray(out td.td_transferfunction[i], value[0].ToShortArray(), 1 << td.td_bitspersample);
                    }
                    break;
                case TiffTag.REFERENCEBLACKWHITE:
                    // XXX should check for null range
                    Tiff.setFloatArray(out td.td_refblackwhite, value[0].ToFloatArray(), 6);
                    break;
                case TiffTag.INKNAMES:
                    v = value[0].ToInt();
                    string s = value[1].ToString();
                    v = checkInkNamesString(tif, v, s);
                    status = v > 0;
                    if (v > 0)
                    {
                        setNString(out td.td_inknames, s, v);
                        td.td_inknameslen = v;
                    }
                    break;
                default:
                    // This can happen if multiple images are open with
                    // different codecs which have private tags. The global tag
                    // information table may then have tags that are valid for
                    // one file but not the other. If the client tries to set a
                    // tag that is not valid for the image's codec then we'll
                    // arrive here. This happens, for example, when tiffcp is
                    // used to convert between compression schemes and
                    // codec-specific tags are blindly copied.
                    TiffFieldInfo fip = tif.FindFieldInfo(tag, TiffType.ANY);
                    if (fip == null || fip.Bit != FieldBit.Custom)
                    {
                        Tiff.ErrorExt(tif, tif.m_clientdata, module,
                            "{0}: Invalid {1}tag \"{2}\" (not supported by codec)",
                            tif.m_name, Tiff.isPseudoTag(tag) ? "pseudo-" : string.Empty,
                            fip != null ? fip.Name : "Unknown");
                        status = false;
                        break;
                    }

                    // Find the existing entry for this custom value.
                    int tvIndex = -1;
                    for (int iCustom = 0; iCustom < td.td_customValueCount; iCustom++)
                    {
                        if (td.td_customValues[iCustom].info.Tag == tag)
                        {
                            tvIndex = iCustom;
                            td.td_customValues[iCustom].value = null;
                            break;
                        }
                    }

                    // Grow the custom list if the entry was not found.
                    if (tvIndex == -1)
                    {
                        td.td_customValueCount++;
                        TiffTagValue[] new_customValues = Tiff.Realloc(
                            td.td_customValues, td.td_customValueCount - 1, td.td_customValueCount);
                        td.td_customValues = new_customValues;

                        tvIndex = td.td_customValueCount - 1;
                        td.td_customValues[tvIndex].info = fip;
开发者ID:dronab,项目名称:libtiff.net,代码行数:67,代码来源:TiffTagMethods.cs


注:本文中的BitMiracle.LibTiff.Classic.Tiff.FindFieldInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。