[cairo] Circular Ring Gradient
cecashon at aol.com
cecashon at aol.com
Wed May 10 23:08:19 UTC 2017
Hi Adrian,
Thanks for your example code. It works good. The ring_gradient.c is similar to what I tested using Bezier curves with meshes so I am close. Both Bezier curve meshes and trapezoid meshes will work to draw a ring gradient. Still stuck with the problem of starting and stopping a gradient in an arc at discrete points in the arc. I haven't figured out how to "sweep" a gradient color through a ring arc in a smooth fashion. That would make a gauge widget a little more adjustable wirh a standardized scale.
Eric
-----Original Message-----
From: Adrian Johnson <ajohnson at redneon.com>
To: cecashon <cecashon at aol.com>; cairo <cairo at cairographics.org>
Sent: Wed, May 10, 2017 3:11 pm
Subject: Re: [cairo] Circular Ring Gradient
On 11/05/17 07:20, Adrian Johnson wrote:
> On 11/05/17 06:27, cecashon at aol.com wrote:
>> Hi Cairo folks,
>>
>> What is the best way to make a circular gradient in a ring? I have tried
>> using both a Bezier approximation to a circle and just using trapezoids.
>> The trapezoids work fine if I have 16 of them and then clip the ring. A
>> little problem with not having continuous values in a ring so if I cut
>> the ring at a particular location it has to be at the end of a trapezoid
>> section if I want the gradient to fill to the end. Otherwise it looks to
>> work well. Think there might be an easier way to do this though so I am
>> asking about it. Has anyone had good success drawing circular gradients
>> in a ring? I am looking to be able to add some Cairo gradients to a
>> gauge widget so efficiency would be a good thing if the gauge needed to
>> work with a frame clock.
>
> Mesh patches can have Bézier curved sides. A circle can be approximated
> with 8 Bézier curves. A ring can be created with 8 patches. See attached
> example and output.
I attached the executable instead of the code. Here is the code.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20170510/403675d7/attachment.html>
More information about the cairo
mailing list