Exemple #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());
            }
        }
Exemple #2
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();
        }
Exemple #3
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();
        }
Exemple #4
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();
        }
        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();
        }
Exemple #6
0
        public DefineTextTag(SwfReader r, bool useAlpha)
        {
            if (useAlpha)
            {
                tagType = TagType.DefineText2;
            }
            CharacterId = r.GetUI16();
            TextBounds  = new Rect(r);
            TextMatrix  = new Matrix(r);
            glyphBits   = (uint)r.GetByte();
            advanceBits = (uint)r.GetByte();

            while (r.PeekByte() != 0x00)
            {
                TextRecords.Add(new TextRecord(r, glyphBits, advanceBits, useAlpha));
            }
            byte end = r.GetByte();
        }
Exemple #7
0
        public DefineTextTag(SwfReader r, bool useAlpha)
        {
            if (useAlpha)
            {
                tagType = TagType.DefineText2;
            }
            CharacterId = r.GetUI16();
            TextBounds = new Rect(r);
            TextMatrix = new Matrix(r);
            glyphBits = (uint)r.GetByte();
            advanceBits = (uint)r.GetByte();

            while (r.PeekByte() != 0x00)
            {
                TextRecords.Add(new TextRecord(r, glyphBits, advanceBits, useAlpha));
            }
            byte end = r.GetByte();
        }
Exemple #8
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();//
        }
Exemple #9
0
 public GradientRecord(SwfReader r, bool useAlpha)
 {
     Ratio = r.GetByte();
     if (useAlpha)
     {
         Color = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());
     }
     else
     {
         Color = new RGBA(r.GetByte(), r.GetByte(), r.GetByte());
     }
 }
Exemple #10
0
        public DefineFunction2(SwfReader r, ConstantPool cp)
        {
            this.cp = cp;
            FunctionName = r.GetString();
            uint paramCount = r.GetUI16();
            RegisterCount = (uint)r.GetByte();

            Preloads = PreloadFlags.Empty;
            if (r.GetBit())
            {
                Preloads |= PreloadFlags.Parent;
            }
            if (r.GetBit())
            {
                Preloads |= PreloadFlags.Root;
            }

            SuppressSuperFlag = r.GetBit();

            if (r.GetBit())
            {
                Preloads |= PreloadFlags.Super;
            }

            SuppressArgumentsFlag = r.GetBit();

            if (r.GetBit())
            {
                Preloads |= PreloadFlags.Arguments;
            }

            SuppressThisFlag = r.GetBit();

            if (r.GetBit())
            {
                Preloads |= PreloadFlags.This;
            }

            r.GetBits(7); // reserved

            if (r.GetBit())
            {
                Preloads |= PreloadFlags.Global;
            }

            for (int i = 0; i < paramCount; i++)
            {
                uint reg = r.GetByte();
                string name = r.GetString();
                Parameters.Add(reg, name);
            }
            CodeSize = r.GetUI16();
        }
Exemple #11
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());
            }
        }
Exemple #12
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();
        }
Exemple #13
0
        public CSMTextSettingsTag(SwfReader r)
        {
            TextId       = r.GetUI16();
            UseFlashType = r.GetBits(2);
            GridFit      = r.GetBits(3);
            r.GetBits(3);             // reserved
            r.Align();

            Thickness = r.GetFixedNBits(32);
            Sharpness = r.GetFixedNBits(32);

            r.GetByte();             // reserved
        }
Exemple #14
0
        public CSMTextSettingsTag(SwfReader r)
        {
            TextId = r.GetUI16();
            UseFlashType = r.GetBits(2);
            GridFit = r.GetBits(3);
            r.GetBits(3); // reserved
            r.Align();

            Thickness = r.GetFixedNBits(32);
            Sharpness = r.GetFixedNBits(32);

            r.GetByte(); // reserved
        }
Exemple #15
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());
     }
 }
Exemple #16
0
        public ZoneRecord(SwfReader r)
        {
            NumZoneData          = r.GetByte();
            AlignmentCoordinate1 = r.GetFixedNBits(16);
            Range1 = r.GetFixedNBits(16);
            AlignmentCoordinate2 = r.GetFixedNBits(16);
            Range2 = r.GetFixedNBits(16);

            r.GetBits(6); // reserved
            ZoneMaskX = r.GetBit();
            ZoneMaskY = r.GetBit();
            r.Align();
        }
Exemple #17
0
        public FillStyleArray(SwfReader r, ShapeType shapeType)
        {
            int fillCount = (int)r.GetByte();
            if (fillCount == 0xFF)
            {
                fillCount = (int)r.GetUI16();
            }

            for (int i = 0; i < fillCount; i++)
            {
                FillStyles.Add(ParseFillStyle2(r, shapeType));
            }
        }
Exemple #18
0
        public ZoneRecord(SwfReader r)
        {
            NumZoneData = r.GetByte();
            AlignmentCoordinate1 = r.GetFixedNBits(16);
            Range1 = r.GetFixedNBits(16);
            AlignmentCoordinate2 = r.GetFixedNBits(16);
            Range2 = r.GetFixedNBits(16);

            r.GetBits(6); // reserved
            ZoneMaskX = r.GetBit();
            ZoneMaskY = r.GetBit();
            r.Align();
        }
Exemple #19
0
        public LineStyleArray(SwfReader r, ShapeType shapeType)
        {
            int lineCount = (int)r.GetByte();
            if (lineCount == 0xFF)
            {
                lineCount = (int)r.GetUI16();
            }

            for (int i = 0; i < lineCount; i++)
            {
                ParseLineStyle(r, shapeType);
            }
        }
Exemple #20
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());
     }
 }
Exemple #21
0
        public PrimitiveDouble(SwfReader r)
        {
            byte[] bytes = new byte[8];
            bytes[4] = r.GetByte();
            bytes[5] = r.GetByte();
            bytes[6] = r.GetByte();
            bytes[7] = r.GetByte();

            bytes[0] = r.GetByte();
            bytes[1] = r.GetByte();
            bytes[2] = r.GetByte();
            bytes[3] = r.GetByte();

            DoubleValue = BitConverter.ToDouble(bytes, 0);
        }
Exemple #22
0
        public PrimitiveDouble(SwfReader r)
        {
            byte[] bytes = new byte[8];
            bytes[4] = r.GetByte();
            bytes[5] = r.GetByte();
            bytes[6] = r.GetByte();
            bytes[7] = r.GetByte();

            bytes[0] = r.GetByte();
            bytes[1] = r.GetByte();
            bytes[2] = r.GetByte();
            bytes[3] = r.GetByte();

            DoubleValue = BitConverter.ToDouble(bytes, 0);
        }
Exemple #23
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());
     }
 }
Exemple #24
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());
     }
 }
Exemple #25
0
        public LineStyleArray(SwfReader r, ShapeType shapeType)
        {
            int lineCount = (int)r.GetByte();

            if (lineCount == 0xFF)
            {
                lineCount = (int)r.GetUI16();
            }

            for (int i = 0; i < lineCount; i++)
            {
                ParseLineStyle(r, shapeType);
            }
        }
Exemple #26
0
        public FillStyleArray(SwfReader r, ShapeType shapeType)
        {
            int fillCount = (int)r.GetByte();

            if (fillCount == 0xFF)
            {
                fillCount = (int)r.GetUI16();
            }

            for (int i = 0; i < fillCount; i++)
            {
                FillStyles.Add(ParseFillStyle2(r, shapeType));
            }
        }
Exemple #27
0
        public SwfHeader(SwfReader r)
        {
            this.Signature0 = r.GetByte();

            if (this.Signature0 == 'C')
            {
                this.IsCompressed = true;
                r.DecompressSwf();
            }
            else
            {
                this.IsCompressed = false;
            }

            this.Signature1 = r.GetByte();
            this.Signature2 = r.GetByte();

            this.IsSwf = (Signature2 == 'S') && (Signature1 == 'W') && ((Signature0 == 'C') || (Signature0 == 'F'));

            if (IsSwf)
            {
                this.Version = r.GetByte();
                this.FileLength = r.GetUI32();
                this.FrameSize = new Rect(r);
                UInt16 frate = r.GetUI16();
                this.FrameRate = (frate >> 8) + ((frate & 0xFF) / 0xFF);
                this.FrameCount = r.GetUI16();
            }
            else
            {
                this.Version = 0;
                this.FileLength = 0;
                this.FrameSize = new Rect(0,0,0,0);
                this.FrameRate = 0;
                this.FrameCount = 0;
            }
        }
Exemple #28
0
        public SwfHeader(SwfReader r)
        {
            this.Signature0 = r.GetByte();

            if (this.Signature0 == 'C')
            {
                this.IsCompressed = true;
                r.DecompressSwf();
            }
            else
            {
                this.IsCompressed = false;
            }

            this.Signature1 = r.GetByte();
            this.Signature2 = r.GetByte();

            this.IsSwf = (Signature2 == 'S') && (Signature1 == 'W') && ((Signature0 == 'C') || (Signature0 == 'F'));

            if (IsSwf)
            {
                this.Version    = r.GetByte();
                this.FileLength = r.GetUI32();
                this.FrameSize  = new Rect(r);
                UInt16 frate = r.GetUI16();
                this.FrameRate  = (frate >> 8) + ((frate & 0xFF) / 0xFF);
                this.FrameCount = r.GetUI16();
            }
            else
            {
                this.Version    = 0;
                this.FileLength = 0;
                this.FrameSize  = new Rect(0, 0, 0, 0);
                this.FrameRate  = 0;
                this.FrameCount = 0;
            }
        }
Exemple #29
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();
        }
Exemple #30
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();
        }
Exemple #31
0
        public SoundInfo(SwfReader r)
        {
            r.GetBits(2); // reserved

            IsSyncStop = r.GetBit();
            IsSyncNoMultiple = r.GetBit();
            HasEnvelope = r.GetBit();
            HasLoops = r.GetBit();
            HasOutPoint = r.GetBit();

            r.Align();
            if(HasInPoint)
            {
                InPoint = r.GetUI32();
            }
            if(HasOutPoint)
            {
                OutPoint = r.GetUI32();
            }
            if(HasLoops)
            {
                LoopCount = r.GetUI16();
            }
            if(HasEnvelope)
            {
                uint count = (uint)r.GetByte();

                uint pos;
                uint left;
                uint right;
                EnvelopeRecords = new SoundEnvelope[count];
                for (int i = 0; i < count; i++)
                {
                    pos = r.GetUI32();
                    left = r.GetUI16();
                    right = r.GetUI16();
                    EnvelopeRecords[i] = new SoundEnvelope(pos, left, right);
                }
            }
        }
Exemple #32
0
        public ClipActionRecord(SwfReader r, bool isSwf6Plus)
        {
            uint highClip = r.GetBits(16) << 16;
            uint lowClip = 0;
            bool isEndRecord = false;
            if (highClip == 0)
            {
                if (isSwf6Plus)
                {
                    lowClip = r.GetBits(16);
                    if (lowClip == 0)
                    {
                        ClipEvents = (ClipEvents)0;
                        ActionRecordSize = 4;
                        isEndRecord = true;
                    }
                }
                else
                {
                    ClipEvents = (ClipEvents)0;
                    ActionRecordSize = 2;
                    isEndRecord = true;
                }
            }
            else
            {
                lowClip = r.GetBits(16);
            }

            if (!isEndRecord)
            {
                ClipEvents = (ClipEvents)(lowClip | highClip);
                ActionRecordSize = r.GetUI32();
                if ((ClipEvents & ClipEvents.KeyPress) > 0)
                {
                    KeyCode = r.GetByte();
                }
                ActionRecords = new ActionRecords(r, ActionRecordSize); // always is init tag?
            }
        }
Exemple #33
0
        public SoundInfo(SwfReader r)
        {
            r.GetBits(2);             // reserved

            IsSyncStop       = r.GetBit();
            IsSyncNoMultiple = r.GetBit();
            HasEnvelope      = r.GetBit();
            HasLoops         = r.GetBit();
            HasOutPoint      = r.GetBit();

            r.Align();
            if (HasInPoint)
            {
                InPoint = r.GetUI32();
            }
            if (HasOutPoint)
            {
                OutPoint = r.GetUI32();
            }
            if (HasLoops)
            {
                LoopCount = r.GetUI16();
            }
            if (HasEnvelope)
            {
                uint count = (uint)r.GetByte();

                uint pos;
                uint left;
                uint right;
                EnvelopeRecords = new SoundEnvelope[count];
                for (int i = 0; i < count; i++)
                {
                    pos   = r.GetUI32();
                    left  = r.GetUI16();
                    right = r.GetUI16();
                    EnvelopeRecords[i] = new SoundEnvelope(pos, left, right);
                }
            }
        }
Exemple #34
0
        public DefineButton2(SwfReader r)
        {
            ButtonId = r.GetUI16();
            r.GetBits(7);
            TrackAsMenu  = r.GetBit();
            ActionOffset = r.GetUI16();

            while (r.PeekByte() != 0)
            {
                Characters.Add(new ButtonRecord(r, TagType.DefineButton2));
            }
            r.GetByte();// 0, end ButtonRecords

            if (ActionOffset > 0)
            {
                ButtonCondAction bca;
                do
                {
                    bca = new ButtonCondAction(r);
                    ButtonCondActions.Add(bca);
                }while (bca.CondActionSize > 0);
            }
        }
Exemple #35
0
        public static IFillStyle ParseFillStyle2(SwfReader r, ShapeType shapeType)
        {
            IFillStyle result = null;

            FillType fsType   = (FillType)r.GetByte();
            bool     useAlpha = shapeType > ShapeType.DefineShape2;

            switch (fsType)
            {
            case FillType.Solid:
                result = new SolidFill(r, useAlpha);
                break;

            case FillType.Linear:
                result = new Gradient(r, fsType, useAlpha);
                break;

            case FillType.Radial:
                result = new Gradient(r, fsType, useAlpha);
                break;

            case FillType.Focal:
                result = null;
                //throw new NotSupportedException("Currently FillType.Focal is not supported");
                break;

            case FillType.RepeatingBitmap:
            case FillType.ClippedBitmap:
            case FillType.NSRepeatingBitmap:
            case FillType.NSClippedBitmap:
                uint   charId    = r.GetUI16();
                Matrix bmpMatrix = new Matrix(r);
                result = new BitmapFill(charId, bmpMatrix, fsType);
                break;
            }
            return(result);
        }
Exemple #36
0
        public static IFillStyle ParseFillStyle2(SwfReader r, ShapeType shapeType)
        {
            IFillStyle result = null;

            FillType fsType = (FillType)r.GetByte();
            bool useAlpha = shapeType > ShapeType.DefineShape2;
            switch (fsType)
            {
                case FillType.Solid:
                    result = new SolidFill(r, useAlpha);
                    break;

                case FillType.Linear:
                    result = new Gradient(r, fsType, useAlpha);
                    break;

                case FillType.Radial:
                    result = new Gradient(r, fsType, useAlpha);
                    break;

                case FillType.Focal:
                    result = null;
                    //throw new NotSupportedException("Currently FillType.Focal is not supported");
                    break;

                case FillType.RepeatingBitmap:
                case FillType.ClippedBitmap:
                case FillType.NSRepeatingBitmap:
                case FillType.NSClippedBitmap:
                    uint charId = r.GetUI16();
                    Matrix bmpMatrix = new Matrix(r);
                    result = new BitmapFill(charId, bmpMatrix, fsType);
                    break;
            }
            return result;
        }
Exemple #37
0
        public DefineButton2(SwfReader r)
        {
            ButtonId = r.GetUI16();
            r.GetBits(7);
            TrackAsMenu = r.GetBit();
            ActionOffset = r.GetUI16();

            while (r.PeekByte() != 0)
            {
                Characters.Add(new ButtonRecord(r, TagType.DefineButton2));
            }
            r.GetByte();// 0, end ButtonRecords

            if (ActionOffset > 0)
            {
                ButtonCondAction bca;
                do
                {
                    bca = new ButtonCondAction(r);
                    ButtonCondActions.Add(bca);
                }
                while (bca.CondActionSize > 0);
            }
        }
Exemple #38
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();
        }
Exemple #39
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();
        }
Exemple #40
0
 public BackgroundColorTag(SwfReader r)
 {
     this.Color = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), 0xFF);
 }
Exemple #41
0
 public Push(SwfReader r, uint maxLen)
 {
     PrimitiveType type;
     while (r.Position < maxLen)
     {
         type = (PrimitiveType)(r.GetByte());
         switch (type)
         {
             case PrimitiveType.String:
                 {
                     Values.Add(new PrimitiveString(r));
                     break;
                 }
             case PrimitiveType.Float:
                 {
                     Values.Add(new PrimitiveFloat(r));
                     break;
                 }
             case PrimitiveType.Null:
                 {
                     Values.Add(new PrimitiveNull(r));
                     break;
                 }
             case PrimitiveType.Register:
                 {
                     Values.Add(new PrimitiveRegister(r));
                     break;
                 }
             case PrimitiveType.Boolean:
                 {
                     Values.Add(new PrimitiveBoolean(r));
                     break;
                 }
             case PrimitiveType.Double:
                 {
                     Values.Add(new PrimitiveDouble(r));
                     break;
                 }
             case PrimitiveType.Integer:
                 {
                     Values.Add(new PrimitiveInteger(r));
                     break;
                 }
             case PrimitiveType.Constant8:
                 {
                     Values.Add(new PrimitiveConstant8(r));
                     break;
                 }
             case PrimitiveType.Constant16:
                 {
                     Values.Add(new PrimitiveConstant16(r));
                     break;
                 }
             case PrimitiveType.Undefined:
                 {
                     Values.Add(new PrimitiveUndefined(r));
                     break;
                 }
         }
     }
 }
Exemple #42
0
 public PrimitiveRegister(SwfReader r)
 {
     RegisterValue = r.GetByte();
 }
Exemple #43
0
 public PrimitiveBoolean(SwfReader r)
 {
     BooleanValue = r.GetByte() > 0 ? true : false; // stored as byte
 }
Exemple #44
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();
            }
        }
Exemple #45
0
 public PrimitiveRegister(SwfReader r)
 {
     RegisterValue = r.GetByte();
 }
Exemple #46
0
 public WaitForFrame2(SwfReader r)
 {
     SkipCount = (uint)r.GetByte();
 }
Exemple #47
0
 public WaitForFrame2(SwfReader r)
 {
     SkipCount = (uint)r.GetByte();
 }
Exemple #48
0
 public BackgroundColorTag(SwfReader r)
 {
     this.Color = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), 0xFF);
 }
        public DefineBitsLosslessTag(SwfReader r, uint curTagLen, bool hasAlpha)
        {
            HasAlpha = hasAlpha;
            if (hasAlpha)
            {
                tagType = TagType.DefineBitsLossless2;
            }

            CharacterId = r.GetUI16();
            BitmapFormat = (BitmapFormat)r.GetByte();

            this.Width = r.GetUI16();
            this.Height = r.GetUI16();

            if (BitmapFormat == BitmapFormat.Colormapped8Bit) // 8-bit colormapped image
            {
                this.ColorCount = (uint)r.GetByte() + 1;

                this.isIndexedColors = true;
                uint colorBytes = hasAlpha ? (uint)4 : (uint)3;
                uint padWidth = this.Width + (4 - (this.Width % 4));

                // temp for debugging
                uint pos = r.Position;
                OrgBitmapData = r.GetBytes(curTagLen - 8);
                r.Position = pos;
                // end temp

                uint unzippedSize = (this.ColorCount * colorBytes) + (padWidth * this.Height);
                byte[] mapData = r.Decompress(curTagLen - 8, unzippedSize);

                uint index = 0;
                this.ColorTable = new RGBA[this.ColorCount];
                for (int i = 0; i < this.ColorCount; i++)
                {
                    if (hasAlpha)
                    {
                        this.ColorTable[i] = new RGBA(mapData[index], mapData[index + 1], mapData[index + 2], mapData[index + 3]);
                    }
                    else
                    {
                        this.ColorTable[i] = new RGBA(mapData[index], mapData[index + 1], mapData[index + 2]);
                    }
                    index += colorBytes;
                }
                this.ColorData = new uint[this.Width * this.Height];
                index = 0;
                int offset = (int)(this.ColorCount * colorBytes);
                for (int i = 0; i < padWidth * this.Height; i++)
                {
                    if ((i % padWidth) < this.Width)// exclude padding
                    {
                        this.ColorData[index++] = mapData[i + offset];
                    }
                }
            }
            else if (BitmapFormat == BitmapFormat.RGB15Bit) // RGBx555
            {
                // todo: find a test file for rgb555
                uint colorBytes = 2;
                uint padWidth = this.Width * colorBytes;
                padWidth += (4 - padWidth) % 4;

                // temp for debugging
                uint pos = r.Position;
                OrgBitmapData = r.GetBytes(curTagLen - 7);
                r.Position = pos;
                // end temp

                uint unzippedSize = (padWidth * this.Height) * colorBytes;
                byte[] mapData = r.Decompress(curTagLen - 7, unzippedSize);

                int index = 0;
                this.BitmapData = new RGBA[this.Width * this.Height];
                for (uint i = 0; i < unzippedSize; i += colorBytes)
                {
                    if ((i % padWidth) < (this.Width * colorBytes)) // exclude padding
                    {
                        byte b0 = mapData[i];
                        byte b1 = mapData[i + 1];
                        byte rd = (byte)((b0 & 0x7C) << 1);
                        byte gr = (byte)(((b0 & 0x03) << 6) | ((b1 & 0xE0) >> 2));
                        byte bl = (byte)((b1 & 0x1F) << 3);
                        this.BitmapData[index++] = new RGBA(rd, gr, bl);
                    }
                }
            }
            else if (BitmapFormat == BitmapFormat.RGB24Bit) // RGB 24
            {
                // temp for debugging
                uint pos = r.Position;
                OrgBitmapData = r.GetBytes(curTagLen - 7);
                r.Position = pos;
                // end temp

                uint colorBytes = 4; // 4 bytes will always be byte aligned
                uint unzippedSize = (this.Width * this.Height) * colorBytes;
                byte[] mapData = r.Decompress(curTagLen - 7, unzippedSize);

                int index = 0;
                this.BitmapData = new RGBA[this.Width * this.Height];
                for (uint i = 0; i < unzippedSize; i += colorBytes)
                {
                    if (hasAlpha)
                    {
                        this.BitmapData[index++] = new RGBA(mapData[i + 1], mapData[i + 2], mapData[i + 3], mapData[i]);
                    }
                    else
                    {
                        this.BitmapData[index++] = new RGBA(mapData[i + 1], mapData[i + 2], mapData[i + 3]);
                    }
                }
            }
        }
Exemple #50
0
        public Push(SwfReader r, uint maxLen)
        {
            PrimitiveType type;

            while (r.Position < maxLen)
            {
                type = (PrimitiveType)(r.GetByte());
                switch (type)
                {
                case PrimitiveType.String:
                {
                    Values.Add(new PrimitiveString(r));
                    break;
                }

                case PrimitiveType.Float:
                {
                    Values.Add(new PrimitiveFloat(r));
                    break;
                }

                case PrimitiveType.Null:
                {
                    Values.Add(new PrimitiveNull(r));
                    break;
                }

                case PrimitiveType.Register:
                {
                    Values.Add(new PrimitiveRegister(r));
                    break;
                }

                case PrimitiveType.Boolean:
                {
                    Values.Add(new PrimitiveBoolean(r));
                    break;
                }

                case PrimitiveType.Double:
                {
                    Values.Add(new PrimitiveDouble(r));
                    break;
                }

                case PrimitiveType.Integer:
                {
                    Values.Add(new PrimitiveInteger(r));
                    break;
                }

                case PrimitiveType.Constant8:
                {
                    Values.Add(new PrimitiveConstant8(r));
                    break;
                }

                case PrimitiveType.Constant16:
                {
                    Values.Add(new PrimitiveConstant16(r));
                    break;
                }

                case PrimitiveType.Undefined:
                {
                    Values.Add(new PrimitiveUndefined(r));
                    break;
                }
                }
            }
        }
Exemple #51
0
 public WaitForFrame(SwfReader r)
 {
     Frame = r.GetUI16();
     SkipCount = (uint)r.GetByte();
 }
Exemple #52
0
 public StoreRegister(SwfReader r)
 {
     Register = (uint)r.GetByte();
 }