Beispiel #1
0
        public static PlaceObjectTag Create(SwfStreamReader reader)
        {
            var tag = new PlaceObjectTag();

            tag.CharacterId    = reader.ReadUInt16();
            tag.Depth          = reader.ReadUInt16();
            tag.Matrix         = SwfMatrix.Read(reader);
            tag.ColorTransform = reader.IsEOF
                                ? SwfColorTransform.identity
                                : SwfColorTransform.Read(reader, false);
            return(tag);
        }
        public static PlaceObject2Tag Create(SwfStreamReader reader)
        {
            var tag = new PlaceObject2Tag();

            tag.HasClipActions    = reader.ReadBit();
            tag.HasClipDepth      = reader.ReadBit();
            tag.HasName           = reader.ReadBit();
            tag.HasRatio          = reader.ReadBit();
            tag.HasColorTransform = reader.ReadBit();
            tag.HasMatrix         = reader.ReadBit();
            tag.HasCharacter      = reader.ReadBit();
            tag.Move  = reader.ReadBit();
            tag.Depth = reader.ReadUInt16();

            tag.CharacterId = tag.HasCharacter
                                ? reader.ReadUInt16()
                                : (ushort)0;

            tag.Matrix = tag.HasMatrix
                                ? SwfMatrix.Read(reader, false)
                                : SwfMatrix.identity;

            tag.ColorTransform = tag.HasColorTransform
                                ? SwfColorTransform.Read(reader, true)
                                : SwfColorTransform.identity;

            tag.Ratio = tag.HasRatio
                                ? reader.ReadUInt16()
                                : (ushort)0;

            tag.Name = tag.HasName
                                ? reader.ReadString()
                                : string.Empty;

            tag.ClipDepth = tag.HasClipDepth
                                ? reader.ReadUInt16()
                                : (ushort)0;

            tag.ClipActions = tag.HasClipActions
                                ? SwfClipActions.Read(reader)
                                : SwfClipActions.identity;

            return(tag);
        }
Beispiel #3
0
        public static SwfColorTransData ToColorTransData(this SwfColorTransform self)
        {
            var trans = SwfColorTransData.identity;

            if (self.HasAdd)
            {
                trans.addColor = new SwfVec4Data(
                    self.RAdd / 256.0f,
                    self.GAdd / 256.0f,
                    self.BAdd / 256.0f,
                    self.AAdd / 256.0f);
            }
            if (self.HasMul)
            {
                trans.mulColor = new SwfVec4Data(
                    self.RMul / 256.0f,
                    self.GMul / 256.0f,
                    self.BMul / 256.0f,
                    self.AMul / 256.0f);
            }
            return(trans);
        }
Beispiel #4
0
        public static PlaceObject3Tag Create(SwfStreamReader reader)
        {
            var tag = new PlaceObject3Tag();

            tag.HasClipActions    = reader.ReadBit();
            tag.HasClipDepth      = reader.ReadBit();
            tag.HasName           = reader.ReadBit();
            tag.HasRatio          = reader.ReadBit();
            tag.HasColorTransform = reader.ReadBit();
            tag.HasMatrix         = reader.ReadBit();
            tag.HasCharacter      = reader.ReadBit();
            tag.Move = reader.ReadBit();
            reader.ReadBit();             // reserved
            tag.OpaqueBackground = reader.ReadBit();
            tag.HasVisible       = reader.ReadBit();
            tag.HasImage         = reader.ReadBit();
            tag.HasClassName     = reader.ReadBit();
            tag.HasCacheAsBitmap = reader.ReadBit();
            tag.HasBlendMode     = reader.ReadBit();
            tag.HasFilterList    = reader.ReadBit();
            tag.Depth            = reader.ReadUInt16();

            tag.ClassName = tag.HasClassName
                                ? reader.ReadString()
                                : string.Empty;

            tag.CharacterId = tag.HasCharacter
                                ? reader.ReadUInt16()
                                : (ushort)0;

            tag.Matrix = tag.HasMatrix
                                ? SwfMatrix.Read(reader)
                                : SwfMatrix.identity;

            tag.ColorTransform = tag.HasColorTransform
                                ? SwfColorTransform.Read(reader, true)
                                : SwfColorTransform.identity;

            tag.Ratio = tag.HasRatio
                                ? reader.ReadUInt16()
                                : (ushort)0;

            tag.Name = tag.HasName
                                ? reader.ReadString()
                                : string.Empty;

            tag.ClipDepth = tag.HasClipDepth
                                ? reader.ReadUInt16()
                                : (ushort)0;

            tag.SurfaceFilters = tag.HasFilterList
                                ? SwfSurfaceFilters.Read(reader)
                                : SwfSurfaceFilters.identity;

            tag.BlendMode = tag.HasBlendMode
                                ? SwfBlendMode.Read(reader)
                                : SwfBlendMode.identity;

            tag.BitmapCache = tag.HasCacheAsBitmap
                                ? (0 != reader.ReadByte())
                                : false;

            tag.Visible = tag.HasVisible && !reader.IsEOF
                                ? (0 != reader.ReadByte())
                                : true;

            tag.BackgroundColor = tag.HasVisible && !reader.IsEOF
                                ? SwfColor.Read(reader, true)
                                : SwfColor.identity;

            tag.ClipActions = tag.HasClipActions && !reader.IsEOF
                                ? SwfClipActions.Read(reader)
                                : SwfClipActions.identity;

            return(tag);
        }