[cairo] understanding radial pattern radius

Michael Urman murman at gmail.com
Mon Aug 7 06:39:00 PDT 2006

On 8/7/06, cairo at zevv.nl <cairo at zevv.nl> wrote:
> cairo_pattern_create_radial(cr, cx, cy, 100, cx, cy, 130)
> However, this does not give me the expected result. Instead of the image
> I described above, I get the following:
>         http://zevv.nl/div/a.jpg
> The center of the pattern is OK, all white up to r=100, but after that,
> the gradient is not 'steep' enough: instead of being black at r=130, it
> takes much longer for the gradient to go black.
> I've been playing with this function a lot, but I can't get it to work
> the way I want. Any ideas on this issue ? ciaro verion is 1.2.0

I reported this same behavior as

It looks to me like the stops are adding the inner radius back to the
weighted position. It does not happen the same for SVG images; I
haven't tested other backends.

In your example you are using the same center for both the edges, so
you can work around this by setting your inner radius to 0 and
recalculating where your stops should go accordingly, until the cairo
devs figure out how stops should work.

Michael Urman  http://www.tortall.net/mu/blog

More information about the cairo mailing list