Esempio n. 1
0
 public static XElement ToXml(GradientRecordRGBA record)
 {
     return new XElement("GradientItem",
         new XAttribute("position", record.Ratio),
         new XElement("color", XColorRGBA.ToXml(record.Color))
     );
 }
Esempio n. 2
0
 public static GradientRecordRGBA FromXml(XElement xRecord)
 {
     var record = new GradientRecordRGBA {
         Ratio = xRecord.RequiredByteAttribute("position"),
         Color = XColorRGBA.FromXml(xRecord.RequiredElement("color").Element("Color"))
     };
     return record;
 }
Esempio n. 3
0
 public static GradientRecordRGBA ReadGradientRecordRGBA(this ISwfStreamReader reader)
 {
     var record = new GradientRecordRGBA {
         Ratio = reader.ReadByte(),
         Color = reader.ReadRGBA()
     };
     return record;
 }
Esempio n. 4
0
        public static GradientRecordRGBA ReadGradientRecordRGBA(this ISwfStreamReader reader)
        {
            var record = new GradientRecordRGBA {
                Ratio = reader.ReadByte(),
                Color = reader.ReadRGBA()
            };

            return(record);
        }
Esempio n. 5
0
        /// <summary>
        /// Reads RGBA gradient from the reader.
        /// </summary>
        /// <param name="reader">The reader from which to read gradient.</param>
        /// <returns></returns>
        public static GradientRGBA ReadGradientRGBA(this ISwfStreamReader reader)
        {
            var gradient = new GradientRGBA {
                SpreadMode        = (SpreadMode)reader.ReadUnsignedBits(2),
                InterpolationMode = (InterpolationMode)reader.ReadUnsignedBits(2)
            };
            var count = reader.ReadUnsignedBits(4);

            for (var i = 0; i < count; i++)
            {
                GradientRecordRGBA record = reader.ReadGradientRecordRGBA();
                gradient.GradientRecords.Add(record);
            }
            return(gradient);
        }
Esempio n. 6
0
 public static void WriteGradientRecordRGBA(this ISwfStreamWriter writer, ref GradientRecordRGBA record)
 {
     writer.WriteByte(record.Ratio);
     writer.WriteRGBA(ref record.Color);
 }
Esempio n. 7
0
 public static void AreEqual(GradientRecordRGBA expected, GradientRecordRGBA actual, string message)
 {
     Assert.AreEqual(expected.Ratio, actual.Ratio, message + ": Ratio");
     AssertColors.AreEqual(expected.Color, actual.Color, message + ": Color");
 }
Esempio n. 8
0
 public static void WriteGradientRecordRGBA(this ISwfStreamWriter writer, ref GradientRecordRGBA record)
 {
     writer.WriteByte(record.Ratio);
     writer.WriteRGBA(ref record.Color);
 }