Пример #1
0
 public static void AreEqual(FocalGradientRGB expected, FocalGradientRGB actual, string message)
 {
     AreEqualBase(expected, actual, message);
     if (expected != null && actual != null) {
         Assert.AreEqual(expected.FocalPoint, actual.FocalPoint);
     }
 }
Пример #2
0
 /// <summary>
 /// Reads RGB focal gradient from the reader.
 /// </summary>
 /// <param name="reader">The reader from which to read focal gradient.</param>
 /// <returns></returns>
 public static FocalGradientRGB ReadFocalGradientRGB(this ISwfStreamReader reader)
 {
     var gradient = new FocalGradientRGB {
         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);
     }
     gradient.FocalPoint = reader.ReadFixedPoint8();
     return gradient;
 }
Пример #3
0
        /// <summary>
        /// Reads RGB focal gradient from the reader.
        /// </summary>
        /// <param name="reader">The reader from which to read focal gradient.</param>
        /// <returns></returns>
        public static FocalGradientRGB ReadFocalGradientRGB(this ISwfStreamReader reader)
        {
            var gradient = new FocalGradientRGB {
                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);
            }
            gradient.FocalPoint = reader.ReadFixedPoint8();
            return(gradient);
        }
Пример #4
0
        public static void WriteFocalGradientRGB(this ISwfStreamWriter writer, FocalGradientRGB 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);
            }
            writer.WriteFixedPoint8(gradient.FocalPoint);
        }
Пример #5
0
 public static void WriteFocalGradientRGB(this ISwfStreamWriter writer, FocalGradientRGB 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);
     }
     writer.WriteFixedPoint8(gradient.FocalPoint);
 }