[cairo] Storing vector information for drawing later

Mohit Sindhwani ml3p at onghu.com
Tue Nov 24 11:23:34 PST 2009

Hi Guys,

I'm not sure if I can phrase this question correctly, but here goes.

We're drawing a number of lines/ shapes as part of an application and a 
few times a second, we may need to rotate or zoom, etc. the image.  So, 
I was wondering if there's an easy way for us to store a non-raster 
(i.e. vector) copy of the shape that we are drawing so that when the 
next turn comes around, we can easily apply the correct transformation 
to the stored shape and render.  I'm not sure how much of a performance 
improvement it may have, but perhaps someone can guide if this makes any 
sense at all.

Essentially, there's quite a bit of line_to, move_to, etc. that gets 
called in drawing the shape.  Now, I'm wondering if I can collect all of 
these just before the cairo_stroke or cairo_fill and then reuse that 
somewhere else after doing a rotate or something.

In some senses, I use the preserve API to repeat the same operation with 
2 different line widths (a simple way to draw a thick line with a 
border), but just wondering if there's something more complex that I can 
use.  Do paths offer this functionality?

11/25/2009 | 3:23 AM.

More information about the cairo mailing list