public void Convert_CieLuv_to_LinearRgb(float l, float u, float v, float r, float g, float b)
        {
            // Arrange
            var input    = new CieLuv(l, u, v);
            var expected = new LinearRgb(r, g, b);

            Span <CieLuv> inputSpan = new CieLuv[5];

            inputSpan.Fill(input);

            Span <LinearRgb> actualSpan = new LinearRgb[5];

            // Act
            var actual = Converter.ToLinearRgb(input);

            Converter.Convert(inputSpan, actualSpan);

            // Assert
            Assert.Equal(expected, actual, ColorSpaceComparer);

            for (int i = 0; i < actualSpan.Length; i++)
            {
                Assert.Equal(expected, actualSpan[i], ColorSpaceComparer);
            }
        }
示例#2
0
        public void Convert_CieLuv_to_Lms(float l, float u, float v, float l2, float m, float s)
        {
            // Arrange
            var input    = new CieLuv(l, u, v);
            var expected = new Lms(l2, m, s);

            Span <CieLuv> inputSpan = new CieLuv[5];

            inputSpan.Fill(input);

            Span <Lms> actualSpan = new Lms[5];

            // Act
            var actual = Converter.ToLms(input);

            Converter.Convert(inputSpan, actualSpan);

            // Assert
            Assert.Equal(expected, actual, ColorSpaceComparer);

            for (int i = 0; i < actualSpan.Length; i++)
            {
                Assert.Equal(expected, actualSpan[i], ColorSpaceComparer);
            }
        }
示例#3
0
        public void Convert_CieLuv_to_Cmyk(float l, float u, float v, float c, float m, float y, float k)
        {
            // Arrange
            var input    = new CieLuv(l, u, v);
            var expected = new Cmyk(c, m, y, k);

            Span <CieLuv> inputSpan = new CieLuv[5];

            inputSpan.Fill(input);

            Span <Cmyk> actualSpan = new Cmyk[5];

            // Act
            var actual = Converter.ToCmyk(input);

            Converter.Convert(inputSpan, actualSpan, actualSpan.Length);

            // Assert
            Assert.Equal(expected, actual, ColorSpaceComparer);

            for (int i = 0; i < actualSpan.Length; i++)
            {
                Assert.Equal(expected, actualSpan[i], ColorSpaceComparer);
            }
        }
        public void Convert_CieLuv_to_YCbCr(float l, float u, float v, float y, float cb, float cr)
        {
            // Arrange
            var input    = new CieLuv(l, u, v);
            var expected = new YCbCr(y, cb, cr);

            Span <CieLuv> inputSpan = new CieLuv[5];

            inputSpan.Fill(input);

            Span <YCbCr> actualSpan = new YCbCr[5];

            // Act
            var actual = Converter.ToYCbCr(input);

            Converter.Convert(inputSpan, actualSpan);

            // Assert
            Assert.Equal(expected, actual, ColorSpaceComparer);

            for (int i = 0; i < actualSpan.Length; i++)
            {
                Assert.Equal(expected, actualSpan[i], ColorSpaceComparer);
            }
        }
示例#5
0
        public void Convert_Luv_to_Xyz(float l, float u, float v, float x, float y, float z)
        {
            // Arrange
            var input   = new CieLuv(l, u, v, Illuminants.D65);
            var options = new ColorSpaceConverterOptions {
                WhitePoint = Illuminants.D65, TargetLabWhitePoint = Illuminants.D65
            };
            var converter = new ColorSpaceConverter(options);
            var expected  = new CieXyz(x, y, z);

            Span <CieLuv> inputSpan = new CieLuv[5];

            inputSpan.Fill(input);

            Span <CieXyz> actualSpan = new CieXyz[5];

            // Act
            var actual = converter.ToCieXyz(input);

            converter.Convert(inputSpan, actualSpan);

            // Assert
            Assert.Equal(expected, actual, ColorSpaceComparer);

            for (int i = 0; i < actualSpan.Length; i++)
            {
                Assert.Equal(expected, actualSpan[i], ColorSpaceComparer);
            }
        }
示例#6
0
        public void Convert_CieLuv_to_CieXyy(float l, float u, float v, float x, float y, float yl)
        {
            // Arrange
            var input    = new CieLuv(l, u, v);
            var expected = new CieXyy(x, y, yl);

            Span <CieLuv> inputSpan = new CieLuv[5];

            inputSpan.Fill(input);

            Span <CieXyy> actualSpan = new CieXyy[5];

            // Act
            var actual = Converter.ToCieXyy(input);

            Converter.Convert(inputSpan, actualSpan);

            // Assert
            Assert.Equal(expected, actual, ColorSpaceComparer);

            for (int i = 0; i < actualSpan.Length; i++)
            {
                Assert.Equal(expected, actualSpan[i], ColorSpaceComparer);
            }
        }
        public void Convert_CieLuv_to_Hsl(float l, float u, float v, float h, float s, float l2)
        {
            // Arrange
            var input    = new CieLuv(l, u, v);
            var expected = new Hsl(h, s, l2);

            Span <CieLuv> inputSpan = new CieLuv[5];

            inputSpan.Fill(input);

            Span <Hsl> actualSpan = new Hsl[5];

            // Act
            var actual = Converter.ToHsl(input);

            Converter.Convert(inputSpan, actualSpan);

            // Assert
            Assert.Equal(expected, actual, ColorSpaceComparer);

            for (int i = 0; i < actualSpan.Length; i++)
            {
                Assert.Equal(expected, actualSpan[i], ColorSpaceComparer);
            }
        }
示例#8
0
        public void Convert_CieLuv_to_HunterLab(float l, float u, float v, float l2, float a, float b)
        {
            // Arrange
            var input    = new CieLuv(l, u, v);
            var expected = new HunterLab(l2, a, b);

            Span <CieLuv> inputSpan = new CieLuv[5];

            inputSpan.Fill(input);

            Span <HunterLab> actualSpan = new HunterLab[5];

            // Act
            var actual = Converter.ToHunterLab(input);

            Converter.Convert(inputSpan, actualSpan);

            // Assert
            Assert.Equal(expected, actual, ColorSpaceComparer);

            for (int i = 0; i < actualSpan.Length; i++)
            {
                Assert.Equal(expected, actualSpan[i], ColorSpaceComparer);
            }
        }