def test_color_get_components(self): c = Gegl.Color() c.set_components(Gegl.format("RGB float"), [1.0, 0.0, 0.0]) values = c.get_components(Gegl.format("RGB float")) self.assertAlmostEqualComps(values, [1.0, 0.0, 0.0]) values = c.get_components(Gegl.format("RGBA double")) self.assertAlmostEqualComps(values, [1.0, 0.0, 0.0, 1.0]) values = c.get_components(Gegl.format("RGBA float")) self.assertAlmostEqualComps(values, [1.0, 0.0, 0.0, 1.0]) values = c.get_components(Gegl.format("RGBA u32")) self.assertEqual(values, [float(0xFFFFFFFF), 0.0, 0.0, float(0xFFFFFFFF)]) values = c.get_components(Gegl.format("RGBA u16")) self.assertEqual(values, [float(0xFFFF), 0.0, 0.0, float(0xFFFF)]) values = c.get_components(Gegl.format("RGBA u8")) self.assertEqual(values, [float(0xFF), 0.0, 0.0, float(0xFF)]) c.set_components(Gegl.format("R'G'B' u8"), [128, 0, 128]) values = c.get_components(Gegl.format("R'G'B'A u8")) self.assertEqual(values, [float(128), 0.0, float(128), float(255)]) c.set_components(Gegl.format("YA double"), [0.5, 0.5]) values = c.get_components(Gegl.format("RGBA double")) self.assertAlmostEqualComps(values, [0.5, 0.5, 0.5, 0.5]) values = c.get_components(Gegl.format("RaGaBaA double")) self.assertAlmostEqualComps(values, [0.25, 0.25, 0.25, 0.5])
def test_new_color_string(self): Gegl.Color(string="rgba(0.6, 0.6, 0.6, 1.0)")