Ejemplo n.º 1
0
        public ShapeRecord(SwfStream swf, bool hasAlpha, bool isExtended, bool extendedStyles, ShapeState state)
        {
            int f0 = 0, f1 = 0, l = 0;

            mFlags = swf.ReadBitUInt(6);

            Type = ConvertType(mFlags);
            switch (Type)
            {
                case ShapeRecordType.StyleChange:
                    {
                        if (NewMoveTo)
                        {
                            int bits = (int)swf.ReadBitUInt(5);
                            MoveDeltaX = swf.ReadBitInt(bits);
                            MoveDeltaY = swf.ReadBitInt(bits);
                        }
                        if (NewFillStyle0) f0 = ((int)swf.ReadBitUInt(state.FillBits));
                        if (NewFillStyle1) f1 = ((int)swf.ReadBitUInt(state.FillBits));
                        if (NewLineStyle) l = ((int)swf.ReadBitUInt(state.LineBits));
                        if (NewStyles && extendedStyles)
                        {
                            state.FillStyles = new FillStyleArray(swf, hasAlpha);
                            state.LineStyles = new LineStyleArray(swf, hasAlpha, isExtended);
                            state.FillBits = (int)swf.ReadBitUInt(4);
                            state.LineBits = (int)swf.ReadBitUInt(4);
                        }
                        if (NewFillStyle0) FillStyle0 = state.GetFill(f0);
                        if (NewFillStyle1) FillStyle1 = state.GetFill(f1);
                        if (NewLineStyle) LineStyle = state.GetLine(l);
                    }
                    break;
                case ShapeRecordType.StraightEdge:
                    {
                        int bits = 2 + (int)(mFlags & 0x0F);
                        bool general = swf.ReadBit();
                        bool vert = general || swf.ReadBit();
                        DrawDeltaX = (general || !vert) ? swf.ReadBitInt(bits) : 0;
                        DrawDeltaY = (general ||  vert) ? swf.ReadBitInt(bits) : 0;
                    }
                    break;
                case ShapeRecordType.CurvedEdge:
                    {
                        int bits = 2 + (int)(mFlags & 0x0F);
                        DrawControlX = swf.ReadBitInt(bits);
                        DrawControlY = swf.ReadBitInt(bits);
                        DrawDeltaX = swf.ReadBitInt(bits);
                        DrawDeltaY = swf.ReadBitInt(bits);
                    }
                    break;
            }
        }
Ejemplo n.º 2
0
 public GlyphEntry(SwfStream stream, int glyphBits, int advanceBits)
 {
     GlyphIndex = stream.ReadBitUInt(glyphBits);
     GlyphAdvance = stream.ReadBitInt(advanceBits);
 }