[cairo] Proposal: cairo_save_state/cairo_restore_state
Owen Taylor
otaylor at redhat.com
Tue Jan 24 17:55:46 PST 2006
On Wed, 2006-01-25 at 11:21 +1300, Carl Worth wrote:
> 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.
Maybe it would make sense to come up with a slightly-non-trivial
example of where this is useful? I'm not sure I see it yet.
Regards,
Owen
More information about the cairo
mailing list