[cairo] Cannot get transformations to work

ashley at ashleymills.com ashley at ashleymills.com
Tue Oct 20 07:52:23 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().

I see. I suppose you already guessed this: I was imagining that the path
vertices themselves were being transformed.

> 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

OK I'll just write it as a function instead for now. Thanks.

I assume then that 3rd option would be the standard way to transform a
bunch of points?

How would one go about copying the temporary surface back onto the
original surface?

> 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.

What would be subject to rasterization? The printing onto the temporary
surface? Oh I see, so then the surfaces would be combined by simply adding
them together according to opacity?

Thanks

Ashley




More information about the cairo mailing list