[cairo] Getting Colour from linear gradient

Michele Mattioni mattions at gmail.com
Thu Jun 25 05:53:44 PDT 2009


Hi I'm hitting the same problem described on this email
http://lists.cairographics.org/archives/cairo/2008-September/014955.html

I would like to get the color of a linear gradient given an index.

Consider this code:

gradient = cairo.LinearGradient(0.0, 0, 30, 0)
gradient.add_color_stop_rgba(0, 1, 0, 0, 1);
gradient.add_color_stop_rgba(1, 0, 0, 0, 1)

and this method

gradient._get_color_from_gradient(0.5);

I saw two proposed solution in the following e-mail, but I was unable to understand how to do it.
Anyone who has solved this is willing to share?

Regards,
Michele.




More information about the cairo mailing list