示例#1
0
        public void CalibratedGray()
        {
            var whitepoint = new nfloat [] { 1, 2, 3 };
            var blackpoint = new nfloat [] { 3, 2, 1 };
            var gamma      = (nfloat)1;

            Assert.Throws <ArgumentNullException> (() => CGColorSpace.CreateCalibratedGray(null, blackpoint, gamma), "null whitepoint");
            Assert.Throws <ArgumentException> (() => CGColorSpace.CreateCalibratedGray(new nfloat [0], blackpoint, gamma), "invalid whitepoint0");
            Assert.Throws <ArgumentException> (() => CGColorSpace.CreateCalibratedGray(new nfloat [4], blackpoint, gamma), "invalid whitepoint4");

            Assert.Throws <ArgumentException> (() => CGColorSpace.CreateCalibratedGray(whitepoint, new nfloat [0], gamma), "invalid blackpoint0");
            Assert.Throws <ArgumentException> (() => CGColorSpace.CreateCalibratedGray(whitepoint, new nfloat [4], gamma), "invalid blackpoint4");

            using (var space = CGColorSpace.CreateCalibratedGray(whitepoint, blackpoint, gamma)) {
                Assert.IsNotNull(space, "all non-null");
            }

            using (var space = CGColorSpace.CreateCalibratedGray(whitepoint, null, gamma)) {
                Assert.IsNotNull(space, "null blackpoint");
            }
        }