[cairo] How can I draw this? (without blur hopefully)

David Björkevik david at bjorkevik.se
Thu Jun 3 13:17:51 PDT 2010


On 2010-06-03 20:10, Andrea Cimitan wrote:
> 2010/6/3 David Björkevik<david at bjorkevik.se>:
>> On 2010-06-02 11:42, Andrea Cimitan wrote:
>>>
>>> As you can see in the first button1 button, the dark gradient seems to
>>> stop before reaching the left and right edges of the button itself,
>>> likeif there was a blur or a glow outside it.
>>> I would like to draw that style with cairo, though I don't know if
>>> there's a real way to do it :)
>>> Any help? :)
>>
>> I would do:
>>
>> 1. Draw the button gradient background
>> 2. Draw a 1px border inside the outside grey border. This border is painted
>> with a different gradient (same bottom color as background, but pure white
>> on tom)
>> 3. Draw the grey outer border
>>
>> /David
>> --
>
> Yeah, but the question is how to draw 1) "button gradient background" :)
>
> It's not a simple linea gradient... it is smooth on the side edges :\
> (that's why it's pretty)
>

Ok, I thought you were referring to the brighter outline as the 
smoothness. However, after zooming in I can see the sligth difference 
from a linear gradient.

In this case, I would first draw the basic linear gradient in the 
background, and then do a tilted almost-transparent linear gradients on 
each side to get the edge effect.

/David


More information about the cairo mailing list