The CXForm is used to change the colour of a shape or button without changing the values in the original definition of the object.

Two types of transformation are supported: Add and Multiply

In Add transformations a value is added to each colour channel: newRed = red + addRedTerm newGreen = green + addGreenTerm newBlue = blue + addBlueTerm newAlpha = alpha + addAlphaTerm

In Multiply transformations each colour channel is multiplied by a given value: newRed = red * multiplyRedTerm newGreen = green * multiplyGreenTerm newBlue = blue * multiplyBlueTerm newAlpha = alpha * multiplyAlphaTerm

The CXForm was introduced in Flash 1.

Inheritance: ISwfSerializer
示例#1
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);

            long initPos = binaryReader.BaseStream.Position;

            characterId = binaryReader.ReadUInt16();
            depth = binaryReader.ReadUInt16();
            matrix = new Matrix();
            matrix.ReadData(binaryReader);

            long pos = binaryReader.BaseStream.Position - initPos;
            if (pos < rh.TagLength)
            {
                colorTransform = new CXForm();
                colorTransform.ReadData(binaryReader);
            }
        }
 /// <summary>
 /// Creates a new <see cref="DefineButtonCxFormTag"/> instance.
 /// </summary>
 /// <param name="buttonId">Button id.</param>
 /// <param name="buttonColorTransform">Button color transform.</param>
 public DefineButtonCxFormTag(ushort buttonId, CXForm buttonColorTransform)
 {
     this.buttonId = buttonId;
     this.buttonColorTransform = buttonColorTransform;
     this._tagCode = (int)TagCodeEnum.DefineButtonCxForm;
 }
示例#3
0
 /// <summary>
 /// Creates a new <see cref="PlaceObjectTag"/> instance.
 /// </summary>
 /// <param name="characterId">Character id.</param>
 /// <param name="depth">Depth.</param>
 /// <param name="matrix">Matrix.</param>
 /// <param name="colorTransform">Color transform.</param>
 public PlaceObjectTag(ushort characterId, ushort depth, Matrix matrix, CXForm colorTransform)
 {
     this.characterId = characterId;
     this.depth = depth;
     this.matrix = matrix;
     this.colorTransform = colorTransform;
     this._tagCode = (int)TagCodeEnum.PlaceObject;
 }
        /// <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);

            buttonId = binaryReader.ReadUInt16();
            buttonColorTransform = new CXForm();
            buttonColorTransform.ReadData(binaryReader);
        }