public static XElement ToXml(GradientRecordRGBA record) { return new XElement("GradientItem", new XAttribute("position", record.Ratio), new XElement("color", XColorRGBA.ToXml(record.Color)) ); }
public static GradientRecordRGBA FromXml(XElement xRecord) { var record = new GradientRecordRGBA { Ratio = xRecord.RequiredByteAttribute("position"), Color = XColorRGBA.FromXml(xRecord.RequiredElement("color").Element("Color")) }; return record; }
public static GradientRecordRGBA ReadGradientRecordRGBA(this ISwfStreamReader reader) { var record = new GradientRecordRGBA { Ratio = reader.ReadByte(), Color = reader.ReadRGBA() }; return record; }
public static GradientRecordRGBA ReadGradientRecordRGBA(this ISwfStreamReader reader) { var record = new GradientRecordRGBA { Ratio = reader.ReadByte(), Color = reader.ReadRGBA() }; return(record); }
/// <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); }
public static void WriteGradientRecordRGBA(this ISwfStreamWriter writer, ref GradientRecordRGBA record) { writer.WriteByte(record.Ratio); writer.WriteRGBA(ref record.Color); }
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"); }