예제 #1
0
파일: AssertData.cs 프로젝트: shhadi/SwfLib
        public static void AreEqual(ColorTransformRGB expected, ColorTransformRGB actual, string message)
        {
            Assert.AreEqual(expected.HasAddTerms, actual.HasAddTerms, message + ".HasAddTerms");
            Assert.AreEqual(expected.HasMultTerms, actual.HasMultTerms, message + ".HasMultTerms");

            Assert.AreEqual(expected.RedAddTerm, actual.RedAddTerm, message + ".RedAddTerm");
            Assert.AreEqual(expected.GreenAddTerm, actual.GreenAddTerm, message + ".GreenAddTerm");
            Assert.AreEqual(expected.BlueAddTerm, actual.BlueAddTerm, message + ".BlueAddTerm");

            Assert.AreEqual(expected.RedMultTerm, actual.RedMultTerm, message + ".RedMultTerm");
            Assert.AreEqual(expected.GreenMultTerm, actual.GreenMultTerm, message + ".GreenMultTerm");
            Assert.AreEqual(expected.BlueMultTerm, actual.BlueMultTerm, message + ".BlueMultTerm");
        }
예제 #2
0
        public static XElement ToXml(ColorTransformRGB transform)
        {
            var res = new XElement(TAG_NAME);

            if (transform.HasMultTerms)
            {
                res.Add(new XAttribute("factorRed", transform.RedMultTerm));
                res.Add(new XAttribute("factorGreen", transform.GreenMultTerm));
                res.Add(new XAttribute("factorBlue", transform.BlueMultTerm));
            }
            if (transform.HasAddTerms)
            {
                res.Add(new XAttribute("redadd", transform.RedAddTerm));
                res.Add(new XAttribute("greenadd", transform.GreenAddTerm));
                res.Add(new XAttribute("blueadd", transform.BlueAddTerm));
            }
            return(res);
        }
예제 #3
0
        public void WriteColorTransformRGBFromBitsMultTest()
        {
            var mem      = new MemoryStream();
            var writer   = new SwfStreamWriter(mem);
            var tranform = new ColorTransformRGB {
                RedMultTerm   = 10,
                GreenMultTerm = 224,
                BlueMultTerm  = -10,
                HasMultTerms  = true,
                RedAddTerm    = 0,
                GreenAddTerm  = 0,
                BlueAddTerm   = 0,
                HasAddTerms   = false
            };

            writer.WriteColorTransformRGB(ref tranform);
            CheckBits(mem,
                      "0", "1", "1001", "0.00001010", "0.11100000", "1.11110110");
        }