本文整理汇总了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;
}
}
}
示例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)
{
//.........这里部分代码省略.........