Widget after ExposeEvent



Hallo,

I write a program with the following lines:
////////////////////////////////////////////////////
{
...
bild = gtk_drawing_area_new ();
gtk_widget_set_size_request(bild, 240, 320);
gtk_signal_connect(GTK_OBJECT(bild), "expose-event",
GTK_SIGNAL_FUNC (exposebild), NULL);
...
}

gboolean exposebild(GtkWidget *widget, 
                GdkEventExpose *event, 
                gpointer user_data)
{
    bilddarstellung (widget);   
    return TRUE;
}

void bilddarstellung (GtkWidget *widget)
{
    GdkPixbuf *pixbuf;
    GError *err = NULL;
    gint image_width;
    gint image_height;

    if (dateisenden == NULL)
    {
        pixbuf = gdk_pixbuf_new_from_file("einbild.jpg",
&err); 
    }
    else 
    {
        pixbuf = gdk_pixbuf_new_from_file (dateisenden,
&err);
    }
    image_width = gdk_pixbuf_get_width(pixbuf);
    image_height = gdk_pixbuf_get_height(pixbuf);
    
    gdk_pixbuf_render_to_drawable(pixbuf, 
                                  widget->window, 
                                  widget->style->fg_gc[GTK_STATE_NORMAL],
                                  0, 0, 0, 0, image_width, image_height,
                                  GDK_RGB_DITHER_MAX, 0, 0);
    g_object_unref(pixbuf);     
}
////////////////////////////////////////////////////

Now I want to call the function bilddarstellung
directly. But when I write

bilddarstellung (bild);

a segmentation fault appears in
gdk_pixbuf_render_to_drawable (...)!

How can I call the function bilddarstellung with the
Drawing Area bild directly? Which GtkWidget *widget is
it in bilddarstellung or how can I create it?

I want to know this because I want to see the JPG
after selecting it and not after resizing my window!
Perhaps there is another solution ...

Bye

Christian

__________________________________________________________________

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Bis zu 100 MB Speicher bei http://premiummail.yahoo.de



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