Re: [gtk-list] instant draw
- From: John C Atkeson <jcatkeson juno com>
- To: gtk-list redhat com
- Cc: gtk-list redhat com
- Subject: Re: [gtk-list] instant draw
- Date: Tue, 07 Sep 1999 20:15:27 EDT
>>
Since I use multi threads( using gdk_thread_lock....), I wonder whether
there is some way to instantly drawing.
Which means, after calling gdk_draw_line() (and other drawing
functions), the screen immediately shows what you have drawed.
<<
I do it two ways...
One is to draw onto the pixmap and repeatedly copy the pixmap to the
widget window with gdk_draw_pixmap(widget->window, somecolor, pixmap,
0,0, 0,0, widgetwidth, widgetheight);
(Better look up gdk_draw_pixmap yourself than trust my memory, it's
used in the "scribble.c" demo at the official tutorial site.)
The other way is to make gdk_draw_line draw directly on the
widget->window space: gdk_draw_line(drawing_area->window, mycolor,
x1,y1,x2,y2);
That shows up instantly. The downside is, when you cover the window
the picture gets wiped and doesn't refresh, so when I do this I call
gdk_draw_line twice for every line, once for direct-window draw and again
for the refreshing pixmap.
void MyDrawLine(int x1,int y1,int x2,int y2,GdkGC *mycolor)
{
gdk_draw_line(drawing_area->window, mycolor, x1,y1,x2,y2);
gdk_draw_line(pixmap, mycolor, x1,y1,x2,y2);
};
Which of these two ways is more efficient depends on what you are
doing...
Good luck,
John
___________________________________________________________________
Get the Internet just the way you want it.
Free software, free e-mail, and free Internet access for a month!
Try Juno Web: http://dl.www.juno.com/dynoget/tagj.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]