[cairo] Conical Gradient

Simon Sapin simon.sapin at exyr.org
Mon Jan 28 16:08:06 PST 2013


Le 29/01/2013 00:24, Bobby Salazar a écrit :
> Is it possible to create a conical gradient using Cairo? I would like
> to be able to produce an effect similar to this picture:
>
> http://2.bp.blogspot.com/-b1G6OHdoCIA/TcOh3HYCyjI/AAAAAAAAAbg/JYi-vFIBZDs/s1600/SingleConicalGradient.png
>
> Any help is appreciated!

Yes, since cairo 1.12, with mesh a pattern:

http://cairographics.org/manual/cairo-cairo-pattern-t.html#cairo-pattern-create-mesh

"Tensor-product patch meshes" are a super-set of many gradient types 
including (if I understand correctly) linear, radial and conical gradients.

It’s not super obvious, but you can get a conical gradient with one 
patch per "step", each shaped like a pie slice.

Might be useful: http://tavmjong.free.fr/SVG/MESH/Mesh.html

-- 
Simon Sapin


More information about the cairo mailing list