[cairo] Path Gradients

Behdad Esfahbod behdad at behdad.org
Fri Jan 4 13:48:53 PST 2008

On Fri, 2008-01-04 at 13:33 -0800, Bill Spitzak wrote:
> 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...

Yeah, that's used in the last image in http://www.bobpowell.net/pgb.htm
But I can't understand what's that doing.

> > 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.

Ok I'm feeling very stupid now.  I don't see any calculator picture in
any of the links sent to the list.  The only calculator I can find is
this one:


> 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.


"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759

More information about the cairo mailing list