def rgb_to_xyz(r, g, b, *rest): r, g, b = map(_inverse_compand_srgb, (r, g, b)) x, y, z = unstack(_clip1(dot_t(stack(r, g, b), _xyz_from_rgb))) return map(_clip1, (x, y, z) + rest)
def xyz_to_rgb(x, y, z, *rest): x, y, z = map(_clip1, (x, y, z)) r, g, b = unstack(dot_t(stack(x, y, z), _rgb_from_xyz)) r, g, b = map(_clip1, (r, g, b)) r, g, b = map(_compand_srgb, (r, g, b)) return map(_clip1, (r, g, b) + rest)
def testDot(self): self.assertEqual(dot_t([1, 2, 3], [4, 5, 6]), 32) self.assertEqualArrays( dot_t([1, 2, 3], [[4, 5, 6], [7, 8, 9], [10, 11, 12]]), [32, 50, 68])
def testDot(self): self.assertEqual(dot_t([1, 2, 3], [4, 5, 6]), 32) self.assertEqualArrays(dot_t([1, 2, 3], [[4, 5, 6], [7, 8, 9], [10, 11, 12]]), [32, 50, 68])