[Cairo] Suggestion for replacing cairo_copy with set_gstate.

gjc at inescporto.pt gjc at inescporto.pt
Fri Sep 26 14:53:20 PDT 2003

A Sex, 2003-09-26 às 19:40, Carl Worth escreveu:
> On Sep 26, Bill Spitzak wrote:
>  > My recomendation:
> Hi Bill,
> The first 4 points in your recommendation match the status quo
> precisely.
> The issue is that there is no way to replace en masse the contents of
> the current graphics state inside a cairo_t. This deficiency has
> already forced one user to ignore the stack inside cairo_t and
> resort to maintaining a private stack of cairo_t objects created via
> cairo_copy. That doesn't seem ideal.
> The latest proposal eliminates cairo_copy, but if we look at its
> potential equivalent:
> 	cairo_t *copy = cairo_create ();
> 	cairo_gstate_t *gstate = cairo_get_gstate (cr);
> 	cairo_set_gstate (copy, gstate);
> we see that there's a memory management issue with the cairo_gstate_t
> object. We could add:
> 	cairo_gstate_destroy (gstate);
> But I don't like that as this would be the sole cairo_gstate function,
> and I also don't want to require any of the object-based APIs to be
> used for any core functionality, (and this seems like a core
> operation).
> Perhaps instead we just want a single function to copy the graphics
> state from one cairo_t to another. Perhaps drop cairo_copy and add
> something like:
> 	cairo_set_graphics_state (cr, copy);

  Hi, new to this list. :)

  There's prior art for this:

  BTW, have you guys looked at libplot?  It is also modeled after
postscript and only has savestate/restorestate, none of this state
copying stuff.

  However, one could argue that libplot is primitive and I'd have to

> And then if the user wants to hold on to just the graphics state, they
> can just use a proxy cairo_t for that.
> Does that make any sense? Hopefully I'm not talking in circles.
>  > cairo_pop (or whatever it is called) will do nothing if the pop pointer is 
>  > zero.
> This goes to the issue of error handling. See my future email. ;-)
> -Carl
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://cairographics.org/cgi-bin/mailman/listinfo/cairo
Gustavo J. A. M. Carneiro
<gjc at inescporto.pt> <gustavo at users.sourceforge.net>

More information about the cairo mailing list