Re: drawables and refresh rates



Carl Nygard wrote:

Hooking into the expose_event should work.  Gtk takes care of the double
buffering itself.  I think it's automatic, but I could be wrong...

Just create the pixmap and draw to it first time through the expose
callback?  Or some other ugly hack, I don't remember the answer.  Could
be hook into configure event, or realize event.  There's examples on
this because allocating colors has the same sort of problem.


    // .. create widgets

    _widg->signal_expose_event().
        connect(SigC::slot(*this, &GtkScreen::_ExposeCB));

     //  initialization

     _widg->queue_draw();



I guess I'm just not following you here. But that sounds like what I tried the first time around:

============================================================================
myclass::drawingarea_realize()
{
	_draw_window = drawarea.get_window();
	_gc = Gdk::GC::create(_draw_window);
	_draw_window->clear();
}

myclass::drawingarea_expose_event(GdkEventExpose * e)
{
	_draw_window->draw_arc(/* blue circle */);
	_draw_window->draw_arc(/* red arc */);
	_draw_window->draw_pixbuf(/* draw svg */);
}
============================================================================

I was trying to use a pixmap in the expose handler to double buffer but like I said it needs a drawable for its create method and that drawable must be realized.



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