Re: drawing graphics



Ian Britten wrote:

In addition to using a background pixmap (as suggested), I also 'attach'
the pixmap to the window (using gdk_window_set_back_pixmap()).
This way, you never have to deal with expose events (unless you are
drawing stuff that isn't in your background pixmap).

All in all, this give a very fast and pleasing application.  No flicker,
no waiting for expose events to be processed, the data is always visible
(Even when stepping through the debugger! :-) etc, etc.
(As you've discovered, trying to draw all your data within every expose
event is really inefficient, and grinds your app to a standstill if you
have much data to draw....)

We almost forget to say about gtk_widget_set_double_buffered() in gtk+-2.0.
In this case you have to turn off gtk double buffering stuff, cause its not needed:
gtk_widget_set_double_buffered(widget, FALSE);

Olexiy





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]