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).

Interesting. Please indulge some newbie questions. Is gdk_window_set_back_pixmap() documented? All I can find is the function prototype. Where do I apply it (presumably in the configure_event handler where the pixmap is created)? If I use it, do I no longer need to use gtk_widget_draw() to generate expose events? What does the last argument (parent_relative) mean?

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.

That's the plan. )-:

(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....)

Right. My attempts to do better with pixmaps have also had problems. I based my application loosely on the double-buffered clock application in Harlow's book. Instead of re-drawing the entire pixmap and calling gtk_widget_draw to expose the entire drawing area, I've been trying to change only part of the pixmap and expose only what's changed. I can make the brute force version behave predictably but too slowly to be useful. So far, I can't make the more optimized version work predictably. It's probably my error, but I'd just as soon not have to figure it out.

Thanks for any insights.

Steve





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