Example #1
0
        public FilterGradientGlow(SwfReader r)
        {
            NumColors = (uint)r.GetByte();
            GradientColors = new RGBA[NumColors];
            for (int i = 0; i < NumColors; i++)
            {
                GradientColors[i] = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());
            }

            GradientRatio = new uint[NumColors];
            for (int i = 0; i < NumColors; i++)
            {
                GradientRatio[i] = (uint)r.GetByte();
            }

            BlurX = r.GetFixed16_16();
            BlurY = r.GetFixed16_16();
            Angle = r.GetFixed16_16();
            Distance = r.GetFixed16_16();
            Strength = r.GetFixed8_8();

            InnerShadow = r.GetBit();
            Knockout = r.GetBit();
            CompositeSource = r.GetBit();
            OnTop = r.GetBit();
            Passes = r.GetBits(4);

            r.Align();
        }
Example #2
0
 public SolidFill(SwfReader r, bool useAlpha)
 {
     if (useAlpha)
     {
         this.Color = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());
     }
     else
     {
         this.Color = new RGBA(r.GetByte(), r.GetByte(), r.GetByte());
     }
 }
Example #3
0
 public LineStyle(SwfReader r, bool useAlpha)
 {
     this.Width = r.GetUI16();
     if (useAlpha)
     {
         this.Color = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());
     }
     else
     {
         this.Color = new RGBA(r.GetByte(), r.GetByte(), r.GetByte());
     }
 }
Example #4
0
        public FilterGlow(SwfReader r)
        {
            GlowColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());

            BlurX = r.GetFixed16_16();
            BlurY = r.GetFixed16_16();
            Strength = r.GetFixed8_8();

            InnerGlow = r.GetBit();
            Knockout = r.GetBit();
            CompositeSource = r.GetBit();
            Passes = r.GetBits(5);

            r.Align();
        }
Example #5
0
        public FilterDropShadow(SwfReader r)
        {
            DropShadowColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());

            BlurX = r.GetFixed16_16();
            BlurY = r.GetFixed16_16();
            Angle = r.GetFixed16_16();
            Distance = r.GetFixed16_16();
            Strength = r.GetFixed8_8();

            InnerShadow = r.GetBit();
            Knockout = r.GetBit();
            CompositeSource = r.GetBit();
            Passes = (uint)r.GetBits(5);

            r.Align();
        }
Example #6
0
        private bool TextRecordType; // UB[1]

        #endregion Fields

        #region Constructors

        public TextRecord(SwfReader r,  uint glyphBits, uint advanceBits, bool hasAlpha)
        {
            TextRecordType = r.GetBit();
            StyleFlagsReserved = r.GetBits(3);
            StyleFlagsHasFont = r.GetBit();
            StyleFlagsHasColor = r.GetBit();
            StyleFlagsHasYOffset = r.GetBit();
            StyleFlagsHasXOffset = r.GetBit();

            if(StyleFlagsHasFont)
            {
                FontID = r.GetUI16();
            }
            if(StyleFlagsHasColor)
            {
                TextColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte());
                if(hasAlpha)
                {
                    TextColor.A = r.GetByte();
                }
            }
            if(StyleFlagsHasXOffset)
            {
                XOffset = r.GetInt16();
            }
            if(StyleFlagsHasYOffset)
            {
                YOffset = r.GetInt16();
            }
            if(StyleFlagsHasFont)
            {
                TextHeight = r.GetUI16();
            }

            GlyphCount = (uint)r.GetByte();
            GlyphEntries = new GlyphEntry[GlyphCount];
            for (int i = 0; i < GlyphCount; i++)
            {
                uint index = r.GetBits(glyphBits);
                int advance = r.GetSignedNBits(advanceBits);
                GlyphEntries[i] = new GlyphEntry(index, advance);
            }
            r.Align();//
        }
Example #7
0
        public FilterBevel(SwfReader r)
        {
            ShadowColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());
            HighlightColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());

            BlurX = r.GetFixed16_16();
            BlurY = r.GetFixed16_16();
            Angle = r.GetFixed16_16();
            Distance = r.GetFixed16_16();
            Strength = r.GetFixed8_8();

            InnerShadow = r.GetBit();
            Knockout = r.GetBit();
            CompositeSource = r.GetBit();
            OnTop = r.GetBit();
            Passes = r.GetBits(4);

            r.Align();
        }
Example #8
0
        public FilterConvolution(SwfReader r)
        {
            MatrixX = (uint)r.GetByte();
            MatrixY = (uint)r.GetByte();
            Divisor = r.GetFloat32();
            Bias = r.GetFloat32();

            uint mxCount = MatrixX * MatrixY;
            Matrix = new float[mxCount];
            for (int i = 0; i < mxCount; i++)
            {
                Matrix[i] = r.GetFloat32();
            }

            DefaultColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());

            r.GetBits(6);
            Clamp = r.GetBit();
            PreserveAlpha = r.GetBit();

            r.Align();
        }
Example #9
0
        private void ParseTag(ISwfTag tag)
        {
            switch (tag.TagType)
            {
                case TagType.DefineSprite:
                    ParseDefineSpriteTag((DefineSpriteTag)tag);
                    break;
                case TagType.DefineShape:
                    ParseDefineShapeTag((DefineShapeTag)tag);
                    break;
                case TagType.DefineShape2:
                    ParseDefineShape2Tag((DefineShape2Tag)tag);
                    break;
                case TagType.DefineShape3:
                    ParseDefineShape3Tag((DefineShape3Tag)tag);
                    break;
                case TagType.DefineShape4:
                    ParseDefineShape4Tag((DefineShape4Tag)tag);
                    break;
                case TagType.JPEGTables:
                    // not retained
                    break;
                case TagType.DefineBits:
                    ParseDefineBits((DefineBitsTag)tag);
                    break;
                case TagType.DefineBitsJPEG2:
                    ParseDefineBits((DefineBitsTag)tag);
                    break;
                case TagType.DefineBitsJPEG3:
                    ParseDefineBits((DefineBitsTag)tag);
                    break;
                case TagType.DefineBitsLossless:
                    ParseDefineBitsLossless((DefineBitsLosslessTag)tag);
                    break;
                case TagType.DefineBitsLossless2:
                    if (!addedFullBitmap)
                    {
                        addedFullBitmap = true;
                        DefineBitsLosslessTag t = (DefineBitsLosslessTag)tag;
                        fullBitmapId = t.CharacterId;
                        //DefineBitsLosslessTag t = new DefineBitsLosslessTag(true);
                        //t.CharacterId = ot.CharacterId;
                        //t.BitmapFormat = ot.BitmapFormat;
                        t.Width = (uint)fullBitmap.Bitmap.Width;
                        t.Height = (uint)fullBitmap.Bitmap.Height;
                        t.OrgBitmapData = null;
                        uint pxCount = t.Width * t.Height;
                        RGBA[] pxs = new RGBA[pxCount];

                        fullBitmap.LockBitmap();
                        for (int i = 0; i < pxCount; i++)
                        {
                            int x = (int)(i % t.Width);
                            int y = (int)(Math.Floor((double)(i / t.Width)));
                            PixelData pd = fullBitmap.GetPixel(x, y);
                            pxs[i] = new RGBA(pd.red, pd.green, pd.blue, pd.alpha);
                        }
                        t.BitmapData = pxs;
                        fullBitmap.UnlockBitmap();
                    }
                    break;
                case TagType.UnsupportedDefinition:
                    break;
            }
        }
Example #10
0
 public BackgroundColorTag(SwfReader r)
 {
     this.Color = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), 0xFF);
 }
Example #11
0
        public DefineEditTextTag(SwfReader r)
        {
            CharacterID = r.GetUI16();
            Bounds = new Rect(r);

            HasText = r.GetBit();
            WordWrap = r.GetBit();
            Multiline = r.GetBit();
            Password = r.GetBit();
            ReadOnly = r.GetBit();
            HasTextColor = r.GetBit();
            HasMaxLength = r.GetBit();
            HasFont = r.GetBit();
            r.GetBit();// resreved
            AutoSize = r.GetBit();
            HasLayout = r.GetBit();
            NoSelect = r.GetBit();
            Border = r.GetBit();
            r.GetBit();// resreved
            HTML = r.GetBit();
            UseOutlines = r.GetBit();

            if (HasFont)
            {
                FontID = r.GetUI16();
                FontHeight = r.GetUI16();
            }
            if (HasTextColor)
            {
                TextColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());
            }
            if (HasMaxLength)
            {
                MaxLength = r.GetUI16();
            }
            if (HasLayout)
            {
                Align = (uint)r.GetByte();
                LeftMargin = r.GetUI16();
                RightMargin = r.GetUI16();
                Indent = r.GetUI16();
                Leading = r.GetInt16();
            }
            VariableName = r.GetString();
            if (HasText)
            {
                InitialText = r.GetString();
            }
        }
Example #12
0
 public BackgroundColorTag(SwfReader r)
 {
     this.Color = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), 0xFF);
 }
Example #13
0
		private Color ParseRGBA(RGBA tag)
		{
			return new Color(tag.R, tag.G, tag.B, tag.A);
		}
Example #14
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());
            }
        }
Example #15
0
 public SolidFill(RGBA c)
 {
     this.Color = c;
 }
Example #16
0
 public SolidFill(RGBA c)
 {
     this.Color = c;
 }