Exemplo n.º 1
0
        public override void Init(Record record)
        {
            base.Init (record);

            BinaryFlashReader reader = record.GetDataReader();

            if (this.Tag == Flash.Tags.PlaceObject)
            {
                this.CharacterId = reader.ReadUInt16();
                this.Depth = reader.ReadUInt16();
                this.Matrix = new Basic.Matrix(reader);
                this.ColorMatrix = new Basic.ColorMatrix(reader, false); //reader.ReadColorMatrix();
            }
            else
            {
                int nPlaceInfo = reader.ReadByte();

                bool bPlaceFlagHasClipActions = (nPlaceInfo & 128)>0;
                bool bPlaceFlagHasClipDepth = (nPlaceInfo & 64)>0;
                bool bPlaceFlagHasName = (nPlaceInfo & 32)>0;
                bool bPlaceFlagHasRatio = (nPlaceInfo & 16)>0;
                bool bPlaceFlagHasColorTransform = (nPlaceInfo & 8)>0;
                bool bPlaceFlagHasMatrix = (nPlaceInfo & 4)>0;
                bool bPlaceFlagHasCharacter = (nPlaceInfo & 2)>0;
                bool bPlaceFlagMove = (nPlaceInfo & 1)>0;

                this.Depth = reader.ReadUInt16();
                if (bPlaceFlagHasCharacter)
                    this.CharacterId = reader.ReadUInt16();
                if (bPlaceFlagHasMatrix)
                    this.Matrix = new Basic.Matrix(reader);
                if (bPlaceFlagHasColorTransform)
                    this.ColorMatrix = new Basic.ColorMatrix(reader, true);
                if (bPlaceFlagHasRatio)
                    this.Ratio = reader.ReadUInt16();
                if (bPlaceFlagHasName)
                    this.Name = reader.ReadPascalString(); //readNullString
                if (bPlaceFlagHasClipDepth)
                    this.ClipDepth = reader.ReadUInt16();
                if (bPlaceFlagHasClipActions)
                {
                    //TODO:!!!
                }

                bool bFilters = false;
                bool bBlend = false;
                bool bCache = false;
                if (this.Tag == Flash.Tags.PlaceObject3)
                {
                    nPlaceInfo = reader.ReadByte();
                    bFilters = (nPlaceInfo&1)>0; //TODO: reverse order? 128,64,32?
                    bBlend = (nPlaceInfo&2)>0; //TODO: implement blend&cache
                    bCache = (nPlaceInfo&4)>0;
                }
                if (bFilters)
                {
                    byte nNumFilters = reader.ReadByte();
                    for (int i=0; i<nNumFilters; i++)
                    {
                        byte filterId = reader.ReadByte();
                        Filter.Base filter = null;
                        switch (filterId)
                        {
                            case 0:
                                filter = new Filter.DropShadow();
                                break;
                            case 1:
                                filter = new Filter.Blue();
                                break;
                            case 2:
                                filter = new Filter.Glow();
                                break;
                            case 3:
                                filter = new Filter.Bevel();
                                break;
                            case 4:
                                filter = new Filter.GradientGlow();
                                break;
                            case 6:
                                filter = new Filter.AdjustColor();
                                break;
                            case 7:
                                filter = new Filter.GradientBevel();
                                break;
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public override void Init(Record record)
        {
            base.Init(record);

            BinaryFlashReader reader = record.GetDataReader();

            if (this.Tag == Flash.Tags.PlaceObject)
            {
                this.CharacterId = reader.ReadUInt16();
                this.Depth       = reader.ReadUInt16();
                this.Matrix      = new Basic.Matrix(reader);
                this.ColorMatrix = new Basic.ColorMatrix(reader, false);                 //reader.ReadColorMatrix();
            }
            else
            {
                int nPlaceInfo = reader.ReadByte();

                bool bPlaceFlagHasClipActions    = (nPlaceInfo & 128) > 0;
                bool bPlaceFlagHasClipDepth      = (nPlaceInfo & 64) > 0;
                bool bPlaceFlagHasName           = (nPlaceInfo & 32) > 0;
                bool bPlaceFlagHasRatio          = (nPlaceInfo & 16) > 0;
                bool bPlaceFlagHasColorTransform = (nPlaceInfo & 8) > 0;
                bool bPlaceFlagHasMatrix         = (nPlaceInfo & 4) > 0;
                bool bPlaceFlagHasCharacter      = (nPlaceInfo & 2) > 0;
                bool bPlaceFlagMove = (nPlaceInfo & 1) > 0;

                this.Depth = reader.ReadUInt16();
                if (bPlaceFlagHasCharacter)
                {
                    this.CharacterId = reader.ReadUInt16();
                }
                if (bPlaceFlagHasMatrix)
                {
                    this.Matrix = new Basic.Matrix(reader);
                }
                if (bPlaceFlagHasColorTransform)
                {
                    this.ColorMatrix = new Basic.ColorMatrix(reader, true);
                }
                if (bPlaceFlagHasRatio)
                {
                    this.Ratio = reader.ReadUInt16();
                }
                if (bPlaceFlagHasName)
                {
                    this.Name = reader.ReadPascalString();                     //readNullString
                }
                if (bPlaceFlagHasClipDepth)
                {
                    this.ClipDepth = reader.ReadUInt16();
                }
                if (bPlaceFlagHasClipActions)
                {
                    //TODO:!!!
                }

                bool bFilters = false;
                bool bBlend   = false;
                bool bCache   = false;
                if (this.Tag == Flash.Tags.PlaceObject3)
                {
                    nPlaceInfo = reader.ReadByte();
                    bFilters   = (nPlaceInfo & 1) > 0;             //TODO: reverse order? 128,64,32?
                    bBlend     = (nPlaceInfo & 2) > 0;             //TODO: implement blend&cache
                    bCache     = (nPlaceInfo & 4) > 0;
                }
                if (bFilters)
                {
                    byte nNumFilters = reader.ReadByte();
                    for (int i = 0; i < nNumFilters; i++)
                    {
                        byte        filterId = reader.ReadByte();
                        Filter.Base filter   = null;
                        switch (filterId)
                        {
                        case 0:
                            filter = new Filter.DropShadow();
                            break;

                        case 1:
                            filter = new Filter.Blue();
                            break;

                        case 2:
                            filter = new Filter.Glow();
                            break;

                        case 3:
                            filter = new Filter.Bevel();
                            break;

                        case 4:
                            filter = new Filter.GradientGlow();
                            break;

                        case 6:
                            filter = new Filter.AdjustColor();
                            break;

                        case 7:
                            filter = new Filter.GradientBevel();
                            break;
                        }
                    }
                }
            }
        }