A color transform which can add and/or multiply with a pixel color.
Example #1
0
 /// <summary>
 /// Initializes a new instance of the PlaceObject class as a display
 /// list instruction to put an item onto the stage.
 /// </summary>
 public PlaceObject(
     ICharacter character,
     Layer layer,
     int? clipDepth,
     Matrix matrix,
     string name,
     bool isMove,
     ColorTransform cxform,
     string className,
     int? ratio)
 {
     this.Character = character;
     this.ClipDepth = clipDepth;
     this.Matrix = matrix;
     this.Name = name;
     this.IsMove = isMove;
     this.CXForm = cxform;
     this.Layer = layer;
     this.ClassName = className;
     this.Ratio = ratio;
 }
Example #2
0
        public void WriteColorTransform(ColorTransform cxform, bool withAlpha)
        {
            this.Align8();

            this.WriteBit(cxform.HasAdd);
            this.WriteBit(cxform.HasMult);

            int numBits = 10; /* 10-bits for 9-bit 1.00 fixed 8.8 signed value */
            this.WriteUBits(10, 4);

            if (cxform.HasMult)
            {
                HDRColor m = cxform.Mult;
                this.WriteColorComponent((int)m.Red, numBits);
                this.WriteColorComponent((int)m.Green, numBits);
                this.WriteColorComponent((int)m.Blue, numBits);
                if (withAlpha)
                {
                    this.WriteColorComponent((int)m.Alpha, numBits);
                }
            }

            if (cxform.HasAdd)
            {
                HDRColor a = cxform.Add;
                this.WriteColorComponent((int)a.Red, numBits);
                this.WriteColorComponent((int)a.Green, numBits);
                this.WriteColorComponent((int)a.Blue, numBits);
                if (withAlpha)
                {
                    this.WriteColorComponent((int)a.Alpha, numBits);
                }
            }
        }