[cairo] Changing color mid-stroke

Alexander Larsson alexl at redhat.com
Wed Jan 14 01:20:17 PST 2009


On Tue, 2009-01-13 at 18:40 -0600, AngryZealot wrote:
> Hi all,
> 
> I'm wondering if there's a way to change color in the middle of a
> cairo_line_to operation, or at least a workable way to fake the
> result. For an example of what I'd like to produce, see the picture
> here: http://i208.photobucket.com/albums/bb305/AngryZealot/miter.jpg
> 
> Basically I need a way to split the joining piece between two
> arbitrary line segments (ie, the joining angle is not fixed). I
> realize this is somewhat unusual (neither Inkscape nor Adobe
> Illustrator can do it without outlining the stroke). If somebody more
> familiar with cairo has any ideas, it would be much appreciated.

Draw twice with different colors and set a clip region so that you only
draw the right color at the right side. Should be pretty simple to
calculate the clip region given the common endpoint and the direction of
the two line segments.



More information about the cairo mailing list