public void XyzIndexerWorks() { var values = new float[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; var csxyz = new SKColorSpaceXyz(values); var counter = 0f; for (var y = 0; y < 3; y++) { for (var x = 0; x < 3; x++) { Assert.Equal(++counter, csxyz[x, y]); } } }
public void XyzCanInvert() { var values = new float[] { 1, 2, 3, 0, 1, 4, 5, 6, 1, }; var invertedValues = new float[] { -11.5f, 8, 2.5f, 10, -7, -2, -2.5f, 2, 0.5f, }; var csxyz = new SKColorSpaceXyz(values); var inverted = csxyz.Invert(); Assert.Equal(invertedValues, inverted.Values); }
public void XyzToMatrix44IsCorrect() { var values44 = new float[] { 1, 2, 3, 0, 4, 5, 6, 0, 7, 8, 9, 0, 0, 0, 0, 1 }; var values = new float[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; var csxyz = new SKColorSpaceXyz(values); var matrix44 = csxyz.ToMatrix44(); Assert.Equal(values44, matrix44.ToRowMajor()); }
public void XyzCanInverts() { var values = new[] { 0.60974f, 0.20528f, 0.14919f, 0.31111f, 0.62567f, 0.06322f, 0.01947f, 0.06087f, 0.74457f, }; var invertedValues = new[] { 1.96253f, -0.61068f, -0.34137f, -0.97876f, 1.91615f, 0.03342f, 0.02869f, -0.14067f, 1.34926f, }; var csxyz = new SKColorSpaceXyz(values); var inverted = csxyz.Invert(); AssertSimilar(invertedValues, inverted.Values); }
public void XyzCanConcat() { var expected = new SKColorSpaceXyz(new float[] { 1, 16, 0, 0, 18, 0, 0, 0, 1 }); var a = new SKColorSpaceXyz(new float[] { 1, 2, 0, 0, 3, 0, 0, 0, 1 }); var b = new SKColorSpaceXyz(new float[] { 1, 4, 0, 0, 6, 0, 0, 0, 1 }); var concat = SKColorSpaceXyz.Concat(a, b); Assert.Equal(expected, concat); }