[cairo] gradient

Travis Griggs tgriggs at cincom.com
Wed Nov 12 20:29:04 PST 2008

On Nov 12, 2008, at 7:07 PM, young wrote:

> Hi all,
>    I want to draw an arc on the window by cairo ,the arc is requested
> color gradient.I see some cairo's example,and only finding  the  line
> and the  circle's color gradient.Then I see the API and find
> cairo_pattern_creat_linear()
> cairo_pattern_creat_radial()
> But there's no API for drawing arc's gradient.
> Thanks for any ideas

Young, there is no path gradient in Cairo (yet). There's hopes/plans  
to some day have mesh gradients, which allow one to do any sort of  
gradient, include path ones.

If one wanted to simply stroke along a path, using a gradient, it  
seems that one could synthesize it by creating the path, then fetching  
the flat equivalent (which breaks it all up into line segement  
approximations), and then by traversing the line segments and  
constantly messing with the gradient's matrix, you'd get close to the  

Travis Griggs
"The project was so plagued by politics and ego that when the  
engineers requested technical oversight, our manager hired a  
psychologist instead." -- Ron Avitzur

More information about the cairo mailing list