Flickering images on drawable




I am displaying some graphics on a drawable widget, one using 
gdk_draw_gray_image is a background map which changes infrequently.
The other is a circle (using gsk_draw_arc) which will change position 
every 1/10 of a second. (I have included a code fragment below on how 
I am doing this).

My problem is that the circle flickers on the display, and this display
is really loading the CPU. I get both problems even if I do not update
it (i.e. I only call the functions listed below once). The background map
does not flicker. My guess is that the computer is drawing the background
map (mostly black) then draws the circle, then draws the map etc and I
can see the phase when just the map is being shown.

My question is how can I avoid this. Am I using the wrong types of 
commands? I could prabably draw the circle onto the guchar array
which I use for gdk_draw_gray_image and then just draw this image
but since the cicle moves over this fairly static background I would
have to worry about erasing it.

Finally for scale. The drawing area ranges from 100x100 to 500x500
pixels. However in the future I will be increasing this upto something
more like 3000x3000.

Stewart
sjm@ri.cmu.edu


gtk_drawing_area_size(GTK_DRAWING_AREA(guiState.topoMapWin),
 		       guiState.cols*guiState.mag,
                       guiState.rows*guiState.mag);	
gdk_draw_gray_image(guiState.topoMapWin->window,
                    guiState.topoMapWin->style->fg_gc[GTK_STATE_NORMAL],
                    0, 0, guiState.cols*guiState.mag,
 		    guiState.rows*guiState.mag, GDK_RGB_DITHER_NONE,
                    guiState.topoMapRgb, guiState.cols*guiState.mag);

gdk_draw_arc(guiState.topoMapWin->window,
 	     guiState.topoMapWin->style->white_gc,
             TRUE, x - (gint)(radius), y - (gint)(radius), (gint)(2*radius),
             (gint)(2*radius), 0, 23040);

gtk_widget_show_all(guiState.topoMapWin);



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