public void Convert_Rgb_to_CieXyy(float r, float g, float b, float x, float y, float yl)
        {
            // Arrange
            var input    = new Rgb(r, g, b);
            var expected = new CieXyy(x, y, yl);

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

            inputSpan.Fill(input);

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

            // Act
            CieXyy 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);
            }
        }
Exemple #2
0
        public void Convert_Rgb_To_YCbCr(float r, float g, float b, float y, float cb, float cr)
        {
            // Arrange
            var input    = new Rgb(r, g, b);
            var expected = new YCbCr(y, cb, cr);

            Span <Rgb> inputSpan = new Rgb[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);
            }
        }
Exemple #3
0
        public void Convert_Rgb_To_Hsl(float r, float g, float b, float h, float s, float l)
        {
            // Arrange
            var input    = new Rgb(r, g, b);
            var expected = new Hsl(h, s, l);


            Span <Rgb> inputSpan = new Rgb[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);
            }
        }
Exemple #4
0
        public void Convert_SRGB_to_XYZ_D65(float r, float g, float b, float x, float y, float z)
        {
            // Arrange
            var input   = new Rgb(r, g, b);
            var options = new ColorSpaceConverterOptions {
                WhitePoint = Illuminants.D65
            };
            var converter = new ColorSpaceConverter(options);
            var expected  = new CieXyz(x, y, z);

            Span <Rgb> inputSpan = new Rgb[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);
            }
        }
        public void Convert_Rgb_to_CieLuv(float r, float g, float b, float l, float u, float v)
        {
            // Arrange
            var input    = new Rgb(r, g, b);
            var expected = new CieLuv(l, u, v);

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

            inputSpan.Fill(input);

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

            // Act
            var actual = Converter.ToCieLuv(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_Rgb_To_Cmyk(float r, float g, float b, float c, float m, float y, float k)
        {
            // Arrange
            var input    = new Rgb(r, g, b);
            var expected = new Cmyk(c, m, y, k);

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

            inputSpan.Fill(input);

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

            // Act
            var actual = Converter.ToCmyk(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);
            }
        }