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


C# SwfWriter.AppendSignedNBits方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:Hamsand,项目名称:Swf2XNA,代码行数:27,代码来源:StraightEdgeRecord.cs

示例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);
                }
            }
        }
开发者ID:Hamsand,项目名称:Swf2XNA,代码行数:80,代码来源:StyleChangedRecord.cs

示例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);
        }
开发者ID:Hamsand,项目名称:Swf2XNA,代码行数:14,代码来源:CurvedEdgeRecord.cs

示例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();
        }
开发者ID:Hamsand,项目名称:Swf2XNA,代码行数:30,代码来源:ColorTransform.cs

示例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();
        }
开发者ID:Hamsand,项目名称:Swf2XNA,代码行数:46,代码来源:TextRecord.cs


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