/// <summary> /// Reads RGB gradient from the reader. /// </summary> /// <param name="reader">The reader from which to read gradient.</param> /// <returns></returns> public static GradientRGB ReadGradientRGB(this ISwfStreamReader reader) { var gradient = new GradientRGB { SpreadMode = (SpreadMode)reader.ReadUnsignedBits(2), InterpolationMode = (InterpolationMode)reader.ReadUnsignedBits(2) }; var count = reader.ReadUnsignedBits(4); for (var i = 0; i < count; i++) { GradientRecordRGB record = reader.ReadGradientRecordRGB(); gradient.GradientRecords.Add(record); } return gradient; }
/// <summary> /// Reads RGB gradient from the reader. /// </summary> /// <param name="reader">The reader from which to read gradient.</param> /// <returns></returns> public static GradientRGB ReadGradientRGB(this ISwfStreamReader reader) { var gradient = new GradientRGB { SpreadMode = (SpreadMode)reader.ReadUnsignedBits(2), InterpolationMode = (InterpolationMode)reader.ReadUnsignedBits(2) }; var count = reader.ReadUnsignedBits(4); for (var i = 0; i < count; i++) { GradientRecordRGB record = reader.ReadGradientRecordRGB(); gradient.GradientRecords.Add(record); } return(gradient); }
public static void WriteGradientRGB(this ISwfStreamWriter writer, GradientRGB gradient) { writer.WriteUnsignedBits((uint)gradient.SpreadMode, 2); writer.WriteUnsignedBits((uint)gradient.InterpolationMode, 2); var count = gradient.GradientRecords.Count; if (count > 15) { throw new ArgumentOutOfRangeException("gradient", "Can't serialize more them 15 gradient points"); } writer.WriteUnsignedBits((uint)count, 4); for (var i = 0; i < count; i++) { GradientRecordRGB record = gradient.GradientRecords[i]; writer.WriteGradientRecordRGB(ref record); } }
public static void AreEqual(GradientRGB expected, GradientRGB actual, string message) { AreEqualBase(expected, actual, message); }
public static void WriteGradientRGB(this ISwfStreamWriter writer, GradientRGB gradient) { writer.WriteUnsignedBits((uint)gradient.SpreadMode, 2); writer.WriteUnsignedBits((uint)gradient.InterpolationMode, 2); var count = gradient.GradientRecords.Count; if (count > 15) throw new ArgumentOutOfRangeException("gradient", "Can't serialize more them 15 gradient points"); writer.WriteUnsignedBits((uint)count, 4); for (var i = 0; i < count; i++) { GradientRecordRGB record = gradient.GradientRecords[i]; writer.WriteGradientRecordRGB(ref record); } }