Bug in GtkCurve?



The following code, results in a straight line:

gfloat points[] = {0, 0, 25, 25, 50, 50, 75, 50, 85, 55, 100, 100};
gtk_curve_set_range (GTK_CURVE(curve) 0, 100, 0, 100);
gtk_curve_set_vector (GTK_CURVE(curve), 6, points);
gtk_curve_set_curve_type(GTK_CURVE(curve), GTK_CURVE_TYPE_SPLINE;

Which one would not expect (unless I am missing something).  I cannot
seem to initialize a curve to anything different to a straight line.
Points in the middle seem to be ignored.

I am running GTK 1.2.10 on a RH 7.3.  A person running 1.2.8
reported it works there.
Here is the code that reproduces the problem on my platform:

#include <gtk/gtk.h>

gint delete_event( GtkWidget *widget,
                   GdkEvent  *event,
                   gpointer   data )
{
 
  gtk_main_quit();
}

int main( int argc,
          char *argv[] )
{
  GtkWidget *window;
  GtkWidget *curve;
  gfloat points[] = {0, 0, 25, 25, 50, 50, 75, 50, 85, 55, 100, 100};
  
  gtk_init(&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  curve = gtk_curve_new ();

  gtk_signal_connect (GTK_OBJECT (window), "delete_event",
                      GTK_SIGNAL_FUNC (delete_event), NULL);

  gtk_container_set_border_width (GTK_CONTAINER (window), 10);
  gtk_container_add (GTK_CONTAINER (window), curve); 

  gtk_widget_show (curve);
  gtk_widget_show (window);

  gtk_curve_set_range (GTK_CURVE(curve), 0, 100, 0, 100);
  gtk_curve_set_vector (GTK_CURVE(curve), 6, points);
  gtk_curve_set_curve_type(GTK_CURVE(curve), GTK_CURVE_TYPE_SPLINE);

  gtk_main ();

  return(0);
}

Regards

-- 
Elena Shejn <shejne mail msiu ru>




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