Beispiel #1
0
        public void Convert_HunterLab_to_Cmyk(float l, float a, float b, float c, float m, float y, float k)
        {
            // Arrange
            var input    = new HunterLab(l, a, b);
            var expected = new Cmyk(c, m, y, k);

            Span <HunterLab> inputSpan = new HunterLab[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);
            }
        }
Beispiel #2
0
        public void Convert_HunterLab_to_CieLch(float l2, float a, float b, float l, float c, float h)
        {
            // Arrange
            var input    = new HunterLab(l2, a, b);
            var expected = new CieLch(l, c, h);

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

            inputSpan.Fill(input);

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

            // Act
            var actual = Converter.ToCieLch(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);
            }
        }
        [InlineData(100, 0, 0, 0.95047, 1, 1.08883)] // D65 white point is HunerLab 100, 0, 0 (adaptation to C performed)
        public void Convert_HunterLab_to_Xyz_D65(float l, float a, float b, float x, float y, float z)
        {
            // Arrange
            var input   = new HunterLab(l, a, b);
            var options = new ColorSpaceConverterOptions {
                WhitePoint = Illuminants.D65
            };
            var converter = new ColorSpaceConverter(options);
            var expected  = new CieXyz(x, y, z);

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

            inputSpan.Fill(input);

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

            // Act
            var actual = converter.ToCieXyz(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_HunterLab_to_CieXyy(float l, float a, float b, float x, float y, float yl)
        {
            // Arrange
            var input    = new HunterLab(l, a, b);
            var expected = new CieXyy(x, y, yl);

            Span <HunterLab> inputSpan = new HunterLab[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);
            }
        }