Exemple #1
0
        internal LineStyle2(SwfReader r, ShapeType shapeType)
        {
            this.Width            = r.GetUI16();
            this.StartCapStyle    = (CapStyle)r.GetBits(2);
            this.JoinStyle        = (JoinStyle)r.GetBits(2);
            this.HasFillFlag      = r.GetBit();
            this.NoHScaleFlag     = r.GetBit();
            this.NoVScaleFlag     = r.GetBit();
            this.PixelHintingFlag = r.GetBit();
            r.GetBits(5);             // skip
            this.NoClose     = r.GetBit();
            this.EndCapStyle = (CapStyle)r.GetBits(2);

            if (this.JoinStyle == JoinStyle.MiterJoin)
            {
                this.MiterLimitFactor = (float)((r.GetByte() / 0x100) + r.GetByte());
            }

            if (this.HasFillFlag)
            {
                this.FillStyle = FillStyleArray.ParseFillStyle2(r, shapeType);
            }
            else
            {
                this.Color = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());
            }
        }
Exemple #2
0
        internal ShapeWithStyle(SwfReader r, ShapeType shapeType)
        {
            this.shapeType = shapeType;

            // parse fill defs
            FillStyles = new FillStyleArray(r, shapeType);

            // parse line defs
            LineStyles = new LineStyleArray(r, shapeType);

            r.Align();
            fillBits = r.GetBits(4);
            lineBits = r.GetBits(4);
            r.Align();

            ParseShapeRecords(r);
        }
        internal StyleChangedRecord(SwfReader r, uint flags, ref uint fillBits, ref uint lineBits, ShapeType shapeType)
        {
            MoveDeltaX = 0;
            MoveDeltaY = 0;
            FillStyle1 = 0;
            FillStyle0 = 0;
            LineStyle  = 0;

            HasNewStyles  = (flags & 0x10) != 0;
            HasLineStyle  = (flags & 0x08) != 0;
            HasFillStyle1 = (flags & 0x04) != 0;
            HasFillStyle0 = (flags & 0x02) != 0;
            HasMove       = (flags & 0x01) != 0;

            if (shapeType == ShapeType.Glyph) // glyphs really should be a different style changed record imo : )
            {
                if (HasMove)
                {
                    uint moveBits = r.GetBits(5);
                    this.MoveDeltaX = r.GetSignedNBits(moveBits);
                    this.MoveDeltaY = r.GetSignedNBits(moveBits);
                }

                if (HasFillStyle0)
                {
                    this.FillStyle0 = r.GetBits(fillBits);
                }
            }
            else
            {
                if (HasMove)
                {
                    uint moveBits = r.GetBits(5);
                    this.MoveDeltaX = r.GetSignedNBits(moveBits);
                    this.MoveDeltaY = r.GetSignedNBits(moveBits);
                }
                if (HasFillStyle0)
                {
                    this.FillStyle0 = r.GetBits(fillBits);
                }

                if (HasFillStyle1)
                {
                    this.FillStyle1 = r.GetBits(fillBits);
                }

                if (HasLineStyle)
                {
                    this.LineStyle = r.GetBits(lineBits);
                }

                //r.Align();

                if (HasNewStyles)
                {
                    FillStyles = new FillStyleArray(r, shapeType);
                    LineStyles = new LineStyleArray(r, shapeType);
                    fillBits   = r.GetBits(4);
                    lineBits   = r.GetBits(4);
                }
                else
                {
                    FillStyles   = new FillStyleArray();
                    LineStyles   = new LineStyleArray();
                    HasNewStyles = false;
                }
            }
        }