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


C# Tiff.fieldSet方法代码示例

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


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

示例1: SetField

        /// <summary>
        /// Sets the value(s) of a tag in a TIFF file/stream open for writing.
        /// </summary>
        /// <param name="tif">An instance of the <see cref="Tiff"/> class.</param>
        /// <param name="tag">The tag.</param>
        /// <param name="value">The tag value(s).</param>
        /// <returns>
        /// <c>true</c> if tag value(s) were set successfully; otherwise, <c>false</c>.
        /// </returns>
        /// <seealso cref="Tiff.SetField"/>
        public virtual bool SetField(Tiff tif, TiffTag tag, FieldValue[] value)
        {
            const string module = "vsetfield";

            TiffDirectory td = tif.m_dir;
            bool status = true;
            int v32 = 0;
            int v = 0;

            bool end = false;
            bool badvalue = false;
            bool badvalue32 = false;

            switch (tag)
            {
                case TiffTag.SUBFILETYPE:
                    td.td_subfiletype = (FileType)value[0].ToByte();
                    break;
                case TiffTag.IMAGEWIDTH:
                    td.td_imagewidth = value[0].ToInt();
                    break;
                case TiffTag.IMAGELENGTH:
                    td.td_imagelength = value[0].ToInt();
                    break;
                case TiffTag.BITSPERSAMPLE:
                    td.td_bitspersample = value[0].ToShort();
                    // If the data require post-decoding processing to byte-swap samples, set it
                    // up here. Note that since tags are required to be ordered, compression code
                    // can override this behavior in the setup method if it wants to roll the post
                    // decoding work in with its normal work.
                    if ((tif.m_flags & TiffFlags.SWAB) == TiffFlags.SWAB)
                    {
                        switch (td.td_bitspersample)
                        {
                            case 16:
                                tif.m_postDecodeMethod = Tiff.PostDecodeMethodType.pdmSwab16Bit;
                                break;
                            case 24:
                                tif.m_postDecodeMethod = Tiff.PostDecodeMethodType.pdmSwab24Bit;
                                break;
                            case 32:
                                tif.m_postDecodeMethod = Tiff.PostDecodeMethodType.pdmSwab32Bit;
                                break;
                            case 64:
                                tif.m_postDecodeMethod = Tiff.PostDecodeMethodType.pdmSwab64Bit;
                                break;
                            case 128:
                                // two 64's
                                tif.m_postDecodeMethod = Tiff.PostDecodeMethodType.pdmSwab64Bit;
                                break;
                        }
                    }
                    break;
                case TiffTag.COMPRESSION:
                    v = value[0].ToInt() & 0xffff;
                    Compression comp = (Compression)v;
                    // If we're changing the compression scheme, then notify the previous module
                    // so that it can cleanup any state it's setup.
                    if (tif.fieldSet(FieldBit.Compression))
                    {
                        if (td.td_compression == comp)
                            break;

                        tif.m_currentCodec.Cleanup();
                        tif.m_flags &= ~TiffFlags.CODERSETUP;
                    }
                    // Setup new compression scheme.
                    status = tif.setCompressionScheme(comp);
                    if (status)
                        td.td_compression = comp;
                    else
                        status = false;
                    break;

                case TiffTag.PHOTOMETRIC:
                    td.td_photometric = (Photometric)value[0].ToInt();
                    break;
                case TiffTag.THRESHHOLDING:
                    td.td_threshholding = (Threshold)value[0].ToByte();
                    break;
                case TiffTag.FILLORDER:
                    v = value[0].ToInt();
                    FillOrder fo = (FillOrder)v;
                    if (fo != FillOrder.LSB2MSB && fo != FillOrder.MSB2LSB)
                    {
                        badvalue = true;
                        break;
                    }

                    td.td_fillorder = fo;
//.........这里部分代码省略.........
开发者ID:dronab,项目名称:libtiff.net,代码行数:101,代码来源:TiffTagMethods.cs


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