[cairo] How to refer Cairo::Context outside on_expose_event

David Björkevik david at bjorkevik.se
Mon May 4 02:17:52 PDT 2009


陈凯 wrote:
> Greetings,
> 
> Maybe a silly question but I still wonder why.  Can it possible for
> Cairo::Context to be referred outside on_expose_event?  I just want to
> preserve some configurations of the context, like line width and dash
> pattern, instead of always call set_line_width() inside on_expose_event,
> which I think is inefficient.

This is how it's supposed to be done. Why is it inefficient? Are you
having performance issues due to a call to set_line_width on every expose?

I think that the cairo context needs to be created and destroyed on
every expose, but I don't know enough about the intrinsics to know if
there is a way around it.

/David


More information about the cairo mailing list