[cairo] Radial gradient definition for cairo?
M Joonas Pihlaja
jpihlaja at cc.helsinki.fi
Mon Mar 1 22:27:28 PST 2010
Hey cairo-l,
I was looking at bug 5681 today and wondering what exactly the problem
there is. The bug report contains a test program which draws a radial
gradient as well as some screen shots of radial gradients rendering
differently in cairo 1.0.2 and then-current cvs head. It turns out
that the test case in the bug report has the inner circle outside the
outer circle, so the focal point is way outside the outer circle too.
On the pixman mailing list Siarhei Siamashka noted that neither
Xrender nor SVG support radial gradients where the focal point is
outside the outer circle:
http://lists.freedesktop.org/archives/pixman/2010-February/000035.html
In addition, if given a gradient with focal point outside of the outer
circle, then SVG seems to force the focal point to the edge of the
outer circle.
On the one hand, forcing the focal point inside ensures that there's a
single solution for the value of the interpolating parameter t
anywhere inside the outer circle. If the focal point wanders outside
the outer circle then the gradient "folds over itself" and produces
multiple solutions for the interpolating parameter in some areas.
On the other hand, we could define radial gradients even if the focal
point is outside the outer circle in the same vein as the complex pdf
gradients: Use the maximum solution of t in [0,1] if there are
multiple solutions (and bring values of t outside [0,1] down to that
range if there's an extend mode on the pattern.) This simulates a
painter's model where the first circle at t=0 is linearly transformed
to the first circle at t=1 while its colour is changing according to
the colour stops.
So my question is, what _should_ the definition of a radial gradient
in cairo be?
Cheers,
Joonas
More information about the cairo
mailing list