[cairo] Radii of radial gradients

Bill Spitzak spitzak at d2.com
Fri Mar 2 03:29:29 PST 2007

Keith Packard wrote:
> On Thu, 2007-03-01 at 10:58 -0800, Carl Worth wrote:
>> Keith suggested just forcing the determinant to 0 when it is
>> negative. I've implemented that and was quite pleased by the result it
>> provides:
> I think there's another possible interpretation here; if you consider
> the gradient as defining a cone, then you could draw the value of the
> final color stop where the determinant is less than zero -- this would
> present a solid field 'underneath' the cone. I fear the current solution
> will produce discontinuities when the final point accidentally steps
> just over the radius of the circle.

This is what I thought as well, but the solution Carl uses has the 
advantage that it does not look like an antialiased cone edge has to be 
produced. Instead even a perfect image would involve setting a pixel to 
a 1-D segment of the gradient.

Also because all the colors are continuous, it can be clipped with an 
antialiased path to produce the PDF output without any hard-to-fix 
problems where pixels are double-multiplied or otherwise unwanted colors 
leak in.

More information about the cairo mailing list