def test_remove_transparency(): colours = [ ("#00000000", (0.0, 0.0, 0.0)), ("#ffffffff", (255.0, 255.0, 255.0)), ((255, 255, 255, 0.5), (255.0, 255.0, 255.0)), ((255, 255, 255), (255.0, 255.0, 255.0)), (["#000000", "#ffffff"], [(0.0, 0.0, 0.0), (255.0, 255.0, 255.0)]), (["#000000", "#ffffffaa"], [(0.0, 0.0, 0.0), (255.0, 255.0, 255.0)]) ] for colour, expected in colours: assert utils.remove_transparency(colour) == expected
def set_source_rgb(self, colour, ctx=None): # Remove transparency from non-32 bit windows if utils.has_transparency(colour) and self._depth != 32: colour = utils.remove_transparency(colour) base.Drawer.set_source_rgb(self, colour, ctx)