Beispiel #1
0
        public 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());
            }
        }
Beispiel #2
0
        public 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);
        }
Beispiel #3
0
        public 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);
        }
Beispiel #4
0
 private void ParseFillStyleArray(FillStyleArray tag)
 {
     foreach (IFillStyle o in tag.FillStyles)
     {
         if (o is BitmapFill)
         {
             ParseBitmapFill((BitmapFill)o);
         }
     }
 }
Beispiel #5
0
        public 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;
                }
            }
        }
Beispiel #6
0
        public 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;
                }
            }
        }
Beispiel #7
0
		private List<FillStyle> ParseFillStyleArray(FillStyleArray tag)
		{
			List<FillStyle> ls = new List<FillStyle>();
			foreach (IFillStyle o in tag.FillStyles)
			{
				if (o is SolidFill)
				{
					ls.Add(ParseSolidFill((SolidFill)o));
				}
				else if (o is Gradient)
				{
					ls.Add(ParseGradient((Gradient)o));
				}
				else if (o is BitmapFill)
				{
					ls.Add(ParseBitmapFill((BitmapFill)o));
				}
			}
			return ls;
		}