[cairo] Cannot get transformations to work

Kalle Vahlman kalle.vahlman at gmail.com
Tue Oct 20 06:40:40 PDT 2009


2009/10/20  <ashley at ashleymills.com>:
[snip]
> Am I doing something obviously incorrect here in my usage?

Yes, as the transformations only apply to paths drawn *after* the
calls to _translate() and _rotate().

So you can't "move" the path after defining it. To do that there's
three options (of which I'm aware):

 * copy the path with cairo_copy_path() and add it back after
translating using cairo_append_path()
 * separate the arrow drawing to a function and call it twice
 * render the arrow to a temporary surface and translating that

The last option is probably going to be the fastest, but is also
subject to rasterization so the quality might not be satisfactory. The
second is what people usually do I think.

Cairo gurus please correct me if I'm talking silly talk :)

-- 
Kalle Vahlman, zuh at iki.fi
Powered by http://movial.com
Interesting stuff at http://sandbox.movial.com
See also http://syslog.movial.fi


More information about the cairo mailing list