[cairo] Getting Colour from linear gradient

Michael Gurnett gurnett at glocalnet.net
Wed Sep 3 04:50:10 PDT 2008


Is there anyway of determining the colour at a given position from a linear gradiant. Say for example I have

pat = cairo_pattern_create_linear (0.0, 0,  Width, 0);
cairo_pattern_add_color_stop_rgba (pat, 0, 1, 0, 0, 1);
cairo_pattern_add_color_stop_rgba (pat, 1, 0, 0, 0, 1);

I would like to just question cairo the colour value at a given position with something like


cairo_pattern_get_color_from_gradient(pat,0.5);


The reason I'm asking this is that I'm currently using linear gradients on strokes (a non closed arc), and I would like to create the linear gradient and then remap it to the path of the arc by creating smaller gradients based on the tangents of the curvature.

Mick

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cairographics.org/archives/cairo/attachments/20080903/67497d3e/attachment.htm 


More information about the cairo mailing list