[cairo] request for pattern duplication function

Theo Veenker Theo.Veenker at let.uu.nl
Fri Oct 3 15:40:54 PDT 2008


Behdad Esfahbod wrote:
> 
> 
> Theo Veenker wrote:
>  > Hi all,
>  >
>  > In my application I need to be able to copy a pattern. Now I do that 
> in my
>  > application. I'd prefer having a cairo API for doing this. Otherwise I'd
>  > need to update my code each time when new pattern types are added to 
> cairo
>  > (assuming that will happen).
>  >
>  > I like to suggest an API for duplicating a pattern, something like:
>  >    cairo_pattern_t* cairo_pattern_copy(cairo_pattern_t *pattern);
>  >
>  > Could this be added to the wishlist please?
> 
> Do you need to modify either of the patterns afterwards?  Does
> cairo_pattern_reference() not solve your problem?

1 Yes, 2 No.
Assume an animation context where I have a current scene drawn using one
or more patterns. The next scene, for example, involves modifying a pattern's
transformation matrix. By working on a copy of the pattern I can leave
the current pattern intact. I need to leave the current patterns intact
because I need to be able to completely redraw (or export) the current
scene as it is. Conceptually I keep a current drawing and a new drawing.

Theo




More information about the cairo mailing list