When the inner circle of a radial gradient is outside the outer circle, the rendering is incorrect.
Created attachment 37803 [details] Test case Compile with gcc radial.c -o radial `pkg-config --cflags --libs cairo` and look at radial.png
Created attachment 37804 [details] Test case output Output of test case with Cairo 1.9.15. The rendered gradient is outside the outermost circle.
When dealing with this issue, is there any chance of backing out the definign cairo gradients to be the same as ps/pdf, so that cairo stops creating wasteful image fallbacks? With the possible expection of ps vs trasnparency groups, anthing which is vector in cairo ought to be vector in ps/pdf. Otherwise why use it?
Ouch. I didn't notice a single one of those typos before sending. ☹ The first ¶ should read: When dealing with this issue, is there any chance of backing out the change which forces image fallbacks for these sorts of gradients, and defining cairo gradients to be the same as ps/pdf, so that cairo stops creating wasteful image fallbacks?
I started writing an implementation of pdf-like radial gradents in http://cgit.freedesktop.org/~ranma42/pixman/log/?h=wip/radial I didn't try to optimize it yet (beside avoiding redundant multiplication), so its performance is probably lower than what we actually want, but the output should be "correct". Right now it makes use of __int128_t, so it probably won't compile on 32-bit architectures. Is the output correct?
(In reply to comment #5) > I started writing an implementation of pdf-like radial gradents in > http://cgit.freedesktop.org/~ranma42/pixman/log/?h=wip/radial > > Is the output correct? No, the result is still wrong. The gradient is still completely outside of the outer circle.
Created attachment 37921 [details] Test case output - wip/radial branch Output of test case for the new branch
(In reply to comment #7) > Created an attachment (id=37921) [details] > Test case output - wip/radial branch > > Output of test case for the new branch (In reply to comment #6) > (In reply to comment #5) > > I started writing an implementation of pdf-like radial gradents in > > http://cgit.freedesktop.org/~ranma42/pixman/log/?h=wip/radial > > > > Is the output correct? > > No, the result is still wrong. The gradient is still completely outside of the > outer circle. This is expected, since you are using CAIRO_EXTEND_PAD. See http://www.cairographics.org/manual/cairo-pattern.html#cairo-pattern-set-extend
Oops, I didn't look at the test results close enough. it's definitely more sensible than the previous one. I've only now noticed that how this kind of gradient is rendered is not detailed in the SVG specification. So I'm not sure whether the output is correct or not. If it matches the PDF specification, it's probably correct.
This commit in pixman introduces the PDF radial gradients. Most cairo backends now correctly use them, the other ones will be fixed soon. commit 1ca715ed1e6914e9bd9f050065e827d7a9e2efc9 Author: Andrea Canciani <ranma42@gmail.com> Date: Sun Aug 15 09:07:33 2010 +0200 Draw radial gradients with PDF semantics Change radial gradient computations and definition to reflect the radial gradients in PDF specifications (see section 8.7.4.5.4, Type 3 (Radial) Shadings of the PDF Reference Manual). Instead of having a valid interpolation parameter value for every point of the plane, define it only for points withing the area covered by the family of circles generated by interpolating or extrapolating the start and end circles. Points outside this area are now transparent black (rgba 0 0 0 0). Points within this area have the color assiciated with the maximum value of the interpolation parameter in that point (if multiple solutions exist within the range specified by the extend mode).
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.