[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_Hsv_to_CieXyz(float h, float s, float v, float x, float y, float yl) { // Arrange var input = new Hsv(h, s, v); var expected = new CieXyz(x, y, yl); Span <Hsv> inputSpan = new Hsv[5]; inputSpan.Fill(input); Span <CieXyz> actualSpan = new CieXyz[5]; // Act CieXyz 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_SRGB_to_XYZ_D50(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.D50 }; 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_Cmyk_to_CieXyz(float c, float m, float y, float k, float x, float y2, float z) { // Arrange var input = new Cmyk(c, m, y, k); var expected = new CieXyz(x, y2, z); Span <Cmyk> inputSpan = new Cmyk[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_CieLch_to_CieXyz(float l, float c, float h, float x, float y, float yl) { // Arrange var input = new CieLch(l, c, h); var expected = new CieXyz(x, y, yl); Span <CieLch> inputSpan = new CieLch[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_YCbCr_to_CieXyz(float y2, float cb, float cr, float x, float y, float z) { // Arrange var input = new YCbCr(y2, cb, cr); var expected = new CieXyz(x, y, z); Span <YCbCr> inputSpan = new YCbCr[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_Lms_to_CieXyz(float l, float m, float s, float x, float y, float z) { // Arrange var input = new Lms(l, m, s); var converter = new ColorSpaceConverter(); var expected = new CieXyz(x, y, z); Span <Lms> inputSpan = new Lms[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_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); } }
public void Convert_xyY_to_XYZ(float xyzX, float xyzY, float xyzZ, float x, float y, float yl) { var input = new CieXyy(x, y, yl); // Act CieXyz output = Converter.ToCieXyz(input); // Assert Assert.Equal(xyzX, output.X, FloatRoundingComparer); Assert.Equal(xyzY, output.Y, FloatRoundingComparer); Assert.Equal(xyzZ, output.Z, FloatRoundingComparer); }
public void Convert_Lms_to_CieXyz(float l, float m, float s, float x, float y, float z) { // Arrange Lms input = new Lms(l, m, s); ColorSpaceConverter converter = new ColorSpaceConverter(); // Act CieXyz output = converter.ToCieXyz(input); // Assert Assert.Equal(x, output.X, FloatRoundingComparer); Assert.Equal(y, output.Y, FloatRoundingComparer); Assert.Equal(z, output.Z, FloatRoundingComparer); }
public void Convert_SRGB_to_XYZ_D50(float r, float g, float b, float x, float y, float z) { // Arrange Rgb input = new Rgb(r, g, b); ColorSpaceConverter converter = new ColorSpaceConverter { WhitePoint = Illuminants.D50 }; // Act CieXyz output = converter.ToCieXyz(input); // Assert Assert.Equal(x, output.X, FloatRoundingComparer); Assert.Equal(y, output.Y, FloatRoundingComparer); Assert.Equal(z, output.Z, FloatRoundingComparer); }
[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 HunterLab input = new HunterLab(l, a, b); ColorSpaceConverter converter = new ColorSpaceConverter { WhitePoint = Illuminants.D65 }; // Act CieXyz output = converter.ToCieXyz(input); // Assert Assert.Equal(x, output.X, FloatRoundingComparer); Assert.Equal(y, output.Y, FloatRoundingComparer); Assert.Equal(z, output.Z, FloatRoundingComparer); }
public void Convert_Lab_to_Xyz(float l, float a, float b, float x, float y, float z) { // Arrange var input = new CieLab(l, a, b, Illuminants.D65); var converter = new ColorSpaceConverter { WhitePoint = Illuminants.D65, TargetLabWhitePoint = Illuminants.D65 }; // Act CieXyz output = converter.ToCieXyz(input); // Assert Assert.Equal(x, output.X, FloatRoundingComparer); Assert.Equal(y, output.Y, FloatRoundingComparer); Assert.Equal(z, output.Z, FloatRoundingComparer); }
public void Convert_SRGB_to_XYZ_D50(float r, float g, float b, float x, float y, float z) { // Arrange Rgb input = new Rgb(r, g, b); ColorSpaceConverter converter = new ColorSpaceConverter { WhitePoint = Illuminants.D50 }; // Act CieXyz output = converter.ToCieXyz(input); // Assert IEqualityComparer <float> comparer = new ApproximateFloatComparer(0.001f); Assert.Equal(x, output.X, comparer); Assert.Equal(y, output.Y, comparer); Assert.Equal(z, output.Z, comparer); }
public void Convert_xyY_to_XYZ(float xyzX, float xyzY, float xyzZ, float x, float y, float yl) { var input = new CieXyy(x, y, yl); var expected = new CieXyz(xyzX, xyzY, xyzZ); Span <CieXyy> inputSpan = new CieXyy[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); } }