[cairo] Drawing an arrow

Jeremy Moles jeremy at emperorlinux.com
Wed Nov 24 20:42:45 PST 2010

On Tue, 2010-11-23 at 16:27 +0000, necko necko wrote:
> A set of 2D coordinates needs be connected by lines, but some of these
> lines need be arrows;
> meaning, the sequence
>     cairo_move_to (cr, A.x, A.y);
>     cairo_line_to (cr, B.x, B.y);
> that draws a line from A to B, needs to be replaced with an arrow from
> A to B.
> Any help on how to achieve this is highly welcome.
> Thanks

It turns out, Behdad has already provided some code that does something
very similar to this! I include the code in Cairocks, the function is
called "map_path_onto" and I got it from some of his code... somewhere.

Please see the attached image for a demonstration. I only use a simple
arc as the path, but you could just as well use anything.

Weee! :)

> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo

-------------- next part --------------
A non-text attachment was scrubbed...
Name: arrows.png
Type: image/png
Size: 11433 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20101124/dceb7574/attachment.png>

More information about the cairo mailing list