drawing with gdk_draw_rgb_image in a gtk_drawing_area



Hi Everybody

I'm trying to draw some RGB data with the gdk_draw_rgb_image function in
a gtk drawing area, but unfortunately my application crashes with a 
Segmentation Fault ... hmm. The gdk_draw_rgb_image function is 
called in the event handler funtion for the exposure_event.
Here are the important lines of my code, I'm happy about any helpful
comments:

  window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);

  fixed1 = gtk_fixed_new ();

  drawingarea2 = gtk_drawing_area_new ();
    
  gtk_widget_show (drawingarea2);
  gtk_widget_show (fixed1);
  gtk_widget_show(window1);
  gdk_image_init();

   gtk_signal_connect (GTK_OBJECT (drawingarea2), "expose_event",
                         GTK_SIGNAL_FUNC (on_drawingarea2_expose_event),
                         NULL);

.......

gboolean
on_drawingarea2_expose_event           (GtkWidget       *widget, GdkEventExpose  *event,
                                        gpointer user_data)
{
 unsigned  char  buf[2500];
 int  count;
                                                                                      

for (count=0;count<2500;count++)
    buf[count]=count%255;

gdk_draw_rgb_image(widget->window,widget->style->black_gc,0,0,50,50,GDK_RGB_DITHER_NONE,buf,150);

 return FALSE;
 }
                                                                                                  

and in main{} I have the followign initiaization stuff:

  gtk_init(&argc, &argv);
  gdk_rgb_set_verbose(TRUE);
  gdk_rgb_init();
  gtk_widget_set_default_colormap(gdk_rgb_get_cmap());
  gtk_widget_set_default_visual(gdk_rgb_get_visual());





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