[cairo] Path Gradients
Bobby Salazar
bobby8934 at inbox.com
Tue Jan 22 14:33:48 PST 2008
Ok, I can see how that would reproduce the shape of the target path using coons patches. But how would you go about reproducing the "color stops" along the way from the center point to the edge of the path?
> -----Original Message-----
> From: ajohnson at redneon.com
> Sent: Wed, 23 Jan 2008 08:44:04 +1030
> To: bobby8934 at inbox.com
> Subject: Re: [cairo] Path Gradients
>
> Bobby Salazar wrote:
>
>> However, there is one situation (that is my main interest in the path
>> gradient) that I cannot figure out how to map to these "Type 6"
>> gradient meshes. This situation is where you have a path, and you
>> want to make a gradient from an abitrary "center point" out to the
>> edges, with color stops along the way. Can you think of an easy way
>> to use a "Type 6" gradient mesh to reproduce the gradients seen in
>> these images:
>>
>> http://www.bobpowell.net/pgb.ht4.jpg
>> http://www.bobpowell.net/pgb.ht6.jpg
>
> That type of gradient could be approximated by flattening the path then
> creating triangle gradients from the center point to each line on the
> path.
>
> With the Type 6 coon mesh you could make one side of the coon patch zero
> length and two other sides a straight line so you get a sort of triangle
> with one side a Bézier curve. Then you do not need to flatten the path.
>
> There is an Adobe tech note [1] where they show how to create a conical
> gradient using four coons patches. The conical gradient is just a
> special case of the path gradient where the path is a circle . Circles
> are approximated with four Bézier curves.
>
>
> [1]
> http://partners.adobe.com/public/developer/en/ps/sdk/TN5600.SmoothShading.pdf
More information about the cairo
mailing list