public void Convert_Hsl_to_CieXyy(float h, float s, float l, float x, float y, float yl) { // Arrange var input = new Hsl(h, s, l); var expected = new CieXyy(x, y, yl); Span <Hsl> inputSpan = new Hsl[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_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); } }
public void Convert_CieXyy_to_Cmyk(float x, float y2, float yl, float c, float m, float y, float k) { // Arrange var input = new CieXyy(x, y2, yl); var expected = new Cmyk(c, m, y, k); Span <CieXyy> inputSpan = new CieXyy[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); } }
public void Convert_CieXyy_to_CieLch(float x, float y, float yl, float l, float c, float h) { // Arrange var input = new CieXyy(x, y, yl); var expected = new CieLch(l, c, h); Span <CieXyy> inputSpan = new CieXyy[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); } }
public void Convert_YCbCr_to_CieXyy(float y2, float cb, float cr, float x, float y, float yl) { // Arrange var input = new YCbCr(y2, cb, cr); var expected = new CieXyy(x, y, yl); Span <YCbCr> inputSpan = new YCbCr[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); } }
/// <summary> /// Converts a <see cref="CieXyy"/> into a <see cref="CieXyz"/> /// </summary> /// <param name="color">The color to convert.</param> /// <returns>The <see cref="CieXyz"/></returns> public CieXyz ToCieXyz(CieXyy color) { Guard.NotNull(color, nameof(color)); // Conversion return(CieXyzAndCieXyyConverter.Convert(color)); }
public void Convert_CieXyy_to_HunterLab(float x, float y, float yl, float l, float a, float b) { // Arrange var input = new CieXyy(x, y, yl); var expected = new HunterLab(l, a, b); Span <CieXyy> inputSpan = new CieXyy[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); } }
/// <summary> /// Converts a <see cref="CieXyy"/> into a <see cref="YCbCr"/> /// </summary> /// <param name="color">The color to convert.</param> /// <returns>The <see cref="YCbCr"/></returns> public YCbCr ToYCbCr(CieXyy color) { Guard.NotNull(color, nameof(color)); var xyzColor = this.ToCieXyz(color); return(this.ToYCbCr(xyzColor)); }
/// <summary> /// Converts a <see cref="CieXyy"/> into a <see cref="Cmyk"/> /// </summary> /// <param name="color">The color to convert.</param> /// <returns>The <see cref="Cmyk"/></returns> public Cmyk ToCmyk(CieXyy color) { Guard.NotNull(color, nameof(color)); var xyzColor = this.ToCieXyz(color); return(this.ToCmyk(xyzColor)); }
/// <summary> /// Converts a <see cref="CieXyy"/> into a <see cref="Hsl"/> /// </summary> /// <param name="color">The color to convert.</param> /// <returns>The <see cref="Hsl"/></returns> public Hsl ToHsl(CieXyy color) { Guard.NotNull(color, nameof(color)); var xyzColor = this.ToCieXyz(color); return(this.ToHsl(xyzColor)); }
/// <summary> /// Converts a <see cref="CieXyy"/> into a <see cref="Lms"/> /// </summary> /// <param name="color">The color to convert.</param> /// <returns>The <see cref="Lms"/></returns> public Lms ToLms(CieXyy color) { Guard.NotNull(color, nameof(color)); var xyzColor = this.ToCieXyz(color); return(this.ToLms(xyzColor)); }
/// <summary> /// Converts a <see cref="CieXyy"/> into a <see cref="LinearRgb"/> /// </summary> /// <param name="color">The color to convert.</param> /// <returns>The <see cref="LinearRgb"/></returns> public LinearRgb ToLinearRgb(CieXyy color) { Guard.NotNull(color, nameof(color)); var xyzColor = this.ToCieXyz(color); return(this.ToLinearRgb(xyzColor)); }
/// <summary> /// Converts a <see cref="CieXyy"/> into a <see cref="HunterLab"/> /// </summary> /// <param name="color">The color to convert.</param> /// <returns>The <see cref="HunterLab"/></returns> public HunterLab ToHunterLab(CieXyy color) { Guard.NotNull(color, nameof(color)); var xyzColor = this.ToCieXyz(color); return(this.ToHunterLab(xyzColor)); }
/// <summary> /// Converts a <see cref="CieXyy"/> into a <see cref="CieLchuv"/> /// </summary> /// <param name="color">The color to convert.</param> /// <returns>The <see cref="CieLchuv"/></returns> public CieLchuv ToCieLchuv(CieXyy color) { Guard.NotNull(color, nameof(color)); CieXyz xyzColor = this.ToCieXyz(color); return(this.ToCieLchuv(xyzColor)); }
public void CieXyyConstructorAssignsFields() { const float x = 75F; const float y = 64F; const float yl = 287F; var cieXyy = new CieXyy(x, y, yl); Assert.Equal(x, cieXyy.X); Assert.Equal(y, cieXyy.Y); Assert.Equal(y, cieXyy.Y); }
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_XYZ_to_xyY(float xyzX, float xyzY, float xyzZ, float x, float y, float yl) { var input = new CieXyz(xyzX, xyzY, xyzZ); // Act CieXyy output = Converter.ToCieXyy(input); // Assert Assert.Equal(x, output.X, FloatRoundingComparer); Assert.Equal(y, output.Y, FloatRoundingComparer); Assert.Equal(yl, output.Yl, FloatRoundingComparer); }
public void CieXyyEquality() { var x = default(CieXyy); var y = new CieXyy(Vector3.One); Assert.True(default(CieXyy) == default(CieXyy)); Assert.False(default(CieXyy) != default(CieXyy)); Assert.Equal(default(CieXyy), default(CieXyy)); Assert.Equal(new CieXyy(1, 0, 1), new CieXyy(1, 0, 1)); Assert.Equal(new CieXyy(Vector3.One), new CieXyy(Vector3.One)); Assert.False(x.Equals(y)); Assert.False(x.Equals((object)y)); Assert.False(x.GetHashCode().Equals(y.GetHashCode())); }
public void Convert_XYZ_to_xyY(float xyzX, float xyzY, float xyzZ, float x, float y, float yl) { var input = new CieXyz(xyzX, xyzY, xyzZ); var expected = new CieXyy(x, y, yl); Span <CieXyz> inputSpan = new CieXyz[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); } }
/// <summary> /// Converts a <see cref="CieXyy"/> into a <see cref="CieLch"/> /// </summary> /// <param name="color">The color to convert.</param> /// <returns>The <see cref="CieLch"/></returns> public CieLch ToCieLch(CieXyy color) { CieXyz xyzColor = this.ToCieXyz(color); return(this.ToCieLch(xyzColor)); }
/// <summary> /// Converts a <see cref="CieXyy"/> into a <see cref="CieLuv"/> /// </summary> /// <param name="color">The color to convert.</param> /// <returns>The <see cref="CieLuv"/></returns> public CieLuv ToCieLuv(CieXyy color) { var xyzColor = this.ToCieXyz(color); return(this.ToCieLuv(xyzColor)); }
/// <summary> /// Converts a <see cref="CieXyy"/> into a <see cref="Cmyk"/> /// </summary> /// <param name="color">The color to convert.</param> /// <returns>The <see cref="Cmyk"/></returns> public Cmyk ToCmyk(CieXyy color) { var xyzColor = this.ToCieXyz(color); return(this.ToCmyk(xyzColor)); }
/// <summary> /// Converts a <see cref="CieXyy"/> into a <see cref="CieXyz"/> /// </summary> /// <param name="color">The color to convert.</param> /// <returns>The <see cref="CieXyz"/></returns> public CieXyz ToCieXyz(CieXyy color) { // Conversion return(CieXyzAndCieXyyConverter.Convert(color)); }
/// <summary> /// Converts a <see cref="CieXyy"/> into a <see cref="HunterLab"/> /// </summary> /// <param name="color">The color to convert.</param> /// <returns>The <see cref="HunterLab"/></returns> public HunterLab ToHunterLab(CieXyy color) { var xyzColor = this.ToCieXyz(color); return(this.ToHunterLab(xyzColor)); }
/// <summary> /// Converts a <see cref="CieXyy"/> into a <see cref="Hsl"/> /// </summary> /// <param name="color">The color to convert.</param> /// <returns>The <see cref="Hsl"/></returns> public Hsl ToHsl(CieXyy color) { var xyzColor = this.ToCieXyz(color); return(this.ToHsl(xyzColor)); }
/// <summary> /// Converts a <see cref="CieXyy"/> into a <see cref="CieLab"/> /// </summary> /// <param name="color">The color to convert.</param> /// <returns>The <see cref="CieLab"/></returns> public CieLab ToCieLab(CieXyy color) { CieXyz xyzColor = this.ToCieXyz(color); return(this.ToCieLab(xyzColor)); }
/// <summary> /// Converts a <see cref="CieXyy"/> into a <see cref="YCbCr"/> /// </summary> /// <param name="color">The color to convert.</param> /// <returns>The <see cref="YCbCr"/></returns> public YCbCr ToYCbCr(CieXyy color) { var xyzColor = this.ToCieXyz(color); return(this.ToYCbCr(xyzColor)); }
/// <summary> /// Converts a <see cref="CieXyy"/> into a <see cref="LinearRgb"/> /// </summary> /// <param name="color">The color to convert.</param> /// <returns>The <see cref="LinearRgb"/></returns> public LinearRgb ToLinearRgb(CieXyy color) { var xyzColor = this.ToCieXyz(color); return(this.ToLinearRgb(xyzColor)); }
/// <summary> /// Converts a <see cref="CieXyy"/> into a <see cref="Lms"/> /// </summary> /// <param name="color">The color to convert.</param> /// <returns>The <see cref="Lms"/></returns> public Lms ToLms(CieXyy color) { var xyzColor = this.ToCieXyz(color); return(this.ToLms(xyzColor)); }