• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# TiffTag类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中TiffTag的典型用法代码示例。如果您正苦于以下问题:C# TiffTag类的具体用法?C# TiffTag怎么用?C# TiffTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TiffTag类属于命名空间,在下文中一共展示了TiffTag类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
        }
开发者ID:dronab,项目名称:libtiff.net,代码行数:26,代码来源:DeflateCodecTagMethods.cs


示例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;
        }
开发者ID:dronab,项目名称:libtiff.net,代码行数:35,代码来源:Tiff_Dir.cs


示例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;
        }
开发者ID:Core-Techs,项目名称:TiffLibrary,代码行数:60,代码来源:JpegCodecTagMethods.cs


示例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;
        }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:57,代码来源:CCITTCodecTagMethods.cs


示例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;
        }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:10,代码来源:Tiff_DirWrite.cs


示例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;
        }
开发者ID:Core-Techs,项目名称:TiffLibrary,代码行数:10,代码来源:Tiff_DirRead.cs


示例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;
        }
开发者ID:Core-Techs,项目名称:TiffLibrary,代码行数:54,代码来源:OJpegCodecTagMethods.cs


示例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;
 }
开发者ID:dronab,项目名称:libtiff.net,代码行数:29,代码来源:TiffFieldInfo.cs


示例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;
        }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:13,代码来源:Tiff_DirWrite.cs


示例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);
        }
开发者ID:dronab,项目名称:libtiff.net,代码行数:15,代码来源:DeflateCodecTagMethods.cs


示例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;
        }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:46,代码来源:CCITTCodecTagMethods.cs


示例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);
        }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:19,代码来源:CodecWithPredictorTagMethods.cs


示例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);
        }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:20,代码来源:CodecWithPredictorTagMethods.cs


示例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}");
            }
        }
开发者ID:CatalystCode,项目名称:TerrainFlow-Web,代码行数:40,代码来源:GeoTiff.cs


示例15: isPseudoTag

 /* is tag value normal or pseudo */
 internal static bool isPseudoTag(TiffTag t)
 {
     return ((int)t > 0xffff);
 }
开发者ID:Orvid,项目名称:Cosmos,代码行数:5,代码来源:LibTiff.cs


示例16: GetField

        /// <summary>
        /// Gets the value(s) of a tag in an open TIFF file.
        /// </summary>
        /// <param name="tif">An instance of the <see cref="Tiff"/> class.</param>
        /// <param name="tag">The tag.</param>
        /// <returns>The value(s) of a tag in an open TIFF file/stream as array of
        /// <see cref="FieldValue"/> objects or <c>null</c> if there is no such tag set.</returns>
        /// <seealso cref="Tiff.GetField"/>
        public virtual FieldValue[] GetField(Tiff tif, TiffTag tag)
        {
            TiffDirectory td = tif.m_dir;
            FieldValue[] result = null;

            switch (tag)
            {
                case TiffTag.SubFileType:
                    result = new FieldValue[1];
                    result[0].Set(td.td_subfiletype);
                    break;
                case TiffTag.ImageWidth:
                    result = new FieldValue[1];
                    result[0].Set(td.td_imagewidth);
                    break;
                case TiffTag.ImageLength:
                    result = new FieldValue[1];
                    result[0].Set(td.td_imagelength);
                    break;
                case TiffTag.BitsPerSample:
                    result = new FieldValue[1];
                    result[0].Set(td.td_bitspersample);
                    break;
                case TiffTag.Compression:
                    result = new FieldValue[1];
                    result[0].Set(td.td_compression);
                    break;
                case TiffTag.Photometric:
                    result = new FieldValue[1];
                    result[0].Set(td.td_photometric);
                    break;
                case TiffTag.Threshholding:
                    result = new FieldValue[1];
                    result[0].Set(td.td_threshholding);
                    break;
                case TiffTag.FillOrder:
                    result = new FieldValue[1];
                    result[0].Set(td.td_fillorder);
                    break;
                case TiffTag.Orientation:
                    result = new FieldValue[1];
                    result[0].Set(td.td_orientation);
                    break;
                case TiffTag.SamplesPerPixel:
                    result = new FieldValue[1];
                    result[0].Set(td.td_samplesperpixel);
                    break;
                case TiffTag.RowsPerStrip:
                    result = new FieldValue[1];
                    result[0].Set(td.td_rowsperstrip);
                    break;
                case TiffTag.MinSampleValue:
                    result = new FieldValue[1];
                    result[0].Set(td.td_minsamplevalue);
                    break;
                case TiffTag.MaxSampleValue:
                    result = new FieldValue[1];
                    result[0].Set(td.td_maxsamplevalue);
                    break;
                case TiffTag.SMinSampleValue:
                    result = new FieldValue[1];
                    result[0].Set(td.td_sminsamplevalue);
                    break;
                case TiffTag.SMaxSampleValue:
                    result = new FieldValue[1];
                    result[0].Set(td.td_smaxsamplevalue);
                    break;
                case TiffTag.XResolution:
                    result = new FieldValue[1];
                    result[0].Set(td.td_xresolution);
                    break;
                case TiffTag.YResolution:
                    result = new FieldValue[1];
                    result[0].Set(td.td_yresolution);
                    break;
                case TiffTag.PlanarConfig:
                    result = new FieldValue[1];
                    result[0].Set(td.td_planarconfig);
                    break;
                case TiffTag.XPosition:
                    result = new FieldValue[1];
                    result[0].Set(td.td_xposition);
                    break;
                case TiffTag.YPosition:
                    result = new FieldValue[1];
                    result[0].Set(td.td_yposition);
                    break;
                case TiffTag.ResolutionUnit:
                    result = new FieldValue[1];
                    result[0].Set(td.td_resolutionunit);
                    break;
                case TiffTag.PageNumber:
//.........这里部分代码省略.........
开发者ID:Orvid,项目名称:Cosmos,代码行数:101,代码来源:LibTiff.cs


示例17: createAnonFieldInfo

        private static TiffFieldInfo createAnonFieldInfo(TiffTag tag, TiffType field_type)
        {
            TiffFieldInfo fld = new TiffFieldInfo(tag, TiffFieldInfo.Variable2,
                TiffFieldInfo.Variable2, field_type, FieldBit.Custom, true, true, null);

            // note that this name is a special sign to Close() and
            // setupFieldInfo() to free the field
            fld.Name = string.Format(CultureInfo.InvariantCulture, "Tag {0}", tag);
            return fld;
        }
开发者ID:Orvid,项目名称:Cosmos,代码行数:10,代码来源:LibTiff.cs


示例18: SetField

        public override bool SetField(Tiff tif, TiffTag tag, FieldValue[] ap)
        {
            const string module = "OJPEGVSetField";
            OJpegCodec sp = tif.m_currentCodec as OJpegCodec;
            Debug.Assert(sp != null);

            uint ma;
            uint[] mb;
            uint n;
            switch (tag)
            {
                case TiffTag.JPEGIFOffset:
                    sp.m_jpeg_interchange_format = ap[0].ToUInt();
                    break;
                case TiffTag.JPEGIFByteCount:
                    sp.m_jpeg_interchange_format_length = ap[0].ToUInt();
                    break;
                case TiffTag.YCBCRSUBSAMPLING:
                    sp.m_subsampling_tag = true;
                    sp.m_subsampling_hor = ap[0].ToByte();
                    sp.m_subsampling_ver = ap[1].ToByte();
                    tif.m_dir.td_ycbcrsubsampling[0] = sp.m_subsampling_hor;
                    tif.m_dir.td_ycbcrsubsampling[1] = sp.m_subsampling_ver;
                    break;
                case TiffTag.JPEGQTables:
                    ma = ap[0].ToUInt();
                    if (ma != 0)
                    {
                        if (ma > 3)
                        {
                            Tiff.ErrorExt(tif, tif.m_clientdata, module, "JpegQTables tag has incorrect count");
                            return false;
                        }
                        sp.m_qtable_offset_count = (byte)ma;
                        mb = ap[1].ToUIntArray();
                        for (n = 0; n < ma; n++)
                            sp.m_qtable_offset[n] = mb[n];
                    }
                    break;
                case TiffTag.JPEGDCTables:
                    ma = ap[0].ToUInt();
                    if (ma != 0)
                    {
                        if (ma > 3)
                        {
                            Tiff.ErrorExt(tif, tif.m_clientdata, module, "JpegDcTables tag has incorrect count");
                            return false;
                        }
                        sp.m_dctable_offset_count = (byte)ma;
                        mb = ap[1].ToUIntArray();
                        for (n = 0; n < ma; n++)
                            sp.m_dctable_offset[n] = mb[n];
                    }
                    break;
                case TiffTag.JPEGACTABLES:
                    ma = ap[0].ToUInt();
                    if (ma != 0)
                    {
                        if (ma > 3)
                        {
                            Tiff.ErrorExt(tif, tif.m_clientdata, module, "JpegAcTables tag has incorrect count");
                            return false;
                        }
                        sp.m_actable_offset_count = (byte)ma;
                        mb = ap[1].ToUIntArray();
                        for (n = 0; n < ma; n++)
                            sp.m_actable_offset[n] = mb[n];
                    }
                    break;
                case TiffTag.JPEGProc:
                    sp.m_jpeg_proc = ap[0].ToByte();
                    break;
                case TiffTag.JPEGRestartInterval:
                    sp.m_restart_interval = ap[0].ToUShort();
                    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;
        }
开发者ID:Orvid,项目名称:Cosmos,代码行数:88,代码来源:LibTiff.cs


示例19: writeAnyArray

        /// <summary>
        /// Writes an array of "type" values for a specified tag (i.e. this is
        /// a tag which is allowed to have different types, e.g. SMaxSampleType).
        /// Internally the data values are represented as double since a double
        /// can hold any of the TIFF tag types (yes, this should really be an abstract
        /// type tany_t for portability).  The data is converted into the specified
        /// type in a temporary buffer and then handed off to the appropriate array
        /// writer.
        /// </summary>
        private bool writeAnyArray(TiffType type, TiffTag tag, ref TiffDirEntry dir, int n, double[] v)
        {
            dir.tdir_tag = tag;
            dir.tdir_type = type;
            dir.tdir_count = n;

            bool failed = false;
            switch (type)
            {
                case TiffType.Byte:
                case TiffType.SByte:
                    {
                        byte[] bp = new byte[n];
                        for (int i = 0; i < n; i++)
                            bp[i] = (byte)v[i];

                        if (!writeByteArray(ref dir, bp))
                            failed = true;
                    }
                    break;
                case TiffType.Short:
                case TiffType.SShort:
                    {
                        short[] bp = new short[n];
                        for (int i = 0; i < n; i++)
                            bp[i] = (short)v[i];

                        if (!writeShortArray(ref dir, bp))
                            failed = true;
                    }
                    break;
                case TiffType.Long:
                case TiffType.SLong:
                    {
                        int[] bp = new int[n];
                        for (int i = 0; i < n; i++)
                            bp[i] = (int)v[i];

                        if (!writeLongArray(ref dir, bp))
                            failed = true;
                    }
                    break;
                case TiffType.Float:
                    {
                        float[] bp = new float[n];
                        for (int i = 0; i < n; i++)
                            bp[i] = (float)v[i];

                        if (!writeFloatArray(ref dir, bp))
                            failed = true;
                    }
                    break;
                case TiffType.Double:
                    if (!writeDoubleArray(ref dir, v))
                        failed = true;

                    break;

                default:
                    // NoType
                    // ASCII
                    // Undefined
                    // Rational
                    // SRational
                    failed = true;
                    break;
            }

            return !failed;
        }
开发者ID:Orvid,项目名称:Cosmos,代码行数:79,代码来源:LibTiff.cs


示例20: FindFieldInfo

        /// <summary>
        /// Retrieves field information for the specified tag.
        /// </summary>
        /// <param name="tag">The tag to retrieve field information for.</param>
        /// <param name="type">The tiff data type to use us additional filter.</param>
        /// <returns>The field information for specified tag with specified type or <c>null</c> if
        /// the field information wasn't found.</returns>
        public TiffFieldInfo FindFieldInfo(TiffTag tag, TiffType type)
        {
            if (m_foundfield != null && m_foundfield.Tag == tag &&
                (type == TiffType.Any || type == m_foundfield.Type))
            {
                return m_foundfield;
            }

            // If we are invoked with no field information, then just return.
            if (m_fieldinfo == null)
                return null;

            m_foundfield = null;

            foreach (TiffFieldInfo info in m_fieldinfo)
            {
                if (info != null && info.Tag == tag && (type == TiffType.Any || type == info.Type))
                {
                    m_foundfield = info;
                    break;
                }
            }

            return m_foundfield;
        }
开发者ID:Orvid,项目名称:Cosmos,代码行数:32,代码来源:LibTiff.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Tile类代码示例发布时间:2022-05-24
下一篇:
C# Ticks类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap