Exemplo n.º 1
0
        internal void ToSwf(SwfWriter w, bool isSwf6Plus)
        {
            uint start = (uint)w.Position;

            w.AppendTagIDAndLength(this.TagType, 0, true);

            w.AppendBit(HasClipActions);
            w.AppendBit(HasClipDepth);
            w.AppendBit(HasName);
            w.AppendBit(HasRatio);
            w.AppendBit(HasColorTransform);
            w.AppendBit(HasMatrix);
            w.AppendBit(HasCharacter);
            w.AppendBit(Move);

            w.AppendUI16(Depth);

            if (HasCharacter)
            {
                w.AppendUI16(Character);
            }
            if (HasMatrix)
            {
                Matrix.ToSwf(w);
            }
            if (HasColorTransform)
            {
                ColorTransform.ToSwf(w, true);
            }
            if (HasRatio)
            {
                w.AppendUI16(Ratio);
            }
            if (HasName)
            {
                w.AppendString(Name);
            }
            if (HasClipDepth)
            {
                w.AppendUI16(ClipDepth);
            }

            if (HasClipActions)
            {
                ClipActions.ToSwf(w, isSwf6Plus);
            }

            //w.ResetLongTagLength(this.TagType, start, true);
            // this may be always long tag?
            if (HasClipActions || HasName)
            {
                w.ResetLongTagLength(this.TagType, start, true); // flash always makes long tags is clip actions are present
            }
            else
            {
                w.ResetLongTagLength(this.TagType, start);
            }
        }
Exemplo n.º 2
0
        internal PlaceObjectTag(SwfReader r, uint tagEnd)
            : base(TagType.PlaceObject)
        {
            Character = r.GetUI16();
            Depth     = r.GetUI16();
            Matrix    = new Matrix(r);

            if (tagEnd != r.Position)
            {
                HasColorTransform = true;
                ColorTransform    = new ColorTransform(r, false);
            }
        }
Exemplo n.º 3
0
        internal PlaceObject2Tag(SwfReader r, byte swfVersion)
        {
            tagType           = TagType.PlaceObject2;
            HasClipActions    = r.GetBit();
            HasClipDepth      = r.GetBit();
            HasName           = r.GetBit();
            HasRatio          = r.GetBit();
            HasColorTransform = r.GetBit();
            HasMatrix         = r.GetBit();
            HasCharacter      = r.GetBit();
            Move = r.GetBit();

            Depth = r.GetUI16();

            if (HasCharacter)
            {
                Character = r.GetUI16();
            }
            if (HasMatrix)
            {
                Matrix = new Matrix(r);
            }
            if (HasColorTransform)
            {
                ColorTransform = new ColorTransform(r, true);
            }
            if (HasRatio)
            {
                Ratio = r.GetUI16();
            }
            if (HasName)
            {
                Name = r.GetString();
            }
            if (HasClipDepth)
            {
                ClipDepth = r.GetUI16();
            }

            if (HasClipActions)
            {
                ClipActions = new ClipActions(r, (swfVersion > 5));
            }
        }
Exemplo n.º 4
0
        internal ButtonRecord(SwfReader r, uint containerTag)
        {
            this.containerTag = containerTag;

            r.GetBits(2);
            ButtonHasBlendMode  = r.GetBit();
            ButtonHasFilterList = r.GetBit();
            ButtonStateHitTest  = r.GetBit();
            ButtonStateDown     = r.GetBit();
            ButtonStateOver     = r.GetBit();
            ButtonStateUp       = r.GetBit();

            CharacterID = r.GetUI16();
            PlaceDepth  = r.GetUI16();
            PlaceMatrix = new Matrix(r);

            if (containerTag == TagType.DefineButton2)
            {
                ColorTransform = new ColorTransform(r, true);

                if (ButtonHasFilterList)
                {
                    // some dup code from placeObject3 : (
                    uint filterCount = (uint)r.GetByte();
                    FilterList = new List <IFilter>();
                    for (int i = 0; i < filterCount; i++)
                    {
                        FilterKind kind = (FilterKind)r.GetByte();
                        switch (kind)
                        {
                        case FilterKind.Bevel:
                            FilterList.Add(new FilterBevel(r));
                            break;

                        case FilterKind.Blur:
                            FilterList.Add(new FilterBlur(r));
                            break;

                        case FilterKind.ColorMatrix:
                            FilterList.Add(new FilterColorMatrix(r));
                            break;

                        case FilterKind.Convolution:
                            FilterList.Add(new FilterConvolution(r));
                            break;

                        case FilterKind.DropShadow:
                            FilterList.Add(new FilterDropShadow(r));
                            break;

                        case FilterKind.Glow:
                            FilterList.Add(new FilterGlow(r));
                            break;

                        case FilterKind.GradientBevel:
                            FilterList.Add(new FilterGradientBevel(r));
                            break;

                        case FilterKind.GradientGlow:
                            FilterList.Add(new FilterGradientGlow(r));
                            break;

                        default:
                            // unsupported filter
                            break;
                        }
                    }
                }
                if (ButtonHasBlendMode)
                {
                    BlendMode = (BlendMode)r.GetByte();
                }
            }
        }
Exemplo n.º 5
0
        //internal ClipActions ClipActions;

        internal PlaceObject3Tag(SwfReader r)
        {
            tagType = TagType.PlaceObject3;

            HasClipActions    = r.GetBit();
            HasClipDepth      = r.GetBit();
            HasName           = r.GetBit();
            HasRatio          = r.GetBit();
            HasColorTransform = r.GetBit();
            HasMatrix         = r.GetBit();
            HasCharacter      = r.GetBit();
            Move = r.GetBit();

            r.GetBits(5);             // reserved
            PlaceFlagHasCacheAsBitmap = r.GetBit();
            PlaceFlagHasBlendMode     = r.GetBit();
            PlaceFlagHasFilterList    = r.GetBit();

            Depth = r.GetUI16();

            if (HasCharacter)
            {
                Character = r.GetUI16();
            }
            if (HasMatrix)
            {
                Matrix = new Matrix(r);
            }
            if (HasColorTransform)
            {
                ColorTransform = new ColorTransform(r, true);
            }
            if (HasRatio)
            {
                Ratio = r.GetUI16();
            }
            if (HasName)
            {
                Name = r.GetString();
            }
            if (HasClipDepth)
            {
                ClipDepth = r.GetUI16();
            }

            if (PlaceFlagHasFilterList)
            {
                uint filterCount = (uint)r.GetByte();
                FilterList = new List <IFilter>();
                for (int i = 0; i < filterCount; i++)
                {
                    FilterKind kind = (FilterKind)r.GetByte();
                    switch (kind)
                    {
                    case FilterKind.Bevel:
                        FilterList.Add(new FilterBevel(r));
                        break;

                    case FilterKind.Blur:
                        FilterList.Add(new FilterBlur(r));
                        break;

                    case FilterKind.ColorMatrix:
                        FilterList.Add(new FilterColorMatrix(r));
                        break;

                    case FilterKind.Convolution:
                        FilterList.Add(new FilterConvolution(r));
                        break;

                    case FilterKind.DropShadow:
                        FilterList.Add(new FilterDropShadow(r));
                        break;

                    case FilterKind.Glow:
                        FilterList.Add(new FilterGlow(r));
                        break;

                    case FilterKind.GradientBevel:
                        FilterList.Add(new FilterGradientBevel(r));
                        break;

                    case FilterKind.GradientGlow:
                        FilterList.Add(new FilterGradientGlow(r));
                        break;

                    default:
                        // unsupported filter
                        break;
                    }
                }
            }
            if (PlaceFlagHasBlendMode)
            {
                BlendMode = (BlendMode)r.GetByte();
            }


            if (HasClipActions)
            {
                //ClipActions = new ClipActions();
            }
        }
Exemplo n.º 6
0
        internal override void ToSwf(SwfWriter w)
        {
            uint start = (uint)w.Position;

            w.AppendTagIDAndLength(this.TagType, 0, true);

            w.AppendBit(HasClipActions);
            w.AppendBit(HasClipDepth);
            w.AppendBit(HasName);
            w.AppendBit(HasRatio);
            w.AppendBit(HasColorTransform);
            w.AppendBit(HasMatrix);
            w.AppendBit(HasCharacter);
            w.AppendBit(Move);

            w.AppendBits(0, 5);             // reserved
            w.AppendBit(PlaceFlagHasCacheAsBitmap);
            w.AppendBit(PlaceFlagHasBlendMode);
            w.AppendBit(PlaceFlagHasFilterList);

            w.AppendUI16(Depth);

            if (HasCharacter)
            {
                w.AppendUI16(Character);
            }
            if (HasMatrix)
            {
                Matrix.ToSwf(w);
            }
            if (HasColorTransform)
            {
                ColorTransform.ToSwf(w, true);
            }
            if (HasRatio)
            {
                w.AppendUI16(Ratio);
            }
            if (HasName)
            {
                w.AppendString(Name);
            }
            if (HasClipDepth)
            {
                w.AppendUI16(ClipDepth);
            }

            if (PlaceFlagHasFilterList)
            {
                w.AppendByte((byte)FilterList.Count);
                for (int i = 0; i < FilterList.Count; i++)
                {
                    FilterList[i].ToSwf(w);
                }
            }
            if (PlaceFlagHasBlendMode)
            {
                w.AppendByte((byte)BlendMode);
            }


            if (HasClipActions)
            {
                //todo: ClipActions = new ClipActions();
            }

            w.ResetLongTagLength(this.TagType, start);
        }
Exemplo n.º 7
0
 internal DefineButtonCxform(SwfReader r)
     : base(TagType.DefineButtonCxform)
 {
     ButtonId             = r.GetUI16();
     ButtonColorTransform = new ColorTransform(r, false);
 }