[cairo] cairo reset

Mike Emmel mike.emmel at gmail.com
Fri Sep 22 08:49:19 PDT 2006


On 9/22/06, Mike Emmel <mike.emmel at gmail.com> wrote:
> On 9/22/06, Kevin Brooks <kb_list at yahoo.com> wrote:
> > Hello,
> >
> > I want to know if there is something like
> > "cairo_reset(cairo_t*)" function to "reset" cairo
> > context or it must be destroyed and created to start
> > over again.
> >
> To add to this cairo issues a number on non fatal errors esp ones about the path
> not existing there is no way to reset cairo_status_t if you can handle
> the problem
> i.e. catch the error and continue. Once cairo_status_t is set your dead.
> In general there seem to be systematic problems in the code with operations
> that can be performed without a path and those that require a path.
> By sys
>
Sorry accidently sent.
By systematic I mean its not clear without careful reading of the docs which
methods can be performed without a path set.

I actually think the best answer would be to have a moveto 0 0 be required on
initialization since it simplifies the code. A boolean exists to
determine of the
path was ever actually intialized by the user. The implicit
initialization would leave
this boolean unset.

Finally of course there is no efficient way to copy the path between cairo_t's
In general one programing style I'd love to use is to create a cairo_t
thats  abstract
and not attached to a real surface ( I do this now with a 1,1 image
surface ) then
use it as a template for a real surface.  save  and restors on the template path
should protect it from modification.

Think of it as a really advanced and cool src for a cairo_t.

So you would have

cairo_save(template_cr)
cairo_set_source_cairo_t(cr,template_cr);
cairo_paint(cr);
cairo_restore(template_cr);

Or simpler to do since its not thread safe
add a

cairo_set_destination_surface(cairo_t* template,cairo_surface_t* dest);

then you would have.

cairo_save(cr)
cairo_set_destination_surface(cr,dest);
cairo_restor(cr); //restores cr to last state.

And maybe we would want to add a static public surface that
represented a template
surface and was not drawable. cairo_surface_t  HIDDEN

This would be almost trivial to add I think and very powerful.
Supporting the concept of templates however you do it makes for a really cool
drawing model.
We would wan't to of course that




> > Thanks your help.
> >
> > Kev
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
> > _______________________________________________
> > cairo mailing list
> > cairo at cairographics.org
> > http://cairographics.org/cgi-bin/mailman/listinfo/cairo
> >
>


More information about the cairo mailing list