本文整理汇总了C#中DDW.Swf.SwfWriter.AppendSignedNBits方法的典型用法代码示例。如果您正苦于以下问题:C# SwfWriter.AppendSignedNBits方法的具体用法?C# SwfWriter.AppendSignedNBits怎么用?C# SwfWriter.AppendSignedNBits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DDW.Swf.SwfWriter
的用法示例。
在下文中一共展示了SwfWriter.AppendSignedNBits方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToSwf
public void ToSwf(SwfWriter w, ref uint fillBits, ref uint lineBits, ShapeType shapeType)
{
w.AppendBit(true);
w.AppendBit(true);
uint bits = SwfWriter.MinimumBits(DeltaX, DeltaY);
bits = bits < 2 ? 2 : bits; // min 2 bits
w.AppendBits(bits - 2, 4);
if (DeltaX != 0 && DeltaY != 0)
{
w.AppendBit(true);
w.AppendSignedNBits(DeltaX, bits);
w.AppendSignedNBits(DeltaY, bits);
}
else if (DeltaX == 0)
{
w.AppendBit(false);
w.AppendBit(true);
w.AppendSignedNBits(DeltaY, bits);
}
else
{
w.AppendBit(false);
w.AppendBit(false);
w.AppendSignedNBits(DeltaX, bits);
}
}
示例2: ToSwf
public void ToSwf(SwfWriter w, ref uint fillBits, ref uint lineBits, ShapeType shapeType)
{
// TypeFlag UB[1] Non-edge record flag. Always 0.
// StateNewStyles UB[1] New styles flag. Used by DefineShape2 and DefineShape3 only.
// StateLineStyle UB[1] Line style change flag.
// StateFillStyle1 UB[1] Fill style 1 change flag.
// StateFillStyle0 UB[1] Fill style 0 change flag.
// StateMoveTo UB[1] Move to flag.
if (shapeType == ShapeType.Glyph)
{
w.AppendBit(false);
w.AppendBit(false);//this.HasNewStyles);
w.AppendBit(false);//HasLineStyle);
w.AppendBit(false);//HasFillStyle1);
w.AppendBit(HasFillStyle0);
w.AppendBit(HasMove);//HasMove);
if (HasMove)
{
// not relative moves
uint bits = SwfWriter.MinimumBits(this.MoveDeltaX, this.MoveDeltaY);
w.AppendBits(bits, 5);
w.AppendSignedNBits(this.MoveDeltaX, bits);
w.AppendSignedNBits(this.MoveDeltaY, bits);
}
if (HasFillStyle0)
{
w.AppendBits(this.FillStyle0, fillBits);
}
}
else
{
w.AppendBit(false);
w.AppendBit(this.HasNewStyles);
w.AppendBit(HasLineStyle);
w.AppendBit(HasFillStyle1);
w.AppendBit(HasFillStyle0);
w.AppendBit(HasMove);
if (HasMove)
{
uint bits = SwfWriter.MinimumBits(this.MoveDeltaX, this.MoveDeltaY);
w.AppendBits(bits, 5);
w.AppendSignedNBits(this.MoveDeltaX, bits);
w.AppendSignedNBits(this.MoveDeltaY, bits);
}
if (HasFillStyle0)
{
w.AppendBits(this.FillStyle0, fillBits);
}
if (HasFillStyle1)
{
w.AppendBits(this.FillStyle1, fillBits);
}
if (HasLineStyle)
{
w.AppendBits(this.LineStyle, lineBits);
}
if (HasNewStyles)
{
w.Align();
FillStyles.ToSwf(w, shapeType);
LineStyles.ToSwf(w, shapeType);
fillBits = SwfWriter.MinimumBits((uint)FillStyles.FillStyles.Count);
lineBits = SwfWriter.MinimumBits((uint)LineStyles.LineStyles.Count); ;
w.AppendBits(fillBits, 4);
w.AppendBits(lineBits, 4);
}
}
}
示例3: ToSwf
public void ToSwf(SwfWriter w, ref uint fillBits, ref uint lineBits, ShapeType shapeType)
{
w.AppendBit(true);
w.AppendBit(false);
uint bits = SwfWriter.MinimumBits(ControlX, ControlY, AnchorX, AnchorY);
bits = bits < 2 ? 2 : bits; // min 2 bits
w.AppendBits(bits - 2, 4);
w.AppendSignedNBits(ControlX, bits);
w.AppendSignedNBits(ControlY, bits);
w.AppendSignedNBits(AnchorX, bits);
w.AppendSignedNBits(AnchorY, bits);
}
示例4: ToSwf
public void ToSwf(SwfWriter w, bool useAlpha)
{
w.AppendBit(HasAddTerms);
w.AppendBit(HasMultTerms);
uint bits = SwfWriter.MinimumBits(RMultTerm, GMultTerm, BMultTerm, AMultTerm, RAddTerm, GAddTerm, BAddTerm, AAddTerm);
w.AppendBits(bits, 4);
if (HasMultTerms)
{
w.AppendSignedNBits(RMultTerm, bits);
w.AppendSignedNBits(GMultTerm, bits);
w.AppendSignedNBits(BMultTerm, bits);
if (useAlpha)
{
w.AppendSignedNBits(AMultTerm, bits);
}
}
if (HasAddTerms)
{
w.AppendSignedNBits(RAddTerm, bits);
w.AppendSignedNBits(GAddTerm, bits);
w.AppendSignedNBits(BAddTerm, bits);
if (useAlpha)
{
w.AppendSignedNBits(AAddTerm, bits);
}
}
w.Align();
}
示例5: ToSwf
public void ToSwf(SwfWriter w, uint glyphBits, uint advanceBits, bool hasAlpha)
{
w.AppendBit(TextRecordType);
w.AppendBits(StyleFlagsReserved, 3);
w.AppendBit(StyleFlagsHasFont);
w.AppendBit(StyleFlagsHasColor);
w.AppendBit(StyleFlagsHasYOffset);
w.AppendBit(StyleFlagsHasXOffset);
w.Align();
if (StyleFlagsHasFont)
{
w.AppendUI16(FontID);
}
if (StyleFlagsHasColor)
{
w.AppendByte(TextColor.R);
w.AppendByte(TextColor.G);
w.AppendByte(TextColor.B);
if (hasAlpha)
{
w.AppendByte(TextColor.A);
}
}
if (StyleFlagsHasXOffset)
{
w.AppendInt16(XOffset);
}
if (StyleFlagsHasYOffset)
{
w.AppendInt16(YOffset);
}
if (StyleFlagsHasFont)
{
w.AppendUI16(TextHeight);
}
w.AppendByte((byte)GlyphEntries.Length);
for (int i = 0; i < GlyphEntries.Length; i++)
{
w.AppendBits(GlyphEntries[i].GlyphIndex, glyphBits);
w.AppendSignedNBits(GlyphEntries[i].GlyphAdvance, advanceBits);
}
w.Align();
}