[cairo] Storing vector information for drawing later

Emmanuel Pacaud emmanuel.pacaud at lapp.in2p3.fr
Thu Nov 26 11:13:05 PST 2009


Le jeudi 26 novembre 2009 à 19:33 +0100, Mohit Sindhwani a écrit :
> Mohit Sindhwani wrote:
> > 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?
> Just bumping this topic, to see if anyone has any insight or links for me :)

The current development snapshot (1.9.2) exports the cairo-meta-surface,
that can be used for vector operation recording.

It will be renamed to cairo-recording-surface in the next stable version
(which is already done in cairo git master branch).


More information about the cairo mailing list