[cairo] Path Gradients

Bill Spitzak spitzak at thefoundry.co.uk
Fri Jan 4 13:33:46 PST 2008

Behdad Esfahbod wrote:

> Ah sorry, I totally missed that one on first reading.  Seems like
> there's SurroundColors that does conical, and InterpolationColors that
> does radial.  I wouldn't be surprised if it's one or the other.
> The ref docs don't talk about it either:
> http://msdn2.microsoft.com/en-us/library/system.drawing.drawing2d.pathgradientbrush_properties.aspx

Well that page certainly maximizes the content/information ratio! All I 
learned is that there is also a "focus point" as well as a "center 
point". Great...

> No idea what you mean here.  I assume you are referring to the square
> here for example?
> http://www.java2s.com/Code/VBImages/PathGradientBrushesDiamondRectangleCirlceandquad.PNG
> What is so hard about it?  Sorry for keep asking stupid questions BTW.

I was referring to the much more rectangular display at the top of the 
calculator picture. That rectangle is about 5 times wider than it is 
tall. If the path gradient worked like it sounds, the rounded edge 
should be 5 times thicker on the left/right than on the top/bottom. 
Instead it appears about 2 times thicker.

What I am afraid they did was fill three shapes, using the path gradient 
for a 1/2 wide rectangle on the left + right, and a linear gradient for 
the middle. The fact that there is no seam requires exact bug-for-bug 
duplication of whatever math they are doing to produce the same result 
in both the linear and path gradients.

More information about the cairo mailing list