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


C# Shape.Parse方法代码示例

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


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

示例1: Parse

        /// <summary>
        /// Parses this object out of a stream
        /// </summary>
        protected override void Parse()
        {
            BinaryReader br = new BinaryReader(this._dataStream);

            this._fontID = br.ReadUInt16();

            UInt16 glyphTableOffset = br.ReadUInt16();

            this._numberOfGlyphs = (UInt16)(glyphTableOffset / 2);

            this._offsetTable = new UInt16[_numberOfGlyphs];
            this._offsetTable[0] = glyphTableOffset;

            long glyphTableStreamOffset = glyphTableOffset + 2;

            for (int i = 1; i < this._numberOfGlyphs; i++)
            {
                this._offsetTable[i] = br.ReadUInt16();
            }

            this._glyphShapeTable = new Shape[this._numberOfGlyphs];

            for (int i = 0; i < this._numberOfGlyphs; i++)
            {
                Shape s = new Shape(this._SwfVersion);

                if (i < this._numberOfGlyphs - 1)
                {
                    s.Parse(this._dataStream, this._offsetTable[i + 1] - this._offsetTable[i], this._tag.TagType);
                    this._glyphShapeTable[i] = s;
                }

                else
                {
                    s.Parse(this._dataStream, this._dataStream.Length - this._dataStream.Position, this._tag.TagType);
                    this._glyphShapeTable[i] = s;
                }

            }
        }
开发者ID:rtezli,项目名称:Blitzableiter,代码行数:43,代码来源:DefineFont.cs

示例2: ParseFlags

        /// <summary>
        /// Parses the flags of this tag.
        /// </summary>
        /// <param name="input">The input stream where to read from.</param>
        protected virtual void ParseFlags(Stream input)
        {
            BinaryReader br = new BinaryReader(this._dataStream);
            BitStream bits = new BitStream(this._dataStream);

            base._fontID = br.ReadUInt16();

            this._fontFlagsHasLayout = 0 == bits.GetBits(1) ? false : true;
            this._fontFlagsShiftJIS = 0 == bits.GetBits(1) ? false : true;
            this._fontFlagsSmallText = 0 == bits.GetBits(1) ? false : true;
            this._fontFlagsANSI = 0 == bits.GetBits(1) ? false : true;

            this._fontFlagsWideOffsets = 0 == bits.GetBits(1) ? false : true;
            this._fontFlagsWideCodes = 0 == bits.GetBits(1) ? false : true;
            this._fontFlagsItalic = 0 == bits.GetBits(1) ? false : true;
            this._fontFlagsBold = 0 == bits.GetBits(1) ? false : true;

            if (this._SwfVersion <= 5)
            {
                br.ReadByte();
                this._languageCode = 0;
            }
            else
            {
                this._languageCode = (LangCode)br.ReadByte();
            }

            this._fontNameLen = br.ReadByte();
            this._fontName = new byte[this._fontNameLen];
            this._dataStream.Read(this._fontName, 0, this._fontNameLen);
               //Log.Debug(this, "Font name: " + Encoding.UTF8.GetString(this._fontName) + " Character ID:" + this._fontID);

            this._numberOfGlyphs = br.ReadUInt16(); // Zero for device fonts

            Int64 offsetTableOffset = this._dataStream.Position;

            if (this._dataStream.Position < this._dataStream.Length)
            {
                this._hasGlyphs = true;

                if (this._numberOfGlyphs.Equals(0))
                {
                    Log.Warn(this, "Number of glyphs is zero which means that this tag is used for a device font. For device fonts no glyph-rendering fallback is desired, but trailing data has been detected.");
                }

                if (this._fontFlagsWideOffsets)
                {
                    this._wideOffsetTable = new UInt32[this._numberOfGlyphs];

                    for (int i = 0; i < this._numberOfGlyphs; i++)
                    {
                        this._wideOffsetTable[i] = br.ReadUInt32();
                    }

                    this._wideCodeTableOffset = br.ReadUInt32();
                    Int64 realCodeTableOffset = offsetTableOffset + this._wideCodeTableOffset;

                    this._glyphShapeTable = new Shape[this._numberOfGlyphs];

                    for (int i = 0; i < this._numberOfGlyphs; i++)
                    {
                        Shape s = new Shape(this._SwfVersion);

                        if (i < this._numberOfGlyphs - 1)
                        {
                            s.Parse(this._dataStream, this._wideOffsetTable[i + 1] - this._wideOffsetTable[i], this._tag.TagType);
                            this._glyphShapeTable[i] = s;
                        }
                        else // last
                        {
                            s.Parse(this._dataStream, realCodeTableOffset - this._dataStream.Position, this._tag.TagType);
                            this._glyphShapeTable[i] = s;
                        }
                    }
                }

                else
                {
                    this._offsetTable = new UInt16[this._numberOfGlyphs];

                    for (int i = 0; i < this._numberOfGlyphs; i++)
                    {
                        this._offsetTable[i] = br.ReadUInt16();
                    }

                    this._codeTableOffset = br.ReadUInt16();
                    Int64 realCodeTableOffset = offsetTableOffset + this._codeTableOffset;

                    this._glyphShapeTable = new Shape[this._numberOfGlyphs];

                    for (int i = 0; i < this._numberOfGlyphs; i++)
                    {
                        Shape s = new Shape(this._SwfVersion);

                        if (i < this._numberOfGlyphs - 1)
                        {
//.........这里部分代码省略.........
开发者ID:rtezli,项目名称:Blitzableiter,代码行数:101,代码来源:DefineFont2.cs


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