示例#1
0
 /// <summary>
 /// Writes the ARGB color to writer.
 /// </summary>
 /// <param name="writer">The writer to which to write color.</param>
 /// <param name="val">Color to be written.</param>
 public static void WriteARGB(this ISwfStreamWriter writer, SwfRGBA val)
 {
     writer.WriteByte(val.Alpha);
     writer.WriteByte(val.Red);
     writer.WriteByte(val.Green);
     writer.WriteByte(val.Blue);
 }
示例#2
0
 public static void AreEqual(SwfRGBA expected, SwfRGBA actual, string message)
 {
     Assert.AreEqual(expected.Red, actual.Red, message + ": Red");
     Assert.AreEqual(expected.Green, actual.Green, message + ": Green");
     Assert.AreEqual(expected.Blue, actual.Blue, message + ": Blue");
     Assert.AreEqual(expected.Alpha, actual.Alpha, message + ": Alpha");
 }
示例#3
0
 /// <summary>
 /// Writes the ARGB color to writer.
 /// </summary>
 /// <param name="writer">The writer to which to write color.</param>
 /// <param name="val">Color to be written.</param>
 public static void WriteARGB(this ISwfStreamWriter writer, SwfRGBA val)
 {
     writer.WriteByte(val.Alpha);
     writer.WriteByte(val.Red);
     writer.WriteByte(val.Green);
     writer.WriteByte(val.Blue);
 }
示例#4
0
 public static XElement ToXml(SwfRGBA color)
 {
     return(new XElement("Color",
                         new XAttribute("red", color.Red),
                         new XAttribute("green", color.Green),
                         new XAttribute("blue", color.Blue),
                         new XAttribute("alpha", color.Alpha)));
 }
示例#5
0
 public static SwfRGBA ReadARGB(this ISwfStreamReader reader)
 {
     var rgb = new SwfRGBA {
         Alpha = reader.ReadByte(),
         Red = reader.ReadByte(),
         Green = reader.ReadByte(),
         Blue = reader.ReadByte()
     };
     return rgb;
 }
示例#6
0
        public static SwfRGBA ReadARGB(this ISwfStreamReader reader)
        {
            var rgb = new SwfRGBA {
                Alpha = reader.ReadByte(),
                Red   = reader.ReadByte(),
                Green = reader.ReadByte(),
                Blue  = reader.ReadByte()
            };

            return(rgb);
        }
示例#7
0
        public void WriteARGBTest()
        {
            var val    = new SwfRGBA(0x0a, 0xff, 0x83, 0x12);
            var mem    = new MemoryStream();
            var writer = new SwfStreamWriter(mem);

            writer.WriteARGB(val);
            mem.Seek(0, SeekOrigin.Begin);

            Assert.AreEqual(0x12, mem.ReadByte(), "Byte 0");
            Assert.AreEqual(0x0a, mem.ReadByte(), "Byte 1");
            Assert.AreEqual(0xff, mem.ReadByte(), "Byte 2");
            Assert.AreEqual(0x83, mem.ReadByte(), "Byte 3");

            Assert.AreEqual(mem.Length, mem.Position, "Should reach end of the stream");
        }
示例#8
0
        public static SwfRGBA FromXml(XElement xColor)
        {
            var color  = new SwfRGBA();
            var xRed   = xColor.Attribute("red");
            var xGreen = xColor.Attribute("green");
            var xBlue  = xColor.Attribute("blue");
            var xAlpha = xColor.Attribute("alpha");

            color.Red = xRed != null?byte.Parse(xRed.Value) : (byte)0;

            color.Green = xGreen != null?byte.Parse(xGreen.Value) : (byte)0;

            color.Blue = xBlue != null?byte.Parse(xBlue.Value) : (byte)0;

            color.Alpha = xAlpha != null?byte.Parse(xAlpha.Value) : (byte)0;

            return(color);
        }
示例#9
0
 /// <summary>
 /// Writes the RGBA color to writer.
 /// </summary>
 /// <param name="writer">The writer to which to write color.</param>
 /// <param name="val">Color to be written.</param>
 public static void WriteRGBA(this ISwfStreamWriter writer, SwfRGBA val)
 {
     writer.WriteRGBA(ref val);
 }
示例#10
0
 /// <summary>
 /// Writes the RGBA color to writer.
 /// </summary>
 /// <param name="writer">The writer to which to write color.</param>
 /// <param name="val">Color to be written.</param>
 public static void WriteRGBA(this ISwfStreamWriter writer, SwfRGBA val)
 {
     writer.WriteRGBA(ref val);
 }