[cairo] Proposal: cairo_save_state/cairo_restore_state

Carl Worth cworth at cworth.org
Tue Jan 24 14:21:14 PST 2006


On Tue, 24 Jan 2006 12:47:25 -0800, Stuart Parmenter wrote:
> On 1/23/06, Carl Worth <cworth at cworth.org> wrote:
> 
> > Here's the API that I think is needed:
> >
> >         cairo_state_t *
> >         cairo_save_state (cairo_t *cr);
> >
> >         void
> >         cairo_restore_state (cairo_t *cr, cairo_state_t *state);
> 
> How do these effect the normal cairo_save() and cairo_restore()
> stacks?

cairo_save_state:	No change to the current state or stack in cr

cairo_restore_state:	Changes only the graphics state at the current
			head of the stack

Just think of cairo_save_state as being equivalent to a much more
convenient (and more reliably complete) way of doing:

	cairo_get_line_width
	cairo_get_line_cap
	cairo_get_line_join
	cairo_get_miter_limit
	cairo_get_fill_rule
	etc....

And then cairo_restore_state is the same as doing:

	cairo_set_line_width
	cairo_set_line_cap
	cairo_set_line_join
	cairo_set_miter_limit
	cairo_set_fill_rule
	etc....

So the new cairo_save/restore_state don't touch the stack at all. But
I don't think that difference violates the strong connection that
motivates the similar naming. The usage of cairo_save/restore_state
will still be *very* similar (though in different cases) than
cairo_save/restore.

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060125/32ec3131/attachment.pgp


More information about the cairo mailing list