Re: [gtk-list] Re: gdk drawing funks



Rene Hogendoorn <hogend@nlr.nl> writes:

> 
> Well, I am trying to do the same. What I found out is that a drawing_area
> does not have a window of its own, so canvas->window stays 0x0 until the
> main window is realized, i.e. after the gtk_widget_show(topwin).
> This gets rid of the error, but it does not show the rectangle as expected.
> If I draw on topwin_>window, I can see the rectangle flashing by. It does not
> stay. Anyone?
> 
> [snip]

I think you can draw directly to the drawing_area window (after showing
the whole widget tree), but you have to redraw it after every expose
event for the drawing_area.

If there's a lot to draw you can buffer it in an image.

e.g.:

	...
	gtk_signal_connect(GTK_OBJECT(canvas), "expose_event",
			GTK_SIGNAL_FUNC(sf_expose), NULL);
	...


	void sf_expose(void) {
	        gdk_draw_image(GTK_WIDGET(canvas)->window, _gc,
			 _imageb, 0, 0, 0, 0, 320, 256);
	}


-- 
Torsten Paul				Es ist leichter, einen Atomkern zu
paul@os.inf.tu-dresden.de	//		spalten als ein Vorurteil.
__________________________ooO_(+ +)_Ooo________Albert Einstein_(1879-1955)
				U



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