gdk_pixbuf_render_to_drawable seg fault
- From: Abiel Reinhart <reinhart pacinfo com>
- To: gtk-app-devel-list gtk org
- Subject: gdk_pixbuf_render_to_drawable seg fault
- Date: Fri, 29 Dec 2000 10:20:42 -0800
When attempting to use the gdk_pixbuf_render_to_drawable call to draw an
image into a drawing area, I receive a segmentation fault.
gcc version 2.96 20000731 (Red Hat Linux 7.0)
Here is the code I am using:
#include <stdio.h>
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
int main(int argc, char *argv[]) {
GtkWidget *window;
GtkWidget *drawable;
GdkPixbuf *image;
int width, height;
int rowstride, bits;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_set_usize(GTK_WIDGET(window), 400, 400);
gtk_widget_realize(window);
drawable = gtk_drawing_area_new();
gtk_drawing_area_size(GTK_DRAWING_AREA(drawable), 320, 240);
gtk_widget_show(drawable);
gtk_container_add(GTK_CONTAINER(window), drawable);
gtk_signal_connect(GTK_OBJECT(window), "destroy",
GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
image = gdk_pixbuf_new_from_file("stdimg.xpm");
if (image == NULL)
perror("Image file not opened");
width = gdk_pixbuf_get_width(image);
height = gdk_pixbuf_get_height(image);
rowstride = gdk_pixbuf_get_rowstride(image);
bits = gdk_pixbuf_get_bits_per_sample(image);
printf("W: %d, H: %d, R: %d, BPS: %d\n", width, height, rowstride,
bits);
gdk_pixbuf_render_to_drawable(image,
drawable->window,
drawable->style->fg_gc[GTK_STATE_NORMAL],
0, 0,
0, 0,
width, height,
GDK_RGB_DITHER_NONE, 0, 0);
gtk_widget_show(window);
gtk_main();
return 0;
}
The debugger produces the following output:
(gdb) run
Starting program: /home/abiel/test/player/pixbuf
W: 320, H: 240, R: 1280, BPS: 8
Program received signal SIGSEGV, Segmentation fault.
0x40176b83 in gdk_draw_rgb_image_dithalign () from
/usr/lib/libgdk-1.2.so.0
(gdb)
Thanks,
Abiel Reinhart
reinhart pacinfo com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]