private static void TestCieRGBToXYZ(float r, float g, float b, float expectedX, float expectedY, float expectedZ) { float x, y, z; CieXYZUtils.CieRGBToXYZ(r, g, b, out x, out y, out z); Assert.That(x, Is.EqualTo(expectedX).Within(Epsilon)); Assert.That(y, Is.EqualTo(expectedY).Within(Epsilon)); Assert.That(z, Is.EqualTo(expectedZ).Within(Epsilon)); }
public void XYZToCieRGB_is_inverse_of_CieRGBToXYZ() { for (float r = -1; r <= 1; r += Step) { for (float g = 0; g <= 1; g += Step) { for (float b = 0; b <= 1; b += Step) { float x, y, z; CieXYZUtils.CieRGBToXYZ(r, g, b, out x, out y, out z); TestXYZToCieRGB(x, y, z, r, g, b); } } } }