drawing on the window background




Hi there,

Below is a snippet of a program that creates a GtkWindow and draws an
image onto it. the problem is, I can see the image get painted, then
overdrawn with grey. It stays grey until I 'expose' part of the window.
How can I avoid the gray overdraw?

/******************************************************************
 * main
 ******************************************************************/
int
main(int argc, char **argv)
{
        gtk_init(&argc,&argv);  

        tmp     = gdk_pixbuf_new_from_file("14b.jpg");
        pix_bkg = gdk_pixbuf_scale_simple(tmp,
                640,480,
                GDK_INTERP_BILINEAR);
        gdk_pixbuf_unref(tmp);

        window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        
        gtk_window_set_default_size(GTK_WIDGET(window), 640, 480);
        
        gtk_signal_connect(GTK_OBJECT(window),"expose_event",w_expose,NULL);

        gtk_widget_show(GTK_WIDGET(window));

        gtk_main();
};


/******************************************************************
 * w_expose
 ******************************************************************/
static int
w_expose (GtkWidget *widget, GdkEventExpose *event)
{

        gdk_pixbuf_render_to_drawable_alpha(
                pix_bkg,
                window->window,
                0,0,
                0,0,
                640,480,
                GDK_PIXBUF_ALPHA_BILEVEL,
                0,
                GDK_RGB_DITHER_NONE,
                0,0);

};




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