gdk_draw_gray_image crash
- From: Pradeep <pradeep ncoretech com>
- To: gtk-devel-list gnome org
- Subject: gdk_draw_gray_image crash
- Date: Wed, 06 Mar 2002 12:37:05 +0530
Hi ,
I am trying to use gdk_draw_gray_image in the following program
but the application crashes when I run the apllication program at
gdk_draw_gray_image , can anyone tell me the problem I am facing ,
I am using Xfbdev for this purpose , could that be a problem related
to
Xserver ?
Waiting for your reply
Thanks ,
Pradeep
#include <gtk/gtk.h>
#define IMAGE_WIDTH 255
#define IMAGE_HEIGHT 255
guchar rgbbuf[IMAGE_WIDTH * IMAGE_HEIGHT ];
gboolean on_darea_expose (GtkWidget *widget,
GdkEventExpose *event,
gpointer user_data);
int
main (int argc, char *argv[])
{
GtkWidget *window, *darea;
gint x, y;
guchar *pos;
gtk_init (&argc, &argv);
gdk_rgb_init();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
darea = gtk_drawing_area_new();
gtk_drawing_area_size (GTK_DRAWING_AREA (darea), IMAGE_WIDTH, IMAGE_HEIGHT);
gtk_container_add (GTK_CONTAINER (window), darea);
gtk_signal_connect (GTK_OBJECT (darea), "expose-event",
GTK_SIGNAL_FUNC (on_darea_expose), NULL);
gtk_widget_show_all (window);
/* Set up the RGB buffer. */
pos = rgbbuf;
/* pradeep */
for (y = 0; y < IMAGE_HEIGHT; y++)
{
for (x = 0; x < IMAGE_WIDTH; x++)
{
// *pos++ = x - x % 32;
// *pos++ = (x / 32) * 4 + y - y % 32;
// *pos++ = y - y % 32;
*pos++ = x;
}
}
/* pradeep */
gtk_main();
return 0;
}
gboolean
on_darea_expose (GtkWidget *widget,
GdkEventExpose *event,
gpointer user_data)
{
gdk_draw_gray_image (widget->window,widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
0, 0, IMAGE_WIDTH, IMAGE_HEIGHT,
GDK_RGB_DITHER_NONE, rgbbuf, IMAGE_WIDTH );
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]