CXFormWithAlphaData.
Inheritance: ISwfSerializer
コード例 #1
0
ファイル: ButtonRecord.cs プロジェクト: Berenold/SwfExport
 /// <summary>
 /// Creates a new <see cref="ButtonRecord"/> instance.
 /// </summary>
 /// <param name="buttonStateHitTest">Button state hit test.</param>
 /// <param name="buttonStateDown">Button state down.</param>
 /// <param name="buttonStateOver">Button state over.</param>
 /// <param name="buttonStateUp">Button state up.</param>
 /// <param name="characterId">Character id.</param>
 /// <param name="placeDepth">Place depth.</param>
 /// <param name="placeMatrix">Place matrix.</param>
 /// <param name="colorTransform">Color transform.</param>
 public ButtonRecord(bool buttonStateHitTest, bool buttonStateDown,
     bool buttonStateOver, bool buttonStateUp, ushort characterId,
     ushort placeDepth, Matrix placeMatrix, 
     CXFormWithAlphaData colorTransform)
 {
     this.buttonStateHitTest = buttonStateHitTest;
     this.buttonStateDown = buttonStateDown;
     this.buttonStateOver = buttonStateOver;
     this.buttonStateUp = buttonStateUp;
     this.characterId = characterId;
     this.placeDepth = placeDepth;
     this.placeMatrix = placeMatrix;
     this.colorTransform = colorTransform;
 }
コード例 #2
0
ファイル: ButtonRecord.cs プロジェクト: eimslab/Shove.Net.Fx2
 /// <summary>
 /// Creates a new <see cref="ButtonRecord"/> instance.
 /// </summary>
 /// <param name="buttonStateHitTest">Button state hit test.</param>
 /// <param name="buttonStateDown">Button state down.</param>
 /// <param name="buttonStateOver">Button state over.</param>
 /// <param name="buttonStateUp">Button state up.</param>
 /// <param name="characterId">Character id.</param>
 /// <param name="placeDepth">Place depth.</param>
 /// <param name="placeMatrix">Place matrix.</param>
 /// <param name="colorTransform">Color transform.</param>
 public ButtonRecord(bool buttonStateHitTest, bool buttonStateDown,
                     bool buttonStateOver, bool buttonStateUp, ushort characterId,
                     ushort placeDepth, Matrix placeMatrix,
                     CXFormWithAlphaData colorTransform)
 {
     this.buttonStateHitTest = buttonStateHitTest;
     this.buttonStateDown    = buttonStateDown;
     this.buttonStateOver    = buttonStateOver;
     this.buttonStateUp      = buttonStateUp;
     this.characterId        = characterId;
     this.placeDepth         = placeDepth;
     this.placeMatrix        = placeMatrix;
     this.colorTransform     = colorTransform;
 }
コード例 #3
0
ファイル: ButtonRecord.cs プロジェクト: eimslab/Shove.Net.Fx2
        /// <summary>
        /// Reads the data.
        /// </summary>
        /// <param name="binaryReader">Binary reader.</param>
        /// <param name="firstByte">First byte.</param>
        /// <param name="buttonType">Button type.</param>
        public void ReadData(BufferedBinaryReader binaryReader,
                             byte firstByte, TagCodeEnum buttonType)
        {
            BitArray ba = BitParser.GetBitValues(new byte[1] {
                firstByte
            });

            buttonStateHitTest = ba.Get(4);
            buttonStateDown    = ba.Get(5);
            buttonStateOver    = ba.Get(6);
            buttonStateUp      = ba.Get(7);

            characterId = binaryReader.ReadUInt16();
            placeDepth  = binaryReader.ReadUInt16();
            placeMatrix = new Matrix();
            placeMatrix.ReadData(binaryReader);
            colorTransform = null;

            if (buttonType == TagCodeEnum.DefineButton2)
            {
                colorTransform = new CXFormWithAlphaData();
                colorTransform.ReadData(binaryReader);
            }
        }
コード例 #4
0
ファイル: ButtonRecord.cs プロジェクト: Berenold/SwfExport
        /// <summary>
        /// Reads the data.
        /// </summary>
        /// <param name="binaryReader">Binary reader.</param>
        /// <param name="firstByte">First byte.</param>
        /// <param name="buttonType">Button type.</param>
        public void ReadData(BufferedBinaryReader binaryReader,
            byte firstByte, TagCodeEnum buttonType)
        {
            BitArray ba = BitParser.GetBitValues(new byte[1]{firstByte});
            buttonStateHitTest = ba.Get(4);
            buttonStateDown = ba.Get(5);
            buttonStateOver = ba.Get(6);
            buttonStateUp = ba.Get(7);

            characterId = binaryReader.ReadUInt16();
            placeDepth = binaryReader.ReadUInt16();
            placeMatrix = new Matrix();
            placeMatrix.ReadData(binaryReader);
            colorTransform = null;

            if (buttonType == TagCodeEnum.DefineButton2)
            {
                colorTransform = new CXFormWithAlphaData();
                colorTransform.ReadData(binaryReader);
            }
        }
コード例 #5
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();
            rh.ReadData(binaryReader);

            bool placeFlagHasClipActions = binaryReader.ReadBoolean();
            bool placeFlagHasClipDepth = binaryReader.ReadBoolean();
            bool placeFlagHasName = binaryReader.ReadBoolean();
            bool placeFlagHasRatio = binaryReader.ReadBoolean();
            bool placeFlagHasColorTransform = binaryReader.ReadBoolean();
            bool placeFlagHasMatrix = binaryReader.ReadBoolean();
            bool placeFlagHasCharacter = binaryReader.ReadBoolean();
            placeFlagMove = binaryReader.ReadBoolean();

            depth = binaryReader.ReadUInt16();
            characterId = 0;
            if (placeFlagHasCharacter)
                characterId = binaryReader.ReadUInt16();
            matrix = null;
            if (placeFlagHasMatrix)
            {
                matrix = new Matrix();
                matrix.ReadData(binaryReader);
            }
            colorTransform = null;
            if (placeFlagHasColorTransform)
            {
                colorTransform = new CXFormWithAlphaData();
                colorTransform.ReadData(binaryReader);
            }
            ratio = 0;
            if (placeFlagHasRatio)
                ratio = binaryReader.ReadUInt16() / 65535.0f;
            name = null;
            if (placeFlagHasName)
                name = binaryReader.ReadString();
            clipDepth = 0;
            if (placeFlagHasClipDepth)
                clipDepth = binaryReader.ReadUInt16();

            // get bytecode actions
            clipActions = null;
            if (placeFlagHasClipActions)
            {
                // different behaviour for Flash 6+
                actionHead = (version>=6) ? binaryReader.ReadBytes(6) : binaryReader.ReadBytes(4);
                // read clip action records to list
                ArrayList clpAc = new ArrayList();
                //ClipActionRec a = null;
                bool res = true;
                do
                {
                    ClipActionRec action = new ClipActionRec();
                    res = action.ReadData(binaryReader, version);
                    if (res)
                        clpAc.Add(action);
                }
                while (res);
                // copy list to array
                clipActions = new ClipActionRec[clpAc.Count];
                clpAc.CopyTo(clipActions,0);
            }
        }
コード例 #6
0
 /// <summary>
 /// Creates a new <see cref="PlaceObject2Tag"/> instance.
 /// </summary>
 /// <param name="depth">Depth.</param>
 /// <param name="colorTransform">Color transform.</param>
 public PlaceObject2Tag(int depth, CXFormWithAlphaData colorTransform)
 {
     this.depth = (ushort)depth;
     this.colorTransform = colorTransform;
     this.placeFlagMove = true;
     _tagCode = (int)TagCodeEnum.PlaceObject2;
 }